User`s manual
Table Of Contents
- 1. Introduction
- 2. Getting Started
- Starting Your UC-7400-CE Computer
- Resetting Your UC-7400-CE Computer
- Operating UC-7400-CE Computer Via Serial Console
- Changing the Network Settings
- Operating Your UC-7400-CE Computer Via Telnet Client
- User/Group Management
- Adjusting System Time and RTC Time
- Starting and Stopping Services
- Troubleshooting Network Connectivity
- Simple Network Management Protocol (SNMP)
- 3. Web-based Management System
- 4. Application Development
- 5. Programming Examples
- A. Operating Programmable Function Keys and LCM
- B. Firmware Upgrade Procedure
- C. Service Information

UC-7400-CE User’s Manual Programming Examples
5-7
/* this function gets the current digit level of a specified port
<hndl> handle created by mxdio_init
<port> port number 0~7
Return DIN_EVENT_LOW_TO_HIGH or DIN_EVENT_HIGH _TO _LOW (0 or 1)
*/
int mxdio_get_dout(HANDLE hndl, unsigned int port);
To use the library mxdev.lib, include file moxa/devices.h in your program. The following example
shows a simple mechanism to use the library.
#include <moxa/devices.h>
DIOHANDLER(port0_process)
{
printf("port_0_process = %d\t%d\t%ld\n", port,type,syst_tick);
}
DIOHANDLER(port1_process)
{
printf("port_1_process = %d\t%d\t%ld\n", port,type,syst_tick);
}
int WINAPI WinMain( HINSTANCE hInstance,
HINSTANCE hPrevInstance,
LPTSTR lpCmdLine,
int nCmdShow)
{
HANDLE h = mxdio_init();
if(h==NULL)
{
printf("fail to init\n");
return 1;
}
mxdio_set_input_event(h, 0, port0_process, DIN_EVENT_LOW_TO_HIGH, 30);
mxdio_set_input_event(h, 1, port1_process, DIN_EVENT_HIGH_TO_LOW, 20);
mxdio_dispatch(h);
return 0;
}
All the callback functions have the same format (unsigned int port, unsigned int type, unsigned
sys_tick). Name each of the functions and fill out the logic of your application inside it.
In the example shown above, based on the duration periods (20 and 30 milliseconds) provided by
the callers, the dispatcher checks digit level changes at 20, 30, 40, 60, 80, …milliseconds from the
moment that the dispatcher function mxdio_dispatch() is called. If there is any change, the
associated callback function is initiated.