K8055 Probleme

dragoncds - 27 déc. 2012 à 18:59
yann_lo_san Messages postés 1137 Date d'inscription lundi 17 novembre 2003 Statut Membre Dernière intervention 23 janvier 2016 - 29 déc. 2012 à 13:30
Bonsoirs, j'ai aquis une carte K8055 Velleman, et j'essaye en vain de créer un programme pour pouvoir gérer cet carte en C sous code block , j'ai bien link le K8055D_C.lib au projet ainsi que le K8055D_C.h:
#ifdef __cplusplus
extern "C" {
#endif

#define FUNCTION __declspec(dllexport)

FUNCTION long __stdcall OpenDevice(long CardAddress);
FUNCTION void __stdcall CloseDevice();
FUNCTION long __stdcall ReadAnalogChannel(long Channel);
FUNCTION void __stdcall ReadAllAnalog(long *Data1, long *Data2);
FUNCTION void __stdcall OutputAnalogChannel(long Channel, long Data);
FUNCTION void __stdcall OutputAllAnalog(long Data1, long Data2);
FUNCTION void __stdcall ClearAnalogChannel(long Channel);
FUNCTION void __stdcall ClearAllAnalog();
FUNCTION void __stdcall SetAnalogChannel(long Channel);
FUNCTION void __stdcall SetAllAnalog();
FUNCTION void __stdcall WriteAllDigital(long Data);
FUNCTION void __stdcall ClearDigitalChannel(long Channel);
FUNCTION void __stdcall ClearAllDigital();
FUNCTION void __stdcall SetDigitalChannel(long Channel);
FUNCTION void __stdcall SetAllDigital();
FUNCTION int __stdcall ReadDigitalChannel(long Channel);
FUNCTION long __stdcall ReadAllDigital();
FUNCTION long __stdcall ReadCounter(long CounterNr);
FUNCTION void __stdcall ResetCounter(long CounterNr);
FUNCTION void __stdcall SetCounterDebounceTime(long CounterNr, long DebounceTime);

FUNCTION void __stdcall Version();
FUNCTION long __stdcall SearchDevices();
FUNCTION long __stdcall SetCurrentDevice(long lngCardAddress);

#ifdef __cplusplus
}
#endif


J'ai voulu donc pour voir si ca marcher test la fonction pour ce connecter a la carte OpenDevice(0) et pour test si ca a bien marcher utiliser la fonction SetAllDigital(); permettant de mettre a "1" toute les sortie de la carte or rien ne ce produit . Je me demande donc d’où viens le problème.
Voila le code simple que j'ai fait juste pour faire un test
#include <stdio.h>
#include <stdlib.h>
#include "K8055D_C.h"
int main()
{
    int i, k;
    OpenDevice(0);

SetAllDigital();
scanf("%d",&i);
}


En espérant trouver une réponse a mon problème,
Dragoncds.

1 réponse

yann_lo_san Messages postés 1137 Date d'inscription lundi 17 novembre 2003 Statut Membre Dernière intervention 23 janvier 2016 26
29 déc. 2012 à 13:30
Salut,

es-tu sur du "0" dans l'appel à : OpenDevice(0)

As-tu essayé quelque chose de plus logique du genre :

long device = SearchDevices();
if( device > 0L )
{
OpenDevice(device);
}
else
{
puts("Aucun device !");
}

bye...
0
Rejoignez-nous