Moxa V2426A-C2-W7E Руководство по аппаратной части онлайн [30/88] 170938

Moxa V2426A-C7-CT-T Руководство по аппаратной части онлайн [30/88] 170942
V2400A Series Expansion Modules Software Installation and Programming Guide
4-10
{
mngr->fd[0] = mxdgio_open();
#if 1 // Jared, 08-10-2010, support the second EPM-3438
mngr->fd[1] = mxdgio_epm3438_open(0); // The first EPM-3438
mngr->fd[2] = mxdgio_epm3438_open(1); // The second EPM-3438
#endif
if (mngr->fd[0] < 0)
{
free(mngr);
mngr = NULL;
}
}
return mngr;
}
/*** adds a digital IO timer with a selected operation mode
Inputs: \
<mngr> timer manager \
<HWIndex> specify which hardware device; \
0: embedded DIO, \
1: EPM-3438 #1, \
2: EPM-3438 #2 \
<port> specify which DIO pin \
<mode> the operation mode on the port \
<interval> the interval (in milliseconds) between 2 calls \
to a user-defined function \
<cb> the user-defined callback function \
<arg> argument to the function \
Returns: \
0 on sucess, otherwise failure \
***/
int
digit_io_timer_add_callback(DGIOMNGR *mngr, int HWIndex, int port, int mode, int
interval, digit_io_cb_t cb, void *arg)
{
DGIOITEM *item;
item = (DGIOITEM*) calloc (1, sizeof (DGIOITEM));
if (!item)
return -1;
item->next = mngr->list;
mngr->list = item;
item->cb = cb;
item->arg = arg;
item->HWIndex = HWIndex; // Jared, 08-10-2010, HWIndex to support multiple boards
item->port = port;
item->mode = mode;
item->interval = interval;
item->next_time = interval;
// Jared, 08-10-2010, HWIndex to support multiple boards
item->last_signal = mxdgio_get_input_signal(mngr->fd[HWIndex], port);
return 0;
}
void
digit_io_timer_dispatch_quit(DGIOMNGR *mngr)

Содержание

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

Скачать