Télécharger Imprimer la page

Velleman K8055D Mode D'emploi page 14

Publicité

Les langues disponibles

Les langues disponibles

14
Description of the DLL
Utiliser le K8055D.DLL en Borland C++ Builder
Ci-dessous se trouve un listing du K8055D.h qui contient les explications des procédures et fonctions
K8055D.DLL. Un listing d'un exemple d'application démontre l'utilisation des deux fonctions les plus
importantes, OpenDevice et CloseDevice.
//Listing K8055D.h
#ifdef __cplusplus
extern
"C"
{
#endif
#define FUNCTION __declspec(dllimport)
FUNCTION long __stdcall OpenDevice(long CardAddress);
FUNCTION __stdcall CloseDevice();
FUNCTION long __stdcall ReadAnalogChannel(long Channel);
FUNCTION __stdcall ReadAllAnalog(long *Data1, long *Data2);
FUNCTION __stdcall OutputAnalogChannel(long Channel, long Data);
FUNCTION __stdcall OutputAllAnalog(long Data1, long Data2);
FUNCTION __stdcall ClearAnalogChannel(long Channel);
FUNCTION __stdcall ClearAllAnalog();
FUNCTION __stdcall SetAnalogChannel(long Channel);
FUNCTION __stdcall SetAllAnalog();
FUNCTION __stdcall WriteAllDigital(long Data);
FUNCTION __stdcall ClearDigitalChannel(long Channel);
FUNCTION __stdcall ClearAllDigital();
FUNCTION __stdcall SetDigitalChannel(long Channel);
FUNCTION __stdcall SetAllDigital();
FUNCTION bool __stdcall ReadDigitalChannel(long Channel);
FUNCTION long __stdcall ReadAllDigital();
FUNCTION long __stdcall ReadCounter(long CounterNr);
FUNCTION __stdcall ResetCounter(long CounterNr);
FUNCTION __stdcall SetCounterDebounceTime(long CounterNr, long DebounceTime);
#ifdef __cplusplus
}
#endif
//Listing Unit1.cpp
//---------------------------------------------------------------------------
#include <vcl.h>
#pragma hdrstop
#include
"Unit1.h"
#include
"K8055D.h"
//---------------------------------------------------------------------------
#pragma package(smart_init)
#pragma resource
TForm1 *Form1;
//---------------------------------------------------------------------------
__fastcall TForm1::TForm1(TComponent* Owner)
: TForm(Owner)
{
}
//---------------------------------------------------------------------------
void __fastcall TForm1::Connect1Click(TObject *Sender)
{
int CardAddr =
int h = OpenDevice(CardAddr);
switch (h) {
0
:
case
case
1
:
2
:
case
3
:
case
Label1->Caption =
break;
"*.dfm"
3
- (int(CheckBox1->Checked) + int(CheckBox2->Checked) * 2);
"Card "
+ IntToStr(h) +
"
connected";
© 2003 ... Velleman

Publicité

loading

Ce manuel est également adapté pour:

K8055d.dll