Moxa V2403-C2-W-T [50/90] Digital i o

Moxa V2403-C2-W-T [50/90] Digital i o
V2403 Series Linux Software Programmer’s Guide
4-3
RTC (Real Time Clock)
The device node is located at /dev/rtc. The V2403 supports standard Linux simple RTC control. You must
include <linux/rtc.h>.
1. Function: RTC_RD_TIME
int ioctl(fd, RTC_RD_TIME, struct rtc_time *time);
Description: read time information from the RTC. It will return the value on argument
3.
2. Function: RTC_SET_TIME
int ioctl(fd, RTC_SET_TIME, struct rtc_time *time);
Description: set RTC time. Argument 3 will be passed to RTC.
Digital I/O
Digital Output channels can be set to high or low. The channels are controlled by the function call
set_dout_state( ). Use the digital input channels to detect the state change of the digital input signal. The DI
channels can also be used to detect whether or not the state of a digital signal changes during a fixed period of
time. This can be done with the function call set_din_event( ).
Return error code definitions:
#define DIO_ERROR_PORT -1 // no such port
#define DIO_ERROR_MODE -2 // no such mode or state
#define DIO_ERROR_CONTROL -3 // open or ioctl fail
#define DIO_ERROR_DURATION -
4 // The value of duration is not 0 or not in the range,
40 <= duration <= 3600000 milliseconds (1 hour)
#define DIO_ERROR_DURATION_20MS -
5 // The value of duration must be a multiple of 20
ms
#define DIO_OK 0
DIN and DOUT definitions:
#define DIO_HIGH 1
#define DIO_LOW 0
Moxa functions for DI/DO
Function int set_dout_state(int doport, int state)
Description Set the DOUT port to high or low state.
Input <doport> The DOUT port you want to set. Port starts from 0 to 1
<state> Set high or low state; DIO_HIGH (1) for high, DIO_LOW (0) for low.
Output None
Return refer to the error code
Function int get_din_state(int diport, int *state)
Description Get the DIN port state
Input <diport> The DIN port to get the state of. Port numbering is from 0 to 5
<state> Save the current state
Output <state> DIO_HIGH (1) for high, DIO_LOW (0) for low
Return Refer to the error code

Содержание

Похожие устройства

Скачать