DioReadInMemory

Applies To

GC5050, GX5050, GX5055, GX5290, GX5290e, GX5295, File

Purpose

Reads a block of input memory from the specified board (Master or Slave).

Syntax

DioReadInMemory (nHandle, pdwMemory, dwStart, dwSize, pnStatus)

Parameters

Name

Type

Comments

nHandle

SHORT

DIO or File board handle.

pvMemory

PVOID

Pointer to an array, array data type needs to comply with the I/O width settings and board type, see comments for details.

dwStart

DWORD

Starting step to read from.

dwSize

DWORD

Number of steps to read.

pnStatus

LPSHORT

Returned status: 0 on success, negative number on failure.

Comments

The program counter will be set to zero upon return.

GX5050/GX5050:

Array data type is Double Word (DWORD) and maximum array size is 1M of double words.

GX5055:

Array data type is Double Word (DWORD) and maximum array size is 512K of double words.

GX5290/GX5290e/GX5295:

Number of channels

Array type

32

Array data type is Double Word (DWORD) when I/O configuration is set to 32-bits width (default).

GX5291/GX5291e: Maximum array size is 32M of double words.

GX5292/GX5292e: Maximum array size is 64M of double words.

GX5293/GX5293e: Maximum array size is 64M of double words.

16

Array data type is Word (WORD) when I/O configuration is set to 16-bits width (channels 0-15).

GX5291/GX5291e: Maximum array size is 64M words.

GX5292/GX5292e: Maximum array size is 128M words.

GX5293/GX5293e: Maximum array size is 128M words.

8

Array data type is Byte (BYTE) when I/O configuration is set to 8-bits width (channels 0-7).

GX5291/GX5291e: Maximum array size is 128MB.

GX5292/GX5292e: Maximum array size is 256MB.

GX5293/GX5293e: Maximum array size is 256MB.

4, 2, 1

When configuring the Number of channels to be less than 8 bits (4, 2 or 1) the data can be unpacked after reading it using a Double Word array by using DioDataUnpack function.

Array data type is Double Word (DWORD) when I/O configuration is set to 32-bits width (default).

GX5291/GX5291e: Maximum array size is 32M of double words.

GX5292/GX5292e: Maximum array size is 64M of double words.

GX5293/GX5293e: Maximum array size is 64M of double words.

 

Note: The board must be in HALT state before calling this function.

Number of channels

Input memory Max Number of steps

Output memory Max Number of steps

Control memory Max Number of steps

32

67108608

67108864

67108864

16

134217216

134217728

134217728

8

268434432

268435456

268435456

4

536868864

536870912

536870912

2

1073737728

1073741824

1073741824

1

2147475456

2147483648

2147483648

Example

The following example reads 64 steps from the Master board input memory beginning at step 128:

 

DWORD adwInput[64];

DioReadInMemory (nHandle, adwInput, 128, 64, &nStatus);

 

See Also

DioWriteInMemory, DioWriteOutMemory, DioGetErrorString