EM-1220 LX User’s Manual
EM-1220-LX Device API
GPIO
GPIO means
General Purpose I/O
. It is a user-programmable design that both digital input and
digital output can be easily defined as the signals are all made with TTL format.
Moxa GPIO API
For customers using EM-1220 or EM-1240, we will provide an API library with static link.
(Dynamic link will not be supported). Users can use our source code and the system call within
ioctl () command to communicate with drivers.
API List
int get_gpio_mode(unsigned int pio)
--to check if the current GPIO setting is DI or DO.
Input:
unsigned int pio
- GPIO port number
Each GPIO point will be regarded as a port. We support from Port 0 to Port 9 for EM-1240, and
from Port 0 to Port 7 for EM-1220.
Output:
1
represents
DI.
0
represents
DO.
Return:
< 0 is wrong.
= 0 is correct.
int get_gpio_data(unsigned int pio)
--to check the current status of the GPIO, either high or low voltage.
Input:
unsigned int pio
- GPIO port number
Each GPIO point will be regarded as a port. We support from Port 0 to Port 9 for EM-1240, and
from Port 0 to Port 7 for EM-1220.
Output:
1
represents
high.
0
represents
low.
Return:
< 0 is wrong.
= 0 is correct.
5-3