Moxa V2616A-C5 [54/111] Examples

Moxa V2616A-C8-LX [54/111] Examples
V2616A Linux Programming Guide
4-5
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 V2616A-LX computers.
Examples
Example files tdio.c and Makefile are located in the folder \example\tdio\ on the CD.
WDT (Watch Dog Timer)
Introduction
The WDT works like a watchdog function, and can be enabled or disabled. When the WDT function is enabled
and the application does not acknowledge it, the system will reboot. The acknowledgement time can be set to
any number between 1 millisecond and 255 seconds.
How the WDT Works
Debian project supports a watchdog daemon. The watchdog daemon checkes if your system is still working. If
programs are no longer executed it will perform the hard reset of the system. The standard watchdog driver
and package have been installed in the V2616A. If you need to run the watchdog once the system boots up,
you can use the insserv to enable the watchdog function.

Содержание

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

Скачать