Reputation: 11
There is a keyboard which is connected to PLC controller. The keyboard is sending frames to the controller.
Below is the frame send by Keyboard.
$ 200103001<000000008000000000000000000009$ 3$ 200103001<000000008000000000000000000009$ 3$ 200103001<000000008000000000000000000009$ 3$ 200103001<000000008000000000000000000009$ 3$ 200103001<000000008000000000000000000009$ 3$ 200103001<000000008000000000000000000009$ 3$ 200100?1$ 3
The single frame is structured with STX (02) and then useful data and then ETX(03). In above frame, you can see STX as $2 and ETX as $3.
What does '$' sign represents here?
I am trying to use Structured Text IEC programming language. How to extract the data in between $2 and $3?
Btw, the received frame is saved as STRING(255).
I tried using FIND function to locate STX and ETX position. However, because of $ sign, it is not finding STX and ETX.
FIND (StringWhereDataIsSaved, '$3') -> Does not work
FIND (StringWhereDataIsSaved, '03') -> Would find 03 in the data section of frame instead of the ETX
FIND (StringWhereDataIsSaved, '3') -> Would find 3 in the data section of frame instead of the ETX.
Upvotes: 1
Views: 23
Reputation: 514
Look at the received data in a text editor that allows you to see hidden characters, such as Notepad++. There is something in between the $ and the digit, looks to be a space but could be something else such as carriage return. Revise your FIND
command to search for the correct string and it should work.
Upvotes: 0