RS232 Rx Flowcode
Posted: Fri Jun 29, 2012 4:19 pm
Please find a flowcode macro to receive a string with any baud rate between 1200 and 19200 Hz.
I had troubles with receiving correct data between 2 microchips using RS232 (see elsewhere). That made me to look more in details of the protocol of RS232. That is simple. And that made me think that I can solve my problem by programming a RS232 Rx Flowcode myself. This is of coarse not the most simple solution, but if you ever meet problems with RS232 receiving strings/characters, you can try this one.
Some details of Version 1.0:
1.) Give input parameters in Init_RS232
(Baud rate , number of characters in the string, oscillator frequency)
2.) Character reading is possible with # characters=1
3.) Rx input is port A2. This can be changed manually in the macro
4.) Bits are tested on correct start bit and stop bit
5.) No parity bit allowed, but can easily be added
6.) The time of the stop bit is equal to time for the start bit
7.) Automatically detection of the start bit (falling edge)
8.) All delay are possible, also no delay. That means start bit may follow directly the stop bit.
9.) Tested with RS232 sending with common RS232 macro (software) with second microchip.
Just try it.
Jan Lichtenbelt
PS. I'm sorry to say, but this flowcode works only for strings all with the same number of characters. Version will take care of that.
I had troubles with receiving correct data between 2 microchips using RS232 (see elsewhere). That made me to look more in details of the protocol of RS232. That is simple. And that made me think that I can solve my problem by programming a RS232 Rx Flowcode myself. This is of coarse not the most simple solution, but if you ever meet problems with RS232 receiving strings/characters, you can try this one.
Some details of Version 1.0:
1.) Give input parameters in Init_RS232
(Baud rate , number of characters in the string, oscillator frequency)
2.) Character reading is possible with # characters=1
3.) Rx input is port A2. This can be changed manually in the macro
4.) Bits are tested on correct start bit and stop bit
5.) No parity bit allowed, but can easily be added
6.) The time of the stop bit is equal to time for the start bit
7.) Automatically detection of the start bit (falling edge)
8.) All delay are possible, also no delay. That means start bit may follow directly the stop bit.
9.) Tested with RS232 sending with common RS232 macro (software) with second microchip.
Just try it.
Jan Lichtenbelt
PS. I'm sorry to say, but this flowcode works only for strings all with the same number of characters. Version will take care of that.