GX5290, File
Unpack a single DWord to an array of data.
DioDataUnpack (nNumPins, nDataSize, dwOffset, nUnpackedDataType, dwPackedData, pvUnpackedData, pnStatus)
Name |
Type |
Comments |
nNumPins |
SHORT |
Number of pins: 1, 2, 4, 8, 16, 32 |
nDataSize |
SHORT |
Number of elements to pack from the unpacked data buffer. |
dwOffset |
SHORT |
Offset to start packing the data from, e.g. if offset=1 and nNumPins=4 then the packed data will start from bit 4. |
nUnpackedDataType |
SHORT |
The array data type in bytes:1. Byte2. Word4. DWord |
pdwPackedData |
PDWORD |
Pointer to a DWORD returning the packed data as single DWord. |
pvUnpackedData |
PVOID |
Pointer to the unpacked data buffer. |
pnStatus |
PSHORT |
Returned status: 0 on success, negative number on failure. |
The function helps unpacking data to form a single 32-bit to the specified unpacked size when the number of active channels is set programmatically to be less than 32-bits.
Note: By default the DIO needs data to be on 32-bits boundaries.
The following example packs an array of data to a single DWord:
SHORT nStatus;
BYTE aucUnpackedData[8];
DWORD dwPackedData
DioDataPack (4, 8, 0, 1, dwPackedData, ucUnpackedData, &nStatus);