RS Logixs IO Link Data

Join Date
Nov 2016
Location
Kinross
Posts
7
Hi All,

This is my first post on this form and I am hoping you can help me with this query,

I am reading a sensor value from a IFM AL1020 IO Link module. I am using a RS Logix 5000 enviroment. I am receiving the data into bytes AL1020:I.Data[2].4 and AL1020:I.Data[2].5 of my input process data. These two bytes contain the distance measured from the sensor. The AL1020 module send the data over Ethernet/IP™ uses the little endian format where as the IO Link module uses the big endian format. Can anyone help with sorting these two bytes of data so I can read the correct value? The sensor data seems to be a combination of the Most significant Byte of AL1020:I.Data[2].5 and the Least significant Byte of AL1020:I.Data[2].4

Thank You
 
You can use the COP or CPS instruction to copy the bytes containing the measurement data into an INT tag. If you need to swap the byte order you can the use the SWBP instruction.

AL1020:I.Data[2].4 is a reference to a BIT, make sure that you reference the correct BYTES, AL1020:I.Data[n] - AL1020:I.Data[n+1]
 
Hi Mareka

Thanks for the response. I am sorry I meant the data is stored in process area AL1020:I.Data[4] and process area AL1020:I.Data[5] sorry about that. Just to give you an example of what is happening the input from the sensor should be 102 so within Input data AL1020:I.Data[5] I have the binary input 0000_0110 and within AL1020:I.Data[4] I have 0110_0000, my actual value is a combination of 0110 from AL1020:I.Data[5] and 0110 from AL1020:.I.Data[4] which gives me 102. I will try as you suggest and thank you for the suggestions.
 
It's important to use the Copy Synchronous (CPS) instruction instead of the Copy (COP) instruction to place this data into an intermediate tag before performing the byte swap.

The COP instruction executes element-by-element, and it's possible for the EtherNet/IP connection to place new analog data into one byte of this two-byte field at exactly the same time as the COP instruction has copied out the first byte but before it's copied out the second byte. With the COP instruction and Ethernet/IP cyclic update happening every few milliseconds, the odds of this overlap occurring are very high. Even if the data is in an Integer format, the odds that the wrong value will occasionally be written to the resultant tag are high.

The CPS instruction locks the source and the destination tags from being affected by outside routines or functions, including the asynchronous EtherNet/IP data updates. Easy.

When I have to process I/O data like this, I put the processing logic into a Periodic Task running at about the same rate as the cyclic I/O update. My data can be up to 1 network cycle old, but that's OK in most cases, especially with slowly-updating stuff from an IOLink network.
 
@ Ken: Thanks for the clarification, until now I thought that one would only have to use the CPS instruction when there is the possibility that the task that calls the copy function could be interrupted by a higher priority task or an event driven task. I seem to have totally ignored that ethernet comms run async as well...

@Calvin: A binary XOR on AL1020:.I.Data[4] & AL1020:.I.Data[5] would give a result of 0110_0110.
 
Hope this helps

Hi,

As Ken mentioned:
It's important to use the Copy Synchronous (CPS) instruction instead of the Copy (COP) instruction to place this data into an intermediate tag before performing the byte swap.

I used a CPS instruction to get all the data directly from the Master IO Block, then used the BTD (Bit Field Distribute) instruction which allows you to relocate bits from different data structures as you please, I only created a temporary storage so the Actual Laser Read would not change on the screens if they happened to update at the same time.
CLR(LaserReadTemp)BTD(Port1.Inputs[0],0,.LaserReadTemp,8,8)BTD(Port1.Inputs[1],0,LaserReadTemp,0,8)MOV(LaserReadTemp,ActualLaserRead)  



Logic.jpg
 

Similar Topics

Hi all when i try to download the test code to emulate , this message appear Server busy This action cannot be completed because the other...
Replies
2
Views
1,170
Dear all, I have studio 5000 v30(only) installed on my laptop. From last two days I am trying to upload program from compact logixs, I configured...
Replies
6
Views
2,576
Can anybody give me a price range for the RSLogix 5000? I don't seem to be able to find the price. I need a ballpark figure to present to my...
Replies
13
Views
3,807
Hello is there any way to count, how many bits are set in the DINT in contol Logixs 5000 and use that count to compare whith actual number. For...
Replies
6
Views
2,046
Hi I am pretty new to using this site so any help is appreciated. I have a grain elevator thats system is operated by RSView32 (2 PC's) and 3 slc...
Replies
6
Views
3,384
Back
Top Bottom