Response; C Code Example; Write Single Dio; Command - Moxa Technologies MiiNePort E2-H User Manual

Miineport e2/e3
Hide thumbs Also See for MiiNePort E2-H:
Table of Contents

Advertisement

MiiNePort E2/E3

Response

Byte #
Descriptor
1
Header
2
Header
3
Header
4
Header
5
Data
6
Data
7
Data
For example, the seven-byte response sequence 1-2-0-3-0-0-0 indicates that DIO 0 is in input mode.

C Code Example

BOOL ReadSingleDIO(int port, int *mode, int *status)
{
DIOPacketStruct packet;
packet.header.command = 1; // read single DIO command
packet.header.version = 2; // DIO protocol version
packet.header.length = 1; // data length
packet.data[0] = (char)port; // Number of the DIO
send(SocketFd, (char *)&packet, sizeof(DIOHeaderStruct)+1, 0);
//Send TCP Packet
// Process the returned data here.
return TRUE;
}

Write Single DIO

Command

Byte #
Descriptor
1
Header
2
Header
3
Header
4
Header
5
Data
6
Data
7
Data
For example, the seven-byte command sequence 2-2-0-3-0-0-0 requests that DIO 0 be set to digital input
mode.
Value
Description
1
command #, fixed
2
version, fixed
0, 1, 2, 3,
command status/error code (0 = okay)
4, 5, 6,
0xFF
3
data length, fixed
0, 1, 2, 3
desired DIO channel #
0, 1
0: channel is in input mode
1: channel is in output mode
0, 1
0: channel status is low
1: channel status is high
Value
Description
2
command number, fixed
2
version, fixed
(any)
this byte is only used in the module's response
3
data length, fixed
0, 1, 2, 3
desired DIO channel number
0, 1
0: set to input mode
1: set to output mode
0, 1
this byte is ignored for input mode
0: set to low
1: set to high
D-3
DIO Commands

Advertisement

Table of Contents
loading

Table of Contents