How Can We Help?


Reading and extraction of data from an ASCII frame sent via the ACE PLC 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

  • liquid level
  • real time liquid level
  • alarm status
  • Opening the COM port for listening
  • Checks if there is a message or not
    • If yes, we go to step 2
We call the subroutine for convert the ASCII string to a number

  • We transfer the whole ASCII frame/string
  • We give the position of the value in the string
  • then, we will retrieve the value in the “Number” tag

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