NE-4100 Series User’s ManualDIO Commands
4. Writing Multiple DIOs
Parameters:
Command code: 6(hex)
Version: 2(hex)
Command status: doesn’t matter
Length of data:
data[0]: Number of the DIO you wish to access first.
data[1]: The last number of the DIO you wish to access
data[2]: mode of start DIO
data[3]: status of start DIO
data[4]: mode of (start+1) DIO
data[5]: status of (start+1) DIO ….
Command Status: Check the Command Status code on the previous page.
Length of data :
data[0]: mode of start DIO
data[1]: status of start DIO
data[2]: mode of (start+1) DIO
data[3]: status of (start+1) DIO ….
C code example: |
|
| |
void | WriteMultipleDIO(int start, int end, int* mode, int* status) | ||
{ | DIOPacketStruct packet; |
| |
|
| ||
| packet.header.command = 6; | // Write Multiple DIO Command Codes | |
| packet.header.version = 2; | // DIO protocol version | |
| packet.header.length = | // data length | |
| packet.data[0] = start; | // start DIO number | |
| packet.data[1] = end; | // end DIO number | |
| int | i, len; |
|
for ( i=0;
}
send(SocketFd, )(char*)&packet,(
//Process the returned data here
}
Note: A utility that can be used to test the DIO access commands can be found on the