Separate S7 RS485 string

DLMUK

Member
Join Date
Jun 2013
Location
Southampton
Posts
311
Hi all,

I have an ASCII RS485 string going into a CP340 and into an S7314.

I have the string going into the PLC ok... what I want to do is separate out data from within the string.

Can anyone point me to a good starting point? I have had a scout online but cannot find anything relevant.

An example is:

T+12.55A-15.55

I need to separate out the +12.55 and the -15.55 into separate data areas.

But my string coming in (when looking at the online view in TIA portal) doesn't seem to deal with LF very well. So sometimes it would be

T+12.55A-15.55[][]T+12.55A-15.55[][]T+12.55A-15.55[][]

then another time

12.55A-15.55[][]T+12.55A-15.55[][]T+12.55A-15.55[][]

this is during constant operation, not me starting and stopping the input.

So I will also need to identify the characters T and A (coincidental combination of letters!!) and then take the data which appears after these characters occur.

Many thanks,

Thanks,
 
FYI for people who may wish to do this, I got it running in the end using the following SCL

This looks at the raw RS485 data in...

e.g. P+012.55R-015.99

and assigns the value after the P to the variable #Inc_St



#P_Pos := FIND(IN1 := #RS485, IN2 := #Inc_Char); //Assigns the value (#Inc_Char) from the RS485 string to the tag #P_Pos

#Inc_Temp := MID(IN := #RS485, L := 7, P := #P_Pos); //Assigns the data for a length of 7, starting at #P_Pos to the tag Inc_Temp

#Inc_St := DELETE(IN := #Inc_Temp, L := 2, P := 1); //Deletes the first charcter of #Inc_temp and assigns the remainder to #Inc
 

Similar Topics

Hi Guys, I want to connect my 1769-L36ERM to a different network domain, is it possible to do it using only the dual ports in the Controller? Or...
Replies
3
Views
232
I have an existing 1756-IF16 wired as single ended with all RTNs tied together. Channels 0-3 have 2-wire loop powered devices connected with all...
Replies
3
Views
1,076
I have a unique situation where we have two separate process networks ( plc, HMI, etc only). The two process networks are are owned by two...
Replies
6
Views
2,161
Hi there, Quick Question. I have 2 PLCs and 2 solenoids. I would like to wire these up so that If either one turns on, it will turn on both...
Replies
12
Views
4,957
I'm trying to work through a question I have about using a PLC, plus separate temperature and pressure controllers on a plastic extruder rebuild...
Replies
9
Views
2,994
Back
Top Bottom