Reading and extraction of data from an ASCII frame sent via the RS232/485 port
Here, we are going to see how to extract data from a ASCII frame.
In this example, we will see how to extract data from a fixed-length frame.
Example: Let start with a frame like this: *ST,0000,01,9876,5432,1722,0268,01,1377#
We want to extract the value in bold:
- 9876 the liquid level
- 5432 the real time liquid level
- 01 the alarm status
We will set up a subroutine to manage this reading and extraction.
|Open a new subroutine with these inputs/outputs data
|We call the subroutine for convert the ASCII string to a number
We must to do that for each value.
Don’t forget to declare your ACE RS232/485 port as “custom”, not “Modbus”
About the ASCII-to-Value conversion subroutine, you will find it in the project
You can download the project and its subroutines here