Store PLCnext CommunityPLCnext on LinkedInPLCnext on Instagram  PLCnext on YouTube Github PLCnext CommunityStore PLCnext Community

  1. petermannon
  2. PLCnext Engineer
  3. Tuesday, 01 October 2019

I would like to use Program Global "Array Variables" and Assign to my Process Data Types (Analog and Digital) I/O Cards... Is this going to be possible ?

For Example...

In Data Types, I created the Following:

    ARRAYW_1_10:ARRAY[1..10] OF WORD;
    ARRAYB_1_10:ARRAY[1..10] OF BOOL;

I then Created Global Variables in my Program

   Analog_Inputs  (TYPE: ARRAYW_1_10)

   Digital_Inputs   (TYPE: ARRAYB_1_10).

 

On my Analog Card, [AXL F AI4 IH], the Type is Bitstring16 (WORD).

      It is not currently Possible to Select.. axcf-f-2152/ai-1/IN01 --> Analog_Inputs[1]   as the software does not allow.

      The Same is true for the Digital I/O - I cannot assign one of the Boolean Array Tags.

Will this be possible in a future release ?

 

Thank you !

 

 

 

Accepted Answer
Martin PLCnext Team Accepted Answer Pending Moderation
0
Votes
Undo

Hi Peter,

The only real difference is that port variables are associated with individual program instances, and each port variable must be explicitly linked to its corresponding I/O point in the PLCnext Port List. On the other hand, once you connect a Global Variable to an I/O point, it can be mirrored by any number of External variables in programs, functions, etc. So port variables can make it easier to follow data connections, which can make debugging easier when you're trying to find why an output value is not what you expect.

It is also worth noting that a single Analog Input port can be connected to a single element of an IN port that is a WORD array. So in your example, if you create the "Analog_Inputs" variable as an IN port on a program (rather than a global variable), you can connect the individual words in the array to Analog Input ports in the PLCnext "Port List" table. I think this is what you wanted to do?

I am not sure if this works for an array of BOOLs and the digital inputs (I don't have PLCnext Engineer with me at the moment), but I think it should.

The other alternative is to connect a single LWORD variable to the ~AI64 port on the analog input module. This is a 64 bit / 8 byte / 4 word value that represents all the analog input values. You can then access the individual input values using the notation (variable).W0, .W1, etc.

The same technique can be used for the digital values - using a single BYTE variable connected to the ~DI8 variable, and accessing the individual input values as (variable).X0, .X1, etc.

Hope this helps.

- Martin.

 

Phoenix Contact Electronics Headquarters - PLCnext Runtime Product Management and Support
  1. more than a month ago
  2. PLCnext Engineer
  3. # Permalink
Eduard PLCnext Team Accepted Answer Pending Moderation
0
Votes
Undo

Hello petermannon,

it is not possible to connect in PLCnext Engineer the Element of Array with process data, please use or define a Variable with the same datatype as process data. I would like to recommend you to define a port-variable (IN/Out Port) in program for connection of process data. If needed, you can assign the port variable to Element of Array (e.g. Digital_Inputs.X0 := IN_Port_Bool).

Best,

Eduard

Phoenix Contact Electronics Headquarter - PLCnext Runtime Product Management and Support
  1. more than a month ago
  2. PLCnext Engineer
  3. # 1
petermannon Accepted Answer Pending Moderation
0
Votes
Undo

Eduard:

Thank you for your response.

My only question...why do you suggest that I use port-variables (IN/Out Ports) ?

What is the advantage of (In/Out Ports) in place of a Global Variable ?

 

Thank you for your response.

 

Peter

  1. more than a month ago
  2. PLCnext Engineer
  3. # 2
  • Page :
  • 1


There are no replies made for this post yet.
However, you are not allowed to reply to this post.