parity in bit banged serial

Questions on UARTs, and serial communication
Post Reply
YahooArchive
Posts: 1463
Joined: Fri Oct 19, 2012 5:11 am

parity in bit banged serial

Post by YahooArchive » Mon Feb 11, 2013 12:07 am

When using the bit banged UART, is there a way to change settings besides the
baud rate? For instance, 7/8 bit, or a parity bit?



YahooArchive
Posts: 1463
Joined: Fri Oct 19, 2012 5:11 am

Re: parity in bit banged serial

Post by YahooArchive » Mon Feb 11, 2013 12:08 am

Yes, the source for BASIC is in the /program files (x86)/coridium/BASIClib
directory, SERIAL.bas

YahooArchive
Posts: 1463
Joined: Fri Oct 19, 2012 5:11 am

Re: parity in bit banged serial

Post by YahooArchive » Mon Feb 11, 2013 12:10 am

Thanks Bruce, I had no idea that was there.

I dont actually see any definitions, or variables to directly set the number of
bits, or the parity bit. I assume these are modifications I would simply have
to make to the code manually. I am fine with that, I just wanted to verify that
I wasnt missing something.

YahooArchive
Posts: 1463
Joined: Fri Oct 19, 2012 5:11 am

Re: parity in bit banged serial

Post by YahooArchive » Mon Feb 11, 2013 12:10 am

When those were written it was for just 8 bit, 1 stop bit. But you can change
the limits in RXD and TXD to do 7 bits. Actually with parity, you'd have to
compute that and place that in bit 8 and the limits would be the same.

YahooArchive
Posts: 1463
Joined: Fri Oct 19, 2012 5:11 am

Re: parity in bit banged serial

Post by YahooArchive » Mon Feb 11, 2013 12:25 am

I am sorry, I am not very familiar with BASIC. I assume the limits are
controlled by the final 'while' loop in the command, in RXD for instance the
while loop is 'while i < $100'. I cannot figure out what '$100' is, but I am
guessing it would control the number of bits to receive.

YahooArchive
Posts: 1463
Joined: Fri Oct 19, 2012 5:11 am

Re: parity in bit banged serial

Post by YahooArchive » Mon Feb 11, 2013 12:26 am

Rather than

for i=0 to 8
...
ch and (1 << i)
next i

the code is

i=1
while i < &H100 ' hex bit 8 &H VB syntax, $ is PBASIC, both are OK
...
ch and i
i = i << 1
loop

YahooArchive
Posts: 1463
Joined: Fri Oct 19, 2012 5:11 am

Re: parity in bit banged serial

Post by YahooArchive » Mon Feb 11, 2013 12:30 am

I have been looking through the code, and I cant seem to find anything which
helps prevent framing errors in the event that packets come in very fast and
only 1 stop bit is used.

Am I missing something, or is it assumed that the data packets will arrive
sufficiently slow?

YahooArchive
Posts: 1463
Joined: Fri Oct 19, 2012 5:11 am

Re: parity in bit banged serial

Post by YahooArchive » Mon Feb 11, 2013 12:31 am

If you're worried about something like that, you should be using one of the
hardware UARTs, the SuperPRO has 5

Post Reply