Read all data of serialport

  1. 2 weeks ago

    Guys, I'm finding this problem within my project. In practice I'm working with the RS232 serial port of my device, and when I ask for the configuration it doesn't print everything to me. But only a part, in the attachment I put the photos. 1) Hercules terminal 2) Xojo

    -image-
    -image-

    CODE:

    if InStr(me.LookAhead(Encodings.ASCII), chr(13)+chr(10)) > 0 then
      TextArea1.text = TextArea1.Text + Me.Readall(Encodings.ASCII)
    end if
  2. I think keeping one thread for your "getting started" with rs232 should be best; but that is my personal opinion.

    As for your question. I am not sure where you currently have your Serial1.readall code, but you should have it either in the DataAvailable event or, what I think works better in Xojo, on a timer that "polls" the port every 100ms or so. And unless you really need the lookahead function, I would just read it all at once (and concatenate/parse as needed afterwards).

  3. Ulrich B

    Jun 10 Pre-Release Testers, Xojo Pro Europe (Germany, Berlin) · xo...

    … and it does not make much sense to check for en Endofline and then read all the serial input anyway.
    If Endofline is the separator for one device reply, you should only read that much. Or you should not wonder about incomplete replies.

  4. Then? what's missing i can't see all the printf? Do I need to insert a timer?

or Sign Up to reply!