Hi
I have just captured the following RS232 data string from a pc to a message board
<NUL><FF><FF><NUL><VT><SOH><FF><SOH>01<STX><EF><BO><EF<A4>TEXT<FF><FF><NUL>
This was sent @ 2400buad, databits 8, stopbits 1and parity none
How would i achieve this using the RS232 component in flowcode 4
Regards
Wayne
RS232
Moderator: Benj
- 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
Hello Wayne,
I would use a ASCII table to look up the values for each of the ASCII characters you want to send.
EG
Null is 0 in decimal
VT is 11 in decimal
You should be able to find all the values from here http://www.asciitable.com/
FF, B0 and EF are likely to be hex numbers so you should be able to enter them straight into the RS232 send macro.
eg
0xFF
0xB0
0xEF
To get the 0xFF (255 in decimal) value to send you must put the RS232 component's receive type into int mode.
This is taken from the RS232 help file.
Receive Type
Defines the value for the timeout return value.
Byte (Legacy) sets the INVALID_RETURN timeout value as 255 allowing acceptable data values 0-254 (8 bit mode).
Errors such as framing and overflow errors also return 255.
Int (Extended) sets the INVALID_RETURN timout value as 512 allowing acceptable data values 0-255 (8 bit mode) or 0-511 (9 bit mode)
When using the extended mode framing errors return a value of 1024 and overflow errors return a value of 2048.
Let me know if you have any problems.
I would use a ASCII table to look up the values for each of the ASCII characters you want to send.
EG
Null is 0 in decimal
VT is 11 in decimal
You should be able to find all the values from here http://www.asciitable.com/
FF, B0 and EF are likely to be hex numbers so you should be able to enter them straight into the RS232 send macro.
eg
0xFF
0xB0
0xEF
To get the 0xFF (255 in decimal) value to send you must put the RS232 component's receive type into int mode.
This is taken from the RS232 help file.
Receive Type
Defines the value for the timeout return value.
Byte (Legacy) sets the INVALID_RETURN timeout value as 255 allowing acceptable data values 0-254 (8 bit mode).
Errors such as framing and overflow errors also return 255.
Int (Extended) sets the INVALID_RETURN timout value as 512 allowing acceptable data values 0-255 (8 bit mode) or 0-511 (9 bit mode)
When using the extended mode framing errors return a value of 1024 and overflow errors return a value of 2048.
Let me know if you have any problems.
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
- 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
Hello Wayne,
Yes thats right thats probably the easiest way to do things.
You could also maybe fill up a string with the byte parameters and use the send string macro but I'm not 100% how the null bytes would get treated. A null in a string normally signifies the end of the string.
Yes thats right thats probably the easiest way to do things.
You could also maybe fill up a string with the byte parameters and use the send string macro but I'm not 100% how the null bytes would get treated. A null in a string normally signifies the end of the string.
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
- 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
Hello Wayne,
There is 1 stop bit required by the hardware UART.
The partiy bit is normally disabled. To allow for parity you will have to switch the RS232 component into 9-bit data mode and then manually check if the parity bit is correct. I think someone has released example code of how this is done somewhere on the forums. Otherwise it should be quite easy to find example code via google that will allow you to check if the parity is correct for the data received.
RS232 data is inverted by default.
There is 1 stop bit required by the hardware UART.
The partiy bit is normally disabled. To allow for parity you will have to switch the RS232 component into 9-bit data mode and then manually check if the parity bit is correct. I think someone has released example code of how this is done somewhere on the forums. Otherwise it should be quite easy to find example code via google that will allow you to check if the parity is correct for the data received.
RS232 data is inverted by default.
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
Re: RS232
Good morning Benj,
What i was trying to say is on the scope from the rs232 on the pc i get the following
Null=logic 1
0xFF=logic 0
From flowcode i get
Null=logic 0
0xFF=logic 1
Which would say RS232 from flowcode is not inverted
Any idea's
Regards
Wayne
What i was trying to say is on the scope from the rs232 on the pc i get the following
Null=logic 1
0xFF=logic 0
From flowcode i get
Null=logic 0
0xFF=logic 1
Which would say RS232 from flowcode is not inverted
Any idea's
Regards
Wayne
- 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
Hello Wayne,
In the conversion from a 12V system (RS232 - PC) to a 5V system (UART - PIC) the transmission lines get inverted. The MAX232 chip on our EB015 E-block does this automatically for you.
If you need a simple way of converting the signals without using a MAX chip then here is a simple circuit that I know works well.
The parts your interested in are D1, R1 and R2.
In the conversion from a 12V system (RS232 - PC) to a 5V system (UART - PIC) the transmission lines get inverted. The MAX232 chip on our EB015 E-block does this automatically for you.
If you need a simple way of converting the signals without using a MAX chip then here is a simple circuit that I know works well.
The parts your interested in are D1, R1 and R2.
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