Moxa DA-710-XPE [60/73] Important

Moxa DA-710-XPE [60/73] Important
DA-710 Series Linux Programmer 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 “duration” must be a multiple of 20 milliseconds.
The range of “duration” is 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
IMPORTANT!
You have to build the moxalib in advance for DI/DO. The moxalib is included in the folder
\example\
moxalib
in CD.
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.
Due to hardware limitation, you need to modify MIN_DURATION as 60 for DA
-710.

Содержание

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

Скачать