Page 1 of 1

parity in bit banged serial

Posted: Mon Feb 11, 2013 12:07 am
by YahooArchive
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?

Re: parity in bit banged serial

Posted: Mon Feb 11, 2013 12:08 am
by YahooArchive
Yes, the source for BASIC is in the /program files (x86)/coridium/BASIClib
directory, SERIAL.bas

Re: parity in bit banged serial

Posted: Mon Feb 11, 2013 12:10 am
by YahooArchive
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.

Re: parity in bit banged serial

Posted: Mon Feb 11, 2013 12:10 am
by YahooArchive
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.

Re: parity in bit banged serial

Posted: Mon Feb 11, 2013 12:25 am
by YahooArchive
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.

Re: parity in bit banged serial

Posted: Mon Feb 11, 2013 12:26 am
by YahooArchive
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

Re: parity in bit banged serial

Posted: Mon Feb 11, 2013 12:30 am
by YahooArchive
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?

Re: parity in bit banged serial

Posted: Mon Feb 11, 2013 12:31 am
by YahooArchive
If you're worried about something like that, you should be using one of the
hardware UARTs, the SuperPRO has 5