Overview; C Code Example; Read 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

Overview

Each DIO command and response consists of a four-byte header and up to 255 bytes of data. The first byte of
the header indicates the command. The second byte indicates the version, which is "2" for current firmware
versions. The third byte is a code that is used by the module to report errors. The fourth byte is the number of
bytes that follows the header, and will depend on the command or response.
In the event of an error, the module will return the entire command as its response, but with the third byte
changed according to the following status/error codes:
1: Command error; may be unknown
2: Version error; not supported by this version
3: Length error; the length member does not match the attached data
4: Operation error; invalid status or invalid mode
5: "Packet too short" error
6: DIO number error; might not support requested DIO number
0xFF: other unknown error
ATTENTION
DIO command data is transmitted as values rather than text strings. A value of 1 would be transmitted as
0x01.

C Code Example

//define DIO Header format
typedef struct _DIO_Header_Struct {
char command;
char version; /* This specification is version 2 */
char status;
char length;
} DIOHeaderStruct, *pDIOHeaderStruct;
//define DIO Packet format
//Used for Command and ACK packet
typedef struct _DIO_Packet_Struct {
DIOHeaderStruct header;
Char data[ 255];
} DIOPacketStruct, *pDIOPacketStruct;

Read Single DIO

Command

Byte #
Descriptor
1
Header
2
Header
3
Header
4
Header
5
Data
For example, the 5-byte command sequence 1-2-0-1-0 requests the status of DIO 0.
Value
Description
1
command #, fixed
2
version, fixed
(any)
this byte is only used in the module's response
1
data length, fixed
0, 1, 2, 3
desired DIO channel #
D-2
DIO Commands

Advertisement

Table of Contents
loading

Table of Contents