S7 CP341 datafiltering/parsing best way to do it? (serial communication)

genesisfm

Member
Join Date
Apr 2008
Location
Europe
Posts
23
Hello,

I'm busy with software to receive RS232 (ASCII) from a PC.
The software what i made works BUT...
My sofware is based on receiving frame by frame like:

Frame1: <EOT>1155<STX>06151<ETX>0
<wait>
Frame2: <EOT>2255<STX>06150<ETX>3
<wait>
etc.

I check the length of the message and filter the message. No problem with that.
BUT, sometimes the PC sends in one frame more messages like:

<EOT>1155<STX>06151<ETX>0<EOT>2255<STX>06151<ETX>3<EOT>3311<STX>0121234<ETX>2<space?><EOT>2255<STX>06151<ETX>3..... etc.

When the PC sends this frame i know the length of the total frame but i don't know the information what's in the frame.

My question is, what is the best way to handle those frames?
I was thinking to make a pointer in a loop and scan for a <EOT> and extract the information till the next <ETX> and use the message length as limit of the scan pointer.

Ps. i need the information between the <EOT> / <STX> and <STX> / <ETX>

Maybe other people here got some better solutions?

Best regards
 

Similar Topics

Hi i have a cp341 1CH01 Rs485 and et200m ,i wanna use that to interface with a non simense slave device ion7330 are any deference between 1CH02...
Replies
2
Views
1,790
Hi guy 's, can i use cp341 modbus rtu to interface with a non_siemnes slave device , such as schneider ion7330 ?
Replies
4
Views
1,946
Hi, I am using the CP341 for modbus RTU in an ET200 rack. Usually we are using the CP341 for this application in the same central rack as the...
Replies
0
Views
1,057
Hi all, Does anyone have any experience trying to simulate a Modbus master using a PC, The PLC is a cpu 300 with a CP341 RS485. I am...
Replies
5
Views
2,653
Hi, I had RS485 ASCII string going into a CP340 @ 9600baud rate. This was working fine. I had to change my baud rate to 19200 so I got ripped...
Replies
4
Views
2,512
Back
Top Bottom