Sign in to follow this  
Followers 0
Muhammad Azeem

Generic Routine to Decode data for one than one Module

4 posts in this topic

Hi, 

I am writing some routines to decode the data from my Input: data array to User-defined Array Parameters. Is that possible to have a generic routine to decode data coming from more than one module?

I have two Module ENode and ENode_1. I have defined User-Defined parameters for the module. Can I make a generic routine to decode the data coming from these two modules and put them in the defined arrays? 

Capture.PNG

Capture2.PNG

the two arrays ENodeData[0] and ENodeData[1] have the Generic User-Defined parameters.

Edited by Muhammad Azeem

Share this post


Link to post
Share on other sites

Hello!

Yes, you should consider using an Add-on Instruction (AOI) to do what you need.

You need to define "ENode:I.Data" as an InOut parameter in the AOI and "ENode_Data_Type" also as an InOut parameter since it is a UDT. Inside the AOI you will then parse the raw data into the correct format and place values into the correct location in your UDT.

Once you have the AOI defined, then you will instanciate it twice, once for each of your nodes. The first instance uses "ENode:I.Data" and "ENodeData[0]"  for the parameters and the second instance would use "ENode_1:I.Data" and "ENodeData[1]".

Cheers!

vds

 

Edited by vds

Share this post


Link to post
Share on other sites

If you set up the UDT properly, a simple COPy from the raw input to an instance of the UDT is all that you need. Subroutine / AOI unnecessary.

1 person likes this

Share this post


Link to post
Share on other sites

Thanks, VDS and Gerry. I have managed to do that. I am a newbie in PLC development.

Cheers.

Edited by Muhammad Azeem

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0