Herunterladen Diese Seite drucken

Quancom OPTOREL16 Benutzerhandbuch Seite 31

Werbung

QLIB Befehle
6.5.2
Ansteuerung der Optokopplereingänge
Beispiel zur Programmierung der Optokoppler mit der QLIB unter C
#include <windows.h>
#include <stdio.h>
#include <conio.h>
#include "qlib.h"
/*=====================
Hauptprogramm
======================*/
void main ()
{
ULONG opto16in;
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);
}
OPTOREL16
Seite 31

Werbung

loading