Moxa V2401-CE Руководство по программной части (Linux) онлайн [68/108] 170746

Moxa V2401-CE Руководство по программной части (Linux) онлайн [68/108] 170746
V2401/2402 Series Linux User’s Manual Programmer Guide
4-5
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 3
<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 3
<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 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 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.

Содержание

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

Скачать