Softwareprogrammierung mit der QLIB
5.5.2
Ansteuerung der Optokoppler I/O
Beispiel : Einlesen der Eingänge mit der QLIB unter C
#include <windows.h>
#include <stdio.h>
#include <conio.h>
#include "qlib.h"
/*=====================
Hauptprogramm
======================*/
void main ()
{
ULONG handle;
if ((handle =QAPIExtOpenCard(handle,0L)) == 0L)
{
printf("Karte konnte nicht geoeffnet werden\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);
}
PROTO 2
/* Handle der PROTO 2*/
Seite 25