EasyManua.ls Logo

Moxa Technologies NE-4100 Series - C Code Example; Read Single DIO; Command; Response

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-2
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 Value Description
1 Header 1 command #, fixed
2 Header 2 version, fixed
3 Header (any) this byte is only used in the module’s response
4 Header 1 data length, fixed
5 Data 0, 1, 2, 3 desired DIO channel #
For example, the 5-byte command sequence 1-2-0-1-0 requests the status of DIO 0.
Response
Byte # Descriptor Value Description
1 Header 1 command #, fixed
2 Header 2 version, fixed
3 Header
0, 1, 2, 3,
4, 5, 6,
0xFF
command status/error code (0 = okay)
4 Header 3 data length, fixed
5 Data 0, 1, 2, 3 desired DIO channel #
6 Data 0, 1
0: channel is in input mode
1: channel is in output mode
7 Data 0, 1
0: channel status is low
1: channel status is high
For example, the 7-byte response sequence 1-2-0-3-0-0-0 indicates that DIO 0 is in input mode.
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