How Can I Transfer a 2D Array of Data to Siemens PLC Using LabVIEW OPC?

Updated Aug 2, 2018

Reported In

Software

  • OPC Servers

Other

Hardware:
SIEMENS S7-1500
 

Issue Details

I am currently working on project with a SIEMENS S7-1500 PLC as a control unit for an automated assembly line along with a PC as a supervision unit. The communication between the two devices is established via OPC server. I am able to transfer data using Single Variables (of all types), however,  i am facing a problem when trying to transfer a 2D array from/to the PLC.  How can i define an array of variables of a specific type?

Solution

It is possible to Read/Write an array of variables (excluding Boolean type) to a PLC Memory.  Certain memory types (I, Q, M, SM, V, AI, and AQ) support operations on arrays, where Boolean arrays are not allowed.

To specify an array address, append [rows][cols] to the end of an address. If only [cols] is specified, [rows] will default to 1. With the array type, it is possible to read and write a block of 200 bytes at once.

The maximum array size for Word and Short types is 100, and for DWord, Long and Float types is 50. The array size is determined by the multiplication of rows and cols.

Note: The maximum array size also depends on the maximum block size of the device being used.

Examples:
  1. To read and write an array of 10 Variable Memory (Float) values starting with V10, declare an address as follows: V10 [1][10] with Float as the data type.  Note: This array will read and write values to registers V10, V14, V18, V22 ... V46.
  2. To read and write to bit 23 of Internal Memory (Long) M20, declare an address as follows: M20.23. Choose Long for the data type.

For more information you can refer to NI OPC Server help located in C:\Program Files (x86)\National Instruments\Shared\NI OPC Servers\V5\Help

Additional Information

There is also a LabVIEW toolkit called SP7 from DATA AHEAD that interfaces with multiple devices of SIEMENS PLCs including the S7-1500 series.
The Toolkit can be downloaded for evaluation from this link:
There are also reference examples for S7 Communication on the community:

WAS THIS ARTICLE HELPFUL?

Not Helpful