POC-500 Series
108
DI COS Example
#include <stdio.h>
#include <stdlib.h>
#include <windows.h>
#include "WDT_DIO.h"
//Step 0
,
define a Change-of-State Interrupt callback function
void __stdcall callback_function(COS_INT_CALLBACK_ARG* arg)
{
printf("data=0x%02x, flag=0x%02x, seq=%02d\n",
arg->portData, arg->intrFlag, arg->intrSeq);
}
int main(int argc, char* argv[])
{
//Step 1
, initialize DIO library by invoking InitDIO()
if ( ! InitDIO() )
{
printf("InitDIO --> FAILED\n");
return -1;
}
printf("InitDIO --> PASSED\n");
//Step 2
, setup Change-of-State Interrupt mask and level/edge mode
COS_INT_SETUP setup;
memset(&setup, 0, sizeof(setup));
setup.portMask = 0x0f;
// 00001111b, enable ch.0~3
setup.edgeMode = 0x00; // generate interrupt on level change
setup.edgeType = 0x00;
// rising/falling edge, only effective when
edgeMode = 1
if ( ! SetupDICOS(&setup, sizeof(setup)) )
{
printf("SetupDICOS --> FAILED\n");
return -2;
}
printf("SetupDICOS --> PASSED\n");
Содержание POC-500 Series
Страница 1: ...Neousys Technology Inc POC 500 Series User Manual Revision 1 0...
Страница 21: ...POC 500 Series 21 1 5 2 DIO Panel View 1 5 3 COM and Audio Port Panel View...
Страница 22: ...POC 500 Series 22 1 5 4 Bottom View...
Страница 24: ...POC 500 Series 24 1 6 2 DIO Panel View 1 6 3 COM and Audio Port Panel View...
Страница 25: ...POC 500 Series 25 1 6 4 Bottom View...