Pyserial never read

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • luca72

    #16
    Re: Pyserial never read

    Hello
    ALSO... YOU NEVER SPECIFY A VARIABLE TO RECEIVE THE DATA -- ANYTHING
    YOU DO READ IS BEING DUMPED ON THE FLOOR!

    I see the read data with a sniffer.

    with the same serial caracteristic in delphi i obtain the right answer.

    I use serial writestr and serial readstr.


    If the serial package is anything like regular file I/O, that
    line will buffer/block until a new-line character is received, then
    return data upto/including the new-line. If the inbound data has
    multiple lines, you need individual readlines.

    For example i i send D0360000EC the right answer is
    D0360000EC0000F FBC35DC44 etc...
    i need new Line?

    why if i use ser.read(10) i see only the first 5 byte and not the rest,
    why if i use the inwaigth i answer that i have only 5 byte to read.


    Regards

    Luca

    Comment

    • Peter Hansen

      #17
      Re: Pyserial never read

      Dennis Lee Bieber wrote:[color=blue][color=green][color=darkred]
      >>>>dt = "D0360000EC "
      >>>>print repr("".join([chr(int(dt[2*x:2*x+2],16)) for x in range(len(dt)//2)]))[/color][/color]
      >
      > '\xd06\x00\x00\ xec'[/color]

      By the way, for future reference, this way beats the above hands down:
      [color=blue][color=green][color=darkred]
      >>> import binascii
      >>> binascii.unhexl ify("D0360000EC ")[/color][/color][/color]
      '\xd06\x00\x00\ xec'


      -Peter

      Comment

      • luca72

        #18
        Re: Pyserial never read

        Hello

        i how can set with pyserial the following data?

        [color=blue]
        > byte delay= 40000[/color]
        [color=blue]
        > serial control line:
        > dtr = high
        > rts= low[/color]

        Thanks Luca

        Comment

        Working...