Moxa Technologies NE-4100 user manual DIO Commands, Command Packet Format Length Bytes Header Data

Page 81

C

DIO Commands

In this appendix, we give the reference DIO commands used to access the Digital I/O status of the Network Enabler from an Ethernet network. The Digital I/O status can be accessed by a specific TCP port (default 5001) on the Network Enabler.

Command Packet Format:

Length (Bytes)

4

1 – 255

Format

*Header

Data

Send the Command packet to the Network Enabler. “Data” field is command specific.

ACK Packet Format:

Length (Bytes)

4

1 -255

Format

*Header

Data

The Network Enabler returns by ACK packet. You can get the Digital I/O status and input/output operation mode by checking the “Data” field of the packet.

*Header Format:

Length (Bytes)

1

1

1

1

Format

Command

Version

Command Status

Length (for data)

 

 

(must be 2)

 

 

Check the “Command Status” to get the result after sending the Command packet.

Command: This field defines the command code. For example, 1(hex) represents “read single D I/O.” For more information, please refer to following content.

Command Status: This field returns the status of the command. 0 – OK

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; you cannot set the DIO mode to input mode, and set the DO status at the same time

5 – “Packet too short” error

6 – DIO number error; might not support request DIO number 0xFF – other unknown error

Data Structure Definition:

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;

Image 81
Contents Sixth Edition, April NE-4100 Series User’s ManualCopyright Notice Table of Contents Chapter Configuring Windows Administrator Introduction Package Checklist Product FeaturesOverview Product Specifications NE-4120 Series/NE-4120-ST Panel Layout and Pin AssignmentsPanel Layouts NE-4100T/NE-4100-STNE-4100T NE-4100-STRXD1 Pin AssignmentsBlock Diagram NE-4100-ST LED IndicatorsLED Name LED Color LED Function NE-4110S NE-4110 Series/NE-4110-STNE-4110A NE-4110-ST evaluation board for NE-4110 SeriesSerial Header Pinouts J1 for NE-4110A Serial Header Pinouts J1 for NE-4110SEthernet Port Pinouts for NE-4110S/A DIO and LED Header Pinouts J2 for NE-4110S/ABlock Diagrams NE-4110S Block DiagramNE-4110A Block Diagram NE-4110-ST LED Indicators Top Panel of NE-4120S NE-4120 Series/NE-4120-STTop Panel of NE-4120A NE-4120-ST evaluation board for NE-4120 SeriesSerial Header Pinouts J1 for NE-4120A Serial Header Pinouts J1 for NE-4120SNE-4120A Block Diagram NE-4120S Block DiagramNE-4120-ST LED Indicators Getting Started Attaching NE-4100T to the Evaluation Board Wiring RequirementsAttaching NE-4120 Series to the Evaluation Board Attaching NE-4110 Series to the Evaluation BoardCircuit Pad for External Connection Connecting to the Network Connecting the PowerConnecting to a Serial Device DI/O SettingsDigital Output LED Circuit Design JP2 Selecting the InterfaceChoosing the Proper Operation Mode TCP Server Mode UDP Mode TCP Client ModeReal COM Mode ARP Initial IP Address ConfigurationNE-4100 Series Administration Suite Factory Default IP AddressDefault IP address Initializing NE-4100 Series Module’s IP AddressTelnet Console Page Serial Console 19200, n, 8 Web Console Configuration Opening Your Browser Basic Settings Server nameTime zone Time server Setting Factory Default NecessityNetwork Settings Method Function DefinitionIP Address Setting Factory Default Necessity None Optional Setting Factory Default Necessity 255.255.255.0 RequiredIP configuration GatewayContact Community nameLocation Auto report to IPSerial Settings TCP Server Mode Operating SettingsMax. connection Max connectionMax connection 2 to DelimiterSetting Factory Default Necessity 4001 Required Real COM ModeCommand port Setting Factory Default Necessity 966 OptionalNE-4100 Series User’s Manual Web Console Configuration TCP Client Mode Destination IP address 1/2/3/4 TCP connection on UDP ModeLocal Listen port # Hosts on a given subnet can access the NE-4100 Accessible IP Settings# Any host can access the NE-4100 Allowable Hosts Input formatMail and Snmp Trap Auto Warning SettingsEvent Type DIO Monitor Digital IOChange Password Load Factory DefaultsSave/Restart Monitor Port Monitor COM Mapping Configuring Windows AdministratorInstalling Network Enabler Administrator NE-4100 Series User’s Manual Web Console Configuration Broadcast Search Starting the ConfigurationNE-4100 Series User’s Manual Web Console Configuration Unlock Password Protection Unlock LockBlank FixedConfiguring NE-4100 Upgrading the Firmware Export/Import Monitor Select Add Target NE-4100 Series User’s Manual Web Console Configuration NE-4100 Series User’s Manual Web Console Configuration Port Monitor On-line COM Mapping COM MappingSelect COM Setting to modify COM No., default setting, etc NE-4100 Series User’s Manual Web Console Configuration Off-line COM Mapping SW Reset Function NE-4100 Series User’s Manual SW Reset Function Well Known Port Numbers TCP Socket Application ServiceNE-4100 Series User’s Manual Well Known Port Numbers UDP Socket Application ServiceNeci Library Command Packet Format Length Bytes Header Data DIO CommandsACK Packet Format Length Bytes Header Data Data Structure DefinitionWriting a Single DIO Parameters Command Code Usage Reading Single DIO ParametersReading Multiple DIOs NE-4100 Series User’s ManualDIO CommandsWriting Multiple DIOs Snmp Agent with MIB II & RS-232 Like Group Address Translation MIB System MIB Interfaces MIBService Information Following services are provided Moxa Internet ServicesProblem Report Form Moxa Product & NE-4100TSerial Number Product Return Procedure