Writes DIO direction, input or output memory using a byte array
GX1649, GX1649-1
GxAoDioWriteMemory (nHandle, nMemoryType, pucVector, dwSize, pnStatus)
Name |
Type |
Description |
nHandle |
SHORT |
Handle to a GX1649 board. |
nMemoryType |
SHORT |
Type of Memory to write to: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 an array of bytes that represent the memory states. Buffer size used is specified using the dwSize parameter. |
dwSize |
DWORD |
The number of vectors to write to memory. |
pnStatus |
PSHORT |
Returned status: 0 on success, negative number on failure. |
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:
GX1649_DIO_MEMORY_INPUT_TYPE: 1 represents a recorded logic high, and 0 represents a recorded logic low
GX1649_DIO_MEMORY_OUTPUT_TYPE: 1 represents a logic high output, and 0 represents a logic low output
GX1649_DIO_MEMORY_DIRECTION_TYPE: 1 represents output and a 0 represents input.
The following example writes 1000 vectors to the DIO Direction memory:
SHORT nStatus;
BYTE aucVector[1000];
GxAoDioSetVectorCount(nHandle, 1000, &nStatus);
GxAoDioWriteMemory (nHandle, GX1649_DIO_MEMORY_DIRECTION, aucVector, 1000, &nStatus);
GxAoDioReadMemory, GxAoDioSetVectorCount, GxAoDioWriteChannelMemory, GxAoGetErrorString