Moxa V2406-24I-CT-XPE [55/81] Special note

Moxa V2422-XPE [55/81] Special note
V2406/2422/2426 Linux User’s Manual Programming Guide
4-5
Function int set_din_event(int diport, void (*func)(int diport), int mode, long int duration)
Description Set the DIN event when the state is changed from high to low or from low to high
Input <diport> The port that will be used to detect the DIN event.
Port numbering is from 0 to 3. This value depends on your device.
<(*func) (int diport)>
Not NULL: Returns the call back function. When the event occurs, the call back function will
be invoked.
NULL: Clear this event
<mode>
DIN_EVENT_HIGH_TO_LOW (1): From high to low
DIN_EVENT_LOW_TO_HIGH (0): From low to high
DIN_EVENT_CLEAR (-1): Clear this event
<duration>
0: Detect the din event DIN_EVENT_HIGH_TO_LOW or DIN_EVENT_LOW_TO_HIGH
without duration
Not 0: Detect the din event DIN_EVENT_HIGH_TO_LOW or
DIN_EVENT_LOW_TO_HIGH with duration.
Note:
The value of durationmust be a multiple of 20 milliseconds.
The range of durationis 0, or 40 <= duration <= 3600000 milliseconds.
The error of the measurement is 24 ms. For example, if the DIN duration is 200 ms, this
event will be generated when the DIN pin stays in the same state for a time between 176 ms
and 200 ms.
Output None
Return Refer to the error code
Function int get_din_event(int diport, int *mode, long int *duration)
Description To retrieve the DIN event configuration, including mode
(DIN_EVENT_HIGH_TO_LOW or DIN_EVENT_LOW_TO_HIGH), and the value of duration.
Input <diport> Which DIN port you want to retrieve
<mode> Save the set event.
<duration> The duration the DIN port is kept in high or low state. - return to the current
duration value of diport
Output <mode>
DIN_EVENT_HIGH_TO_LOW (1): From high to low
DIN_EVENT_LOW_TO_HIGH(0): From low to high
DIN_EVENT_CLEAR(-1): Clear this event
<duration>
The value of duration should be 0 or 40 <= duration <= 3600000 milliseconds.
Return Refer to the error code
Special Note
1. You need to build the moxalib in advance for DI/DO. The moxalib is included in the folder
\example\moxalib on the CD.
2. Make sure to link the library libmoxalib for DI/DO programming, and include the header file
moxadevice.h. Only one program at a time can use the DI/DO library.
3. Due to hardware limitations, you need to modify MIN_DURATION as 60 for V2406/2422/2426-LX
computers.
Examples
Example files tdio.c and Makefile are located in the folder \example\tdio\ on the CD.

Содержание

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

Скачать