7-bit (7/1/E) w/Schenk's FDS?
luftphoto
Posts: 5
I've hit a brick wall here. Help!
Almost a year ago I posted about a small project I was working on that would need 7-bit serial comm capability. Somewhere along the way someone gave me, or I somehow found a modified version of "full duplex serial", modified by Andy Schenk (and can be downloaded here: http://forums.parallax.com/forums/attach.aspx?a=29977 ).
The modded version of FDS works great for transmit but no matter what I try I can't force it to receive 7-bits, even forcing it to ignore parity, etc... I use this .spin for output and it's absolutely perfect so I'd like to just hack the receive code if possible. Any ideas?
Almost a year ago I posted about a small project I was working on that would need 7-bit serial comm capability. Somewhere along the way someone gave me, or I somehow found a modified version of "full duplex serial", modified by Andy Schenk (and can be downloaded here: http://forums.parallax.com/forums/attach.aspx?a=29977 ).
The modded version of FDS works great for transmit but no matter what I try I can't force it to receive 7-bits, even forcing it to ignore parity, etc... I use this .spin for output and it's absolutely perfect so I'd like to just hack the receive code if possible. Any ideas?
Comments
If you have 7 bits with Even parity, then these are 8 bits total. On transmit the driver can replace the highest bit with the right parity. On receive the highest bit representate the parity that the sender on the other side sends, but this bit is not checked against correctness.
So you get 8 bits bit 6..0 = 7bit Data, bit 7 = parity. If you don't want check the parity, then you can ignore it with:
data := <obj>.rx & %01111111
This masks bit 6..0 and set bit 7 to zero. <obj> is the name of your included serial object.
Andy
If anyone else needs the info, I changed the code here:
PUB rxcheck : rxbyte
'' Check if byte received (never waits)
'' returns -1 if no byte received, $00..$FF if byte
rxbyte--
if rx_tail <> rx_head
rxbyte := rx_buffer[noparse][[/noparse]rx_tail] & %01111111
rx_tail := (rx_tail + 1) & constant(RXBUFFSZ-1)
@luftphoto: Care to post your complete code? (can't seem to follow original link)
But the object sends 2 stop bits, I hope this is not a problem.
Andy