Shop OBEX P1 Docs P2 Docs Learn Events
FullDuplexSerial Stop Bits — Parallax Forums

FullDuplexSerial Stop Bits

TomSTomS Posts: 128
edited 2007-05-26 20:52 in Propeller 1
I'm using the Parallax Full Duplex Serial object and have noticed that when transmitting, it uses two stop bits. I would like to modify the code to send only one stop bit but of course I don't know assembly programming. Anybody have an answer for me (other than learning assembly)?

All help appreciated
Tom

Comments

  • Peter JakackiPeter Jakacki Posts: 10,193
    edited 2007-05-26 00:30
    Hi Tom,

    Usually it's not a problem if 2 stop bits are transmitted as most applications are not trying to push the limits of a already limited communications medium. The FullDuplex object does not actually send 2 stop bits but it effectively does so because it transmits an idle bit before the start bit. The code snippet around line 252 (comments added) shows that a stop bit is appended with #$100 and then room is made for a start bit and a padding bit by shifting left 2 bits. The data is transmitted lsb first so the first bit is actually an idle bit.

                            or      txdata,#$100          'Add a stop bit after the 8 data bits
                            shl     txdata,#2               'make room for a start bit plus a padding bit
                            or      txdata,#1               'force the padding bit to an idle/stop bit 
                            mov     txbits,#11            'count 8 data + 1 stop + 1 start + 1 idle/stop
                            mov     txcnt,cnt
    
    



    I haven't tried it but you could try this.

                            or      txdata,#$100          'Add a stop bit after the 8 data bits
                            shl     txdata,#1               'make room for a start bit plus a padding bit
                            mov     txbits,#10            'count 8 data + 1 stop + 1 start
                            mov     txcnt,cnt
    
    


    *Peter*
  • TomSTomS Posts: 128
    edited 2007-05-26 00:37
    Thanks Peter,

    I'll give it a try.

    Tom
  • TomSTomS Posts: 128
    edited 2007-05-26 12:18
    It Works!

    Thanks Again Peter. I'm not making the change for speed but for compatability.

    Tom
  • Mike GreenMike Green Posts: 23,101
    edited 2007-05-26 13:49
    From a compatibility standpoint, it shouldn't matter. To any receiver attached to the Propeller, a serial stream with 2 stop bits is indistinguishable from a serial stream with 1 stop bit and a little bit of internal delay between characters transmitted due to computation or other I/O. The side of FullDuplexSerial dealing with receiving an external serial stream only needs one stop bit, doesn't even check for that, and will accept essentially any delay between characters.
  • TomSTomS Posts: 128
    edited 2007-05-26 20:52
    Thanks for the good info Mike. I'm replacing a commercial device that uses one stop bit with my propeller driven device and I want the change to my device to be totally transparent. You're right, it probably wouldn't make any difference though.

    Tom
Sign In or Register to comment.