I am in the early stages of working on an intelligent serial data repeater/streamer that will permit a laboratory balance to communicate with a particular software package. The data stream is fixed at 2400 baud, 1 start, 7 data, 2 stop, no parity. The PIC that will be used is a 16F88 running at 19660800 and code development will be using standard e-blocks.
My question is how does Flowcode & the PIC handle the data packet framing, particularly the stop bits? It is not particularly clear from either the PIC or Flowcode data whether the stop bits are handled automatically or treated as part of the data stream. In past applications only the start bit has been implemented in the hardware of the processor and the data, stop and parity bits are realised in the user code but I know that this is not universally true with all processor families.
Am I correct in assuming that in order to get 7 data bits and 2 stop bits, I will need to work with 9-bit data and strip out the two LSB's of each received data packet in my code before being able to read the 7 data bits that I want (and conversely LSL x 2 plus add two low order bits to outgoing data)?
Regards, Frazer
RS232 Packet Framing
Moderator: Benj
-
- Posts: 4
- Joined: Fri Feb 19, 2010 11:26 am
- Contact:
- Benj
- Matrix Staff
- Posts: 15312
- Joined: Mon Oct 16, 2006 10:48 am
- Location: Matrix TS Ltd
- Has thanked: 4803 times
- Been thanked: 4314 times
- Contact:
Re: RS232 Packet Framing
Hello,
You can configure Flowcode 4 to receive 7-bit data via the properties page.
Otherwise you will have to manually remove the most significant bit from the byte using an and instruction.
byte = byte AND 0x7F
You can configure Flowcode 4 to receive 7-bit data via the properties page.
Otherwise you will have to manually remove the most significant bit from the byte using an and instruction.
byte = byte AND 0x7F
Regards Ben Rowland - MatrixTSL
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
-
- Posts: 4
- Joined: Fri Feb 19, 2010 11:26 am
- Contact:
Re: RS232 Packet Framing
Hello Benj
Thanks for the reply. I would rather use 8 bits and strip out the MSB since 8-bit mode uses the USART. Given that the PIC USART's only support 8 & 9 bit operation, I presume that the 7-bit option in Flowcode is just bit-bashed and the USART is not used at all.
Of course the big disadvantage of using 8-bit mode is that the data will be unreadable in the data monitor windows since the sent and received characters will all have a '1' in the MSB, which will correspond to the first stop bit.
Adding stop bit control (and TX interrupt) would make the Flowcode RS232 module a lot easier to use.
Regards, Frazer
Thanks for the reply. I would rather use 8 bits and strip out the MSB since 8-bit mode uses the USART. Given that the PIC USART's only support 8 & 9 bit operation, I presume that the 7-bit option in Flowcode is just bit-bashed and the USART is not used at all.
Of course the big disadvantage of using 8-bit mode is that the data will be unreadable in the data monitor windows since the sent and received characters will all have a '1' in the MSB, which will correspond to the first stop bit.
Adding stop bit control (and TX interrupt) would make the Flowcode RS232 module a lot easier to use.
Regards, Frazer