General programming examples



Relay control under Visual basic Heater control under Visual basic
' Turn on the relay until a button
' is pressed


Dim Wert As Long
start:
   Wert&=QAPIGetDI(POPTO16IN) And 1

 QAPIPutDO(PREL8,Wert&)
GoTo start
' Heater control for a chemical
' Process with Watchdog control


Const _80_GRAD = 1278 ' Wert 1278 entspr. 80 C
DIM Temperatur As Long

start:
   Temperatur&=QAPIGetAD(Pad12,0)
  If Temperatur& < _80_GRAD Then
    QAPIWriteDO(PREL8,1)   'Turn Relay on
  Else
    QAPIWriteDO(PREL8,0)   'Turn Relay off
endif

QAPIWatchdogRetigger
GoTo start
Relay control under C Heater control under C
/* Turn on the relay until a button*/
/* is pressed
*/

Void main (void)
{
ULONG wert;

while (1) {  wert=QAPIGetDI(POPTO16IN) & 1;  /*Keyboard state*/

QAPIPutDO(PREL8,wert);  /*Turn Relay on*/
}
}
/* Heater control for a chemical */
/* Process with Watchdog control
*/

#define _80_GRAD 1278L   /*1278 are .80 degrees*/
void main (void)
{
ULONG temperatur;

while (1) {   
 temperatur=QAPIGetAD(PAD12,0);
 if (temperatur < _80_Grad)
  QAPIPutDO(PREL8,1);   /*Turn Relay on*/
 else
  QAPIPutDO(PREL8,0);   /*Turn Relay off*/

 QAPIWatchdogRetigger();   /*Watchdog*/
}
}
Relay control under Delphi Heater control under Delphi
{ Turn on the relay until a button }
{ is pressed
}

var wert: Longint;

label start;

begin
start:
  wert=QAPIGetDI(POPTO16IN) and 1;
  QAPIPutDO(PREL8,wert);
goto start
end.
{ Heater control for a chemical }
{ Process with Watchdog control
}

var temperatur: Longint;

const_80_GRAD=1278;
label start;

begin
start:
  temperatur=QAPIGetAD(PAD12,0);

  if temperatur < _80_GRAD then
   QAPIPutDO(PREL8,1)
  else
   QAPIPutDO(PREL8,0)

  QAPIWatchdogRetigger;
goto start   
end.


 Continue to "Programming example for QUANCOM cards"