Shop OBEX P1 Docs P2 Docs Learn Events
start/stop bit ???? — Parallax Forums

start/stop bit ????

electromanjelectromanj Posts: 270
edited 2010-11-07 08:44 in Propeller 1
Hello all!
I have a question about start and stop bits in a serial protocal. Modbus RTU.
The "telegram" I need to send is....
HEX 01_03_3F_01_00_01_D9_DE
The info that I have states that each byte should be 11 bits. 1 start bit, 8 data bits, and two stop bits, no parity. From what I've read the rx line of the device I'm sending to is idle high, and I'm guessing that my start bit needs to be a 0 and the stop bits need to be a 1.
Does this look even close to correct or am I way off?
vfd.tx (%0$01%1_1_0$03%1_1_0$3F%1_1_0$01%1_1_0$00%1_1_0$01%1_1_0$D9%1_1_0$DE%1_1)
       'b^h--bs s ^h--bs s ^h--bs s ^h--bs s ^h--bs s ^h--bs s ^h--bs s ^h--bs s
       ' b = binary indicator
        '^ = start bit
       ' h = hex indicator
       ' -- = hex byte
       ' s = stop bitThanks in advance.
Thanks in advance.

Comments

  • kwinnkwinn Posts: 8,697
    edited 2010-11-06 22:50
    If you scoped the output of an RS232 driver chip HEX 01 would be: LHHHHHHHLHH
    Where L is -3 to -15V (1) and H is +3 to + 15V (0), in binary 10000000100

    Any hex or 8 bit character would be LxxxxxxxxHH, where the x represents the individual 8 bits.
  • Phil Pilgrim (PhiPi)Phil Pilgrim (PhiPi) Posts: 23,514
    edited 2010-11-06 23:12
    kwinn,

    The output from an RS232 driver is inverted, the idle state is 1 (mark) and serial data is sent LSB first. So the output from an RS232 driver for a HEX 01 would be
        S
        T        SS
        A        TT
        R        OO
        T        PP
    1111010000000111111 <- data
    LLLLHLHHHHHHHLLLLLL <- RS232 output
    
  • electromanjelectromanj Posts: 270
    edited 2010-11-07 06:49
    Thanks for the replies.

    I forgot to mention that I will be using a TTL to RS485 Converter. (SerialComm TTL-485-5P).
  • kwinnkwinn Posts: 8,697
    edited 2010-11-07 08:44
    Phil, good catch. I should know better than to answer questions late at night when I am tired.
Sign In or Register to comment.