GxAoDioReadMemory

Purpose

Reads DIO direction, input or output memory using a byte array for all channels

Applies

GX1649, GX1649-1

Syntax

GxAoDioReadMemory (nHandle, nMemoryType, pucVector, dwSize, pnStatus)

Parameters

Name
Type
Description
nHandle
SHORT
Handle to a GX1649 board.
nMemoryType
SHORT
 
Type of Memory to read from:
0.   GX1649_DIO_MEMORY_INPUT_TYPE: Write to DIO Input Memory
1.   GX1649_DIO_MEMORY_OUTPUT_TYPE: Write to DIO Output Memory
2.   GX1649_DIO_MEMORY_DIRECTION_TYPE: Write DIO Direction Memory
pucVector
PBYTE
Buffer to hold the returned array of bytes that represent the memory states. Buffer size used is specified using the dwSize parameter.
dwSize
DWORD
The number of vectors to read from memory. Buffer size (pucVector) must be equal or longer than this value.   
pnStatus
PSHORT
Returned status: 0 on success, negative number on failure.

Comments

Each element in the byte array represents the direction, input or output state of all 8 DIO channels. Each bit corresponds to a channel, bit 0 is channel 0, etc. The value of each bit is interpreted according to nMemoryType:

Example

The following example reads 1000 vectors from the direction memory:

 

SHORT nStatus;

BYTE  aucVector[1000];

 

GxAoDioReadMemory (nHandle, GX1649_DIO_MEMORY_INPUT_TYPE, aucVector, 1000, &nStatus);

 

See Also

GxAoDioReadChannelMemory, GxAoDioWriteMemory, GxAoDioGetVectorCount, GxAoGetErrorString