EasyManua.ls Logo

Moxa Technologies NE-4100 Series - Write Multiple DIO; Command; C Code Example:

Moxa Technologies NE-4100 Series
121 pages
Print Icon
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Loading...
NE-4100 Series User’s Manual DIO Commands
D-5
Byte # Descriptor Value Description
8 Data 0, 1
2nd requested DIO channel
0: channel status is low
1: channel status is high
9 Data 0, 1
3rd requested DIO channel, optional
0: channel is in input mode
1: channel is in output mode
10 Data 0, 1
3rd requested DIO channel, optional
0: channel status is low
1: channel status is high
11 Data 0, 1
4th requested DIO channel, optional
0: channel is in input mode
1: channel is in output mode
12 Data 0, 1
4th requested DIO channel, optional
0: channel status is low
1: channel status is high
For example, the 10-byte response 5-2-0-6-0-0-1-1-0-1 indicates that DIO 0 is in input mode and
“low” status, DIO 1 is in output mode and “high” status, and DIO 2 is in input mode and “high”
status.
C Code Example:
BOOL ReadMultipleDIO(int start, int end, int *mode, int *status)
{
DIOPacketStruct packet;
packet.header.command = 5; // Read Multiple DIO Commands
packet.header.version = 2; // DIO protocol command version
packet.header.length = 2; // data length
packet.data[0] = start; // start of the DIO number
packet.data[1] = end; // end of the DIO number
send(SocketFd, (char *)&packet, sizeof(DIOHeaderStruct)+2, 0);
//Send TCP packet
//Process the returned data here
return TRUE;
}
Write Multiple DIO
Command
Byte # Descriptor Value Description
1 Header 6 command number, fixed
2 Header 2 version, fixed
3 Header (any) this byte is only used in the module’s response
4 Header 6, 8, 10
data length, depends on the number of channels being
written (6 bytes for 2 channels, 8 bytes for 3 channels,
10 bytes for 4 channels)
5 Data 0,1,2 starting DIO channel number
6 Data 1,2,3 ending DIO channel number
RSPSupply - 1-888-532-2706 - www.RSPSupply.com
http://www.RSPSupply.com/p-9766-Moxa-NE-4120A.aspx

Table of Contents

Other manuals for Moxa Technologies NE-4100 Series