PCIOPTOREL16 PCIOPTO16I/O
5.3.3
Einlesen der Optokoppler unter C
#include <windows.h>
#include <stdio.h>
#include <conio.h>
#include "qlib.h"
/*=====================
Main program
======================*/
void main ()
{
ULONG handle;
/* Handle of the card */
// The following sequence tries to open the PCIOPTO16IO Card
// Insert the CARDID of your card, to open other cards
if ((handle =QAPIExtOpenCard(PCIOPTO16IO,0L)) == 0L) {
printf("Couldn't open PCIOPTO16IO \n");
return;
}
for (;;)
{
if (kbhit()!=0 && getch()==27) break;
printf("%04lx\n",QAPIExtReadDI16(handle,0L,0L));
Sleep(500);
printf("%04lx\n",QAPIExtReadDI16(handle,0L,0L));
Sleep(500);
printf("%04lx\n",QAPIExtReadDI16(handle,0L,0L));
Sleep(500);
printf("%04lx\n",QAPIExtReadDI16(handle,0L,0L));
Sleep(500);
}
QAPIExtCloseCard(handle);
}
© QUANCOM Informationssysteme GmbH
59