18.11.2012 Aufrufe

USBOPTO/REL 64/32/16/8 - QUANCOM Informationssysteme GmbH

USBOPTO/REL 64/32/16/8 - QUANCOM Informationssysteme GmbH

USBOPTO/REL 64/32/16/8 - QUANCOM Informationssysteme GmbH

MEHR ANZEIGEN
WENIGER ANZEIGEN

Erfolgreiche ePaper selbst erstellen

Machen Sie aus Ihren PDF Publikationen ein blätterbares Flipbook mit unserer einzigartigen Google optimierten e-Paper Software.

55<br />

5.2.2 Borland Delphi Beispiel<br />

Der fettgedruckte Text beschreibt, wie man die QLIB in ein Delphi Projekt einbindet. Nach der Installation der<br />

QLIB befindet sich das sofort kompilierbare Beispielprojekt usbmodul.pas im Ordner d:\program<br />

files\quancom\qlib<strong>32</strong>\samples\usbopto\delphi (Gilt nur bei einer Installation in das Standartverzeichnis).<br />

5.2.2.1 Programmierung der Ein-/Ausgänge, so wie diverser Spezialfunktionen.<br />

Welche Schritte nötig sind, um die QLIB zu eigenen Projekten hinzuzufügen, entnehmen Sie bitte dem Header<br />

im Quelltext.<br />

program <strong>USBOPTO</strong>_CONSOLE_APP;<br />

uses<br />

WinProcs;<br />

{*<br />

// usbopto.pas : Sample project for the <strong>USBOPTO</strong><strong>REL</strong><strong>16</strong> and <strong>USBOPTO</strong>IO Modules<br />

//<br />

// Author: Michael Reimer, <strong>QUANCOM</strong> <strong>Informationssysteme</strong> <strong>GmbH</strong>, Germany<br />

//<br />

// Website: http://www.quancom.de<br />

// Product:<br />

// USB OPTO I/O Module http://www.quancom.de/qprod01/eng/pb/usbopto<strong>16</strong>io.htm<br />

// USB OPTO Relay Module http://www.quancom.de/qprod01/deu/pb/usboptorel<strong>16</strong>.htm<br />

// Information:<br />

//<br />

// To use the QLIB Commands in your source, do the following:<br />

//<br />

// (1) Add statement #include "qlib.pas" to your source file.<br />

// (2) Copy QLIB.PAS from QLIB Installation Directory<br />

// d:\program files\quancom\qlib<strong>32</strong>\include to your<br />

// working directory<br />

*}<br />

function KeyPressed: Boolean;<br />

var<br />

Buffer: TInputRecord;<br />

Data: DWORD;<br />

hIn: DWORD;<br />

begin<br />

hIn := GetStdHandle( STD_INPUT_HANDLE );<br />

Result := False;<br />

PeekConsoleInput(hIn, Buffer, 1, Data);<br />

if Data 0 then<br />

if Buffer.EventType = Key_Event then<br />

begin<br />

Result := True;<br />

end;<br />

FlushConsoleInputBuffer(hIn)<br />

end;<br />

{$APPTYPE CONSOLE}<br />

{$INCLUDE QLIB.pas}<br />

{$X+}<br />

const OUT1 = $1;<br />

OUT2 = $2;<br />

OUT3 = $4;<br />

OUT4 = $8;<br />

OUT5 = $10;<br />

OUT6 = $20;<br />

OUT7 = $40;<br />

OUT8 = $80;<br />

OUT9 = $100;<br />

OUT10 = $200;<br />

OUT11 = $400;<br />

OUT12 = $800;<br />

OUT13 = $1000;<br />

OUT14 = $2000;<br />

OUT15 = $4000;<br />

OUT<strong>16</strong> = $8000;<br />

© <strong>QUANCOM</strong> <strong>Informationssysteme</strong> <strong>GmbH</strong>

Hurra! Ihre Datei wurde hochgeladen und ist bereit für die Veröffentlichung.

Erfolgreich gespeichert!

Leider ist etwas schief gelaufen!