Sets the specified group’s four digital channels direction.
Gx3756PioSetGroupDirection (nHandle, nGroup, nDirection, pnStatus)
Name |
Type |
Comments |
nHandle |
SHORT |
Handle to a GX3756 board. |
nGroup |
SHORT |
Select the group to set:0. GX3756_PIO_GROUP0: Digital I/O group 0, group’s channels 0-3, board channels 0-3.1. GX3756_PIO_GROUP1: Digital I/O group 1, group’s channels 0-3, board channels 4-7.2. GX3756_PIO_GROUP2: Digital I/O group 2, group’s channels 0-3, board channels 8-11.3. GX3756_PIO_GROUP3: Digital I/O group 3, group’s channels 0-3, board channels 12-15.4. GX3756_PIO_GROUP4: Digital I/O group 4, group’s channels 0-3, board channels 16-19.5. GX3756_PIO_GROUP5: Digital I/O group 5, group’s channels 0-3, board channels 20-23.6. GX3756_PIO_GROUP6: Digital I/O group 6, group’s channels 0-3, board channels 24-27.7. GX3756_PIO_GROUP7: Digital I/O group 7, group’s channels 0-3, board channels 28-31.8. GX3756_PIO_GROUP8: Digital I/O group 8, group’s channels 0-3, board channels 32-35.9. GX3756_PIO_GROUP9: Digital I/O group 9, group’s channels 0-3, board channels 36-39.10. GX3756_PIO_GROUP10: Digital I/O group 10, group’s channels 0-3, board channels 40-43.11. GX3756_PIO_GROUP11: Digital I/O group 11, group’s channels 0-3, board channels 44-47.12. GX3756_PIO_GROUP12: Digital I/O group 12, group’s channels 0-3, board channels 48-51.13. GX3756_PIO_GROUP13: Digital I/O group 13, group’s channels 0-3, board channels 52-55. |
nDirection |
SHORT |
Sets the specified group’s four digital channels direction settings.0. GX3756_PIO_GROUP_DIRECTION_IN: All channels in the group are set as inputs.1. GX3756_PIO_GROUP_DIRECTION_OUT: All channels in the group are set as outputs. |
pnStatus |
PSHORT |
Returned status: 0 on success, negative number on failure. |
A logic high (‘1’) means direction is out, a logic low (‘0’) means the direction is set to input. There are 56 Digital I/O channels, channel’s direction control is set in groups of 4 channels, e.g. channels 0-3, channels 4-7, etc. Any group of channels can be programmed to be all in or all out. If a group of channels is direction is set to input, the user can use specific channel is set Gx3756PioReadGroup(), Gx3756PioReadChannel(), and Gx3756PioReadAllChannels() APIs to read back the actual logic input levels.
Channels 0-3 (Group 0) can be programmed to operate as serial-out transmitter. See Gx3756SerialOutSetMode() API for more details.
Channels 3-7 (Group 1) can be programmed as an external trigger source to channels 0-3 (Group 0), when they are set to serial-out operation mode. See Gx3756SerialOutSetMode(), and Gx3756SerialOutGetTriggerSource() APIs for more details.
SHORT nHandle, nStatus;
SHORT nValue, nGroupsDirection;
DWORD dwChannels32To55, dwChannels0To31;
// Set all channels to zero
Gx3756PioSetAllChannels (nHandle, 0x0, 0x0, &nStatus);
// Read all channels settings
Gx3756PioSetAllChannels (nHandle, &dwChannels32To55, &dwChannels0To31, &nStatus);
printf(“Channels 32 to 55 are set to:&i”, dwChannels32To55);
printf(“Channels 0 to 31 are set to:&i”, dwChannels0To31);
// Returns the input logic levels of all digital I/O channels 0 to 55
Gx3756PioReadAllChannels (nHandle, &dwChannels32To55, &dwChannels0To31, &nStatus);
// Reads the input logic levels of the four channels in group 0
Gx3756PioReadGroup (nHandle, GX3756_PIO_GROUP0, &nValue, &nStatus);
printf(“Input logic levels of the four channels in group 0 are :&i”, nValue);
// Reads the input logic levels of channel 0
Gx3756PioReadChannel (nHandle, 0, &nValue, &nStatus);
if (nValue==0)
printf(“Channels 0 input level is low);
else
printf(“Channels 0 input level is high);
// Set all groups direction to output
Gx3756PioSetAllGroupsDirection (nHandle, 0x3FFF, &nStatus);
// Return all groups direction
Gx3756PioGetAllGroupsDirection (nHandle, &nGroupsDirection, &nStatus);
if (nGroupsDirection==0x3FFF)
printf(“All groups direction are set to output);
// Set Group 2 Direction to output
Gx3756PioSetGroupDirection (nHandle, GX3756_PIO_GROUP2, GX3756_PIO_GROUP_DIRECTION_OUT, &nStatus);
// return Group 2 Direction settings
Gx3756PioGetGroupDirection (nHandle, GX3756_PIO_GROUP2, &nGroupsDirection, &nStatus);
if (nGroupsDirection==0)
printf(“Group 2 direction is input);
else
printf(“Group 2 direction is output);
// Resets group 0
Gx3756PioResetGroup (nHandle, GX3756_PIO_GROUP0, &nStatus);
// Set the group 2 four digital channels to 0xA
Gx3756PioSetGroup (nHandle, GX3756_PIO_GROUP2, 0xF, &nStatus);
// Returns the group 2 four digital channels settings
Gx3756PioGetGroup (nHandle, GX3756_PIO_GROUP2, &nValue, &nStatus);
printf(“Group 2 direction is to &i”, nValue);
// Sets channel 0 to high
Gx3756PioSetChannel (nHandle, 0, 1, &nStatus);
// Return channel 0 settings
Gx3756PioGetChannel (nHandle, 0, &nValue, &nStatus);
If (nValue==0)
printf(“channel 0 is set to logic low);
else
printf(“channel 0 is set to logic high);
Gx3756PioGetGroupDirection, Gx3756PioReadAllChannels, Gx3756PioReadGroup, Gx3756PioReadGroupChannel, Gx3756PioResetGroup, Gx3756PioSetAllChannels, Gx3756PioSetAllGroupsDirection, Gx3756PioSetGroup, Gx3756PioSetGroupChannel, GxFpgaGetErrorString