Moxa UC-8481-LX [61/90] 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 mu...

Moxa UC-8410-LX [61/90] 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
UC-8410/8416/8418/8430 Programmer's Guide
5-9
#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
The definition of DIN and DOUT:
#define DIO_HIGH 1
#define DIO_LOW 0
int set_dout_state(int doport, int state)
Description: To set the DOUT port to high or low state.
Input: int doport - which DOUT port you want to set. Port starts from 0 to 3.
int state - to set high or low state; DIO_HIGH (1) for high, DIO_LOW (0) for low.
Output: none.
Return: reference the error code.
int get_din_state(int diport, int *state)
Description: To get the DIN port state.
Input: int diport - get the current state of which DIN port. Port numbering is from 0 to 3.
int *state - save the current state.
Output: state - DIO_HIGH (1) for high, DIO_LOW (0) for low.
Return: reference the error code.
int get_dout_state(int doport, int *state)
Description: To get the DOUT port state.
Input: int doport - get the current state of which DOUT port.
int *state - save the current state.
Output: state - DIO_HIGH (1) for high, DIO_LOW (0) for low.
Return: reference the error code.
int set_din_event(int diport, void (*func)(int diport), int mode, long int duration)
Description: Set the event for DIN when the state is changed from high to low or from low to high.
Input: int diport - the port that will be used to detect the DIN event.
Port numbering is from 0 to 3.
void (*func) (int diport) - Not NULL
> Returns the call back function. When the event occurs, the call back function will be invoked.
NULL > Clears this event
int 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
unsigned long 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. 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: reference the error code.

Содержание

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

Скачать