Moxa V2426A-C2-W7E [27/88] Registering digital i o callback events

Moxa V2426A-C2-CT-T [27/88] Registering digital i o callback events
V2400A Series Expansion Modules Software Installation and Programming Guide
4-7
Function mxdgio_epm3438_get_counter(int fd);
Description Gets the counter value
Input <fd> The access to the counter device.
<port> Port number.
Output none.
Return the counter value
Function mxdgio_epm3438_clear_counter(int fd);
Description Clears the counter value
Input <fd> The access to the counter device.
<port> Port number.
Output none.
Return 0:clear success; -n: clear fail
mxdgio.h: Moxa Digital Input/Output Headers
1. The software CD included with your computer includes sample code to illustrate some implementations of
common DI/DO functions. To find these sample files, navigate to the directory
/example
/V2426A/EPM3438/digit_input_change on the sample code CD that is bundled with your
module; there, you will find the mxdgio.h file, which provides a convenient API for digital I/O and
COUNTER programming. Mxdgio.h provides a set of macros and an API for programming either the digital
I/O interfaces or the HARDWARE COUNTER.
2. The default initial value for digital output is HIGH. If you want to set the initial output status to LOW, you
may instruct the kernel to load epm_3438.ko with a default LOW setting at boot time. To do this, edit the
line epm3438
epm3438_DO2LOW=1 in /etc/modules. To initialize the setting, reboot your computer.
Moxa: ~# vi /etc/modules
epm3438 epm3438_DO2LOW=1
Registering Digital I/O Callback Events
Moxa provides a library of functions that allow users to develop higher layer functions that respond to DI/O
state changes. These functions allow user applications to create specific responses to digital I/O events by
associating a callback function with an I/O event.
The source code files of the sample program are located in the
/example/V2100.V24XX/EPM3438/digit_input_change/ directory.
Four higher layer functions provide programmers with an API for timer callback events:
digit_io_timer_init
digit_io_timer_dispatch
digit_io_timer_add_callback
digit_io_timer_dispatch_quit
There are also four functions that give programmers an API for digital I/O callback events, available via the
digit_io_timer_add_callback function:
DGTIO_GET_INPUT_STATE_CHANGE
DGTIO_GET_INPUT
DGTIO_GET_OUTPUT
DGTIO_SET_OUTPUT

Содержание

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

Скачать