memioReadX (Function)

Top  Previous  Next

Architecture:

X32 / NX32 / NX32L

Device support:

All

Firmware version:

1.20 / 1.00.00


memioReadX works similar to memioRead but allows access to multiple elements in one highly efficient operation.

The use of memioReadX is recommended in cases where a range of memory I/O locations must be read sequentially.

 

Also see memioWriteX.

 

Input:

index : INT (1..4096)

Memory I/O system Index number where the read operation will start.

 

mem : PTR

Address to write the data that will be read from the memory I/O area.

 

len : INT

Number of 32-bit elements to be read from the memory I/O area.

 

 

Returns: INT

0

Operation successful.

1

Invalid parameters.

2

Index range was out of bounds.

 

 

Declaration:

FUNCTION memioReadX : INT;
VAR_INPUT
  index : INT; // index to read from (1..4096).
  mem   : PTR; // address to read from.
  len   : DINT; // number of elements to read.
END_VAR;

 

 

Example:

INCLUDE rtcu.inc
 
PROGRAM test;
VAR
  buffer : ARRAY[1..10] OF DINT;
END_VAR;
 
...
 
// Read 10 elements directly from I/O space starting at location 120, and place the data into 'buffer':
memioReadX(index:=120, mem:=ADDR(buffer), len:=10);
 
...
 
END_PROGRAM;