Moxa V2403-C3-W-T [51/90] V2403 series linux software programmer s guide

Moxa V2403-C7-W-T [51/90] V2403 series linux software programmer s guide
V2403 Series Linux Software Programmer’s Guide
4-4
Function int get_dout_state(int doport, int *state)
Description Get the DOUT port state
Input <doport> The DOUT port to get the state of.
<state> Save the current state.
Output <state> DIO_HIGH (1) for high, DIO_LOW (0) for low
Return Refer to the error code
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 5. 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

Содержание

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

Скачать