RS232 Rx Flowcode

For Flowcode users to discuss projects, flowcharts, and any other issues related to Flowcode 5.
To post in this forum you must have a registered copy of Flowcode 5 or higher.

Moderator: Benj

Post Reply
User avatar
Jan Lichtenbelt
Posts: 797
Joined: Tue Feb 17, 2009 8:35 pm
Location: Haren GN, the Netherlands
Has thanked: 128 times
Been thanked: 264 times
Contact:

RS232 Rx Flowcode

Post by Jan Lichtenbelt »

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.
Attachments
RS232 Rx flowcode_V1.fcf
(30.77 KiB) Downloaded 347 times

User avatar
Jan Lichtenbelt
Posts: 797
Joined: Tue Feb 17, 2009 8:35 pm
Location: Haren GN, the Netherlands
Has thanked: 128 times
Been thanked: 264 times
Contact:

Re: RS232 Rx Flowcode

Post by Jan Lichtenbelt »

Please find attached the second version. In this one the Timeout has been introduced. This made the reading more flexible. Now strings with variable length are possible.

1.) Input parameters (Init macro) are: Baud rate , maximum number of characters in the string, oscillator frequency and timeout
2.) Character reading is possible with string length=1
3.) Rx input is port A2. This can be changed manually in the macro Get_Char (3 places for input start-bit, 8-bits and stop-bit)
4.) Bits are tested on correct start bit and stop bit
5.) No parity bit allowed
6.) Time stop bit is equal to time for start bit. But the length of the stop bit may be larger (but must be smaller then the timeout)
7.) Automatically detection of each start bit.
8.) Tested with RS232 sending with common RS232 macro (software) with second microchip.

Jan Lichtenbelt
Attachments
RS232 Rx flowcode_V2.fcf
(35.17 KiB) Downloaded 338 times

User avatar
Jan Lichtenbelt
Posts: 797
Joined: Tue Feb 17, 2009 8:35 pm
Location: Haren GN, the Netherlands
Has thanked: 128 times
Been thanked: 264 times
Contact:

Re: RS232 Rx Flowcode

Post by Jan Lichtenbelt »

The interrupt-on-change can be used on more input pins. But I found that these interrupts-on-change are less accurate compared to the INT interrupt. In this version 3.1 I replaced the interrupt-on-change by the INT interrupt. However only the INT-pin can be used in this case. Thus less flexible, but more accurate results.

Kind regards,


Jan Lichtenbelt
Attachments
RS232Rxflowcode_V3.1.fcf
(35.97 KiB) Downloaded 322 times

jgu1
Posts: 1333
Joined: Tue Oct 06, 2009 9:39 am
Has thanked: 1135 times
Been thanked: 299 times
Contact:

Re: RS232 Rx Flowcode

Post by jgu1 »

Hi jan!

Again a god project from you, thank´s. :D


Jorgen

User avatar
Jan Lichtenbelt
Posts: 797
Joined: Tue Feb 17, 2009 8:35 pm
Location: Haren GN, the Netherlands
Has thanked: 128 times
Been thanked: 264 times
Contact:

Re: RS232 Rx Flowcode

Post by Jan Lichtenbelt »

In the meanwhile I extended this program for RS232 with output on two lines of the LCD. The newline-carriagereturn character can be choosen by yourself. In this file attached I used the @ for a new line.
E.g. Sending "Hello world" will be displayed as: Hello world. And "Hello@world" as:
Hello
world

Succes with this extention.

Jan Lichtenbelt
Attachments
RS232Rxflowcode_V4.1.fcf
(41.33 KiB) Downloaded 354 times

Post Reply