FullDuplexSerial with 7/8 bits n/o/e-parity?
Nick Mueller
Posts: 815
Hi!
Before I do that by myself, is there a variant of the FullDuplexSerial that can be configured to do
* 7 or 8 Bits?
* Odd, even or no parity?
* as an extra bonus selectable number of stop-bits?
Thanks,
Nick
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Never use force, just go for a bigger hammer!
The DIY Digital-Readout for mills, lathes etc.:
YADRO
Before I do that by myself, is there a variant of the FullDuplexSerial that can be configured to do
* 7 or 8 Bits?
* Odd, even or no parity?
* as an extra bonus selectable number of stop-bits?
Thanks,
Nick
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Never use force, just go for a bigger hammer!
The DIY Digital-Readout for mills, lathes etc.:
YADRO
Comments
It works for only 8 bits. But of course you can always make the last bit high as to make it only 7 bits that are transfered.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Nyamekye,
Post Edited (Kye) : 7/13/2009 4:35:18 PM GMT
There's no need to configure the number of stop bits for receiving, only for transmitting when it's required. If you're using Simple_Serial which is not buffered, you can just add some delay between transmitted characters (one bit-time for each extra stop bit).
That's almost perfect!
Am I right (had just a short look at it), that it supports parity just in 7 bit mode?
Thanks,
Nick
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Never use force, just go for a bigger hammer!
The DIY Digital-Readout for mills, lathes etc.:
YADRO
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Nyamekye,
> (even / odd / always zero / always one).
That's right.
But my requirement for sending data (to fullfill the standard) is 7 and 8 bits, with any parity and one stop bit.
OK, I'll dive into the original assembler, should not be too complicated.
"TEST wc" is a great help here.
Nick
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Never use force, just go for a bigger hammer!
The DIY Digital-Readout for mills, lathes etc.:
YADRO
There is no "standard" for this. True 7-bit serial is historical only. You will not find modern equipment capable of sending or receiving it. Modern equipment is all 8-bit data as I mentioned, with the 8th bit configurable to always hold a zero bit, a one bit, the even parity of the other 7 bits, or the odd parity of the other 7 bits. You can use FullDuplexSerial for this, unchanged, with all of the work on the 8th bit done by the caller. If you're doing it in Spin, you'd just have:
The standard is the standard of the protocol (ModBus) that requires these settings.
7 bits for ASCII-transmission (Hex, two chars / byte), 8 bits for binary (called RTU) transmission.
All that is no problem with 7 bits (o/e/n), but with 8 bits, I'll have to modify the ASM-code. The standard *requires* even parity for 8 bits.
And when I'm doing that, it is more efficient to implement all requirements (7/8 o/e/n) at the ASM-level. Much faster (compared to counting/shifting/masking bits in a high-level language) and more size-efficient.
I'm currently developing with the ASCII-transmission, because it is easier to read for me while debugging and testing, but I want to switch over to binary (keeping the ASCII-part) to speed things up. More than 50% (don't know the exact number right now) of the time (receiving a command, decoding and executing it and then sending a response) is spend with communication.
Nick
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Never use force, just go for a bigger hammer!
The DIY Digital-Readout for mills, lathes etc.:
YADRO
Also you could be lazy and do it the higher level way. if speeds not a problem.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Nyamekye,
*Peter*
I don't see how I could set the 9th bit (the parity bit of a 8 bit transmission) outside of PASM. But I might be missing something.
Nick
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Never use force, just go for a bigger hammer!
The DIY Digital-Readout for mills, lathes etc.:
YADRO
... Yeah, guess you have to.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Nyamekye,
I also have trouble about FullDuplexSerial.Plus
I put sinple-test-program on Propeller-Demo-Board.
(sending "0", LED-P16 is ON)
I connect Linux and Propeller-Demo-Board. But cannot communicate.
I set 7bit no Parity 1-Stopbit to /dev/ttyUSB0 on Linux.
Linux recognize device(Serial-To USB).
Command from Linux
#echo -n 0 > /dev/ttyUSB0
What wrong?
Please.
It is impolite to "hijack" another thread. Unless your question is directly related to the subject, please start your own thread.
Linux probably supports actual 7-bit no-parity serial (with a start bit, 7 data bits, and a stop bit) which FullDuplexSerial doesn't support.
Try 8-bit no-parity on Linux.
You may have an error in your program so you must include that (as an attachment to a message, use the Post Reply button).