DioReadDirectionMemory

Applies To

GX5055, GX5290, GX5290e, GX5295, File

Purpose

Reads a block of direction memory.

Syntax

DioReadDirectionMemory (nHandle, pvMemory, 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.
Each index in the control memory array sets the direction for all the active channels (as was set by the I/O width settings) for the specified step. Each bit corresponds to a channel, i.e. bit 0 sets channel 0 and so on. Direction bits values are as follow:
GX5290/GX5290e/GX5295:
  • Bit low – output.
  • Bit high – input.
GX5055:
  • Bit low – input.
  • Bit high – output.
dwStart
DWORD
Starting address to read.
dwSize
DWORD
Number of steps to read.
pnStatus
PSHORT
Returned status: 0 on success, negative number on failure.

Comments

The program counter will be set to zero upon return.

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 adwControl[64];

DioReadDirectionMemory (nMasterHandle, adwControl, 128, 64, &nStatus);

 

See Also

DioWriteCtrlMemory, DioGetErrorString