Communicates serially with the onboard Module by sending and receiving a word
Gx6196SendReceiveModule (nHandle, nChipSelect, awDataOut, pawDataIn, lSize, pnStatus)
Name |
Type |
Comments |
nHandle |
SHORT |
Handle to a GX6196 board. |
nChipSelect |
SHORT |
Specified chip select to use for communication to onboard Module (0-3) |
awDataOut |
PWORD |
Array of words to send to Module |
pawDataIn |
PWORD |
Array of words to receive from Module |
lSize |
LONG |
Number of elements in awDataOut and pawDataIn arrays |
pnStatus |
PSHORT |
Returned status: 0 on success, negative number on failure. |
Each communication with the Module will result in one or more words being sent and then received. When each word is sent to the Module, an accompanying word is read back from the Module.
The following example sends and receives 2 words from the Module using Chip Select 3:
WORD awDataOut[2];
WORD awDataIn[2];
awDataOut[0]=0x1234;
awDataOut[1]=0x5678;
Gx6196SendReceiveModule (nHandle, 3, awDataOut, awDataIn, 2, &nStatus);
if (awDataIn[0]==0x1234 && adwDataIn[1]=0x5678)
printf(“The two words were sent back correctly”);