Bonjour, voila j'ai rédigé un code sous TC, pour contrôler une carte d'acquisition.
Le code me paraît bon, seulement j'ai un soucis sur le linkage! je ne maitrise pas trop ca! J'ai bien mis mon fichier entete (.h) dans le dossier INCLUDE.

voici le code

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
 
******************************************************/
/* This program is developed by Turbo C 2.0 */
/******************************************************/
/* Demo 1: One P16R16 card demo. */
/******************************************************/
#include "P16R16.H"
int main()
{
int i,j;
WORD nVal;
float fVal;
WORD wBoards,wRetVal,wVal;
WORD wInData;
WORD wTypeID;
WORD wAddress0,wAddress1,wAddress2;
WORD wAddress3,wAddress4,wAddress5;
WORD P16R16_BaseAddress,P8R8_BaseAddress;
WORD wP16R16No,wP8R8No;
clrscr();
/* initiaing PCI-P16R16 card and detect how many P16R16/P8R8 card in PC */
wRetVal=PCI_DriverInit(&wBoards);
printf("Threr are %d PCI-P16R16/P8R8 Cards in this PC, tally.\n",wBoards);
if( wBoards==0 )
{
putch(0x07); putch(0x07); putch(0x07);
printf("There are no P16R16/P8R8 card in this PC !!!\n");
exit(0);
}
/* dump every P16R16/P8R8 card's configuration address space */
for(i=0; i<wBoards; i++)
{
 
wRetVal=PCI_GetConfigAddressSpace(i,&wTypeID,
&wAddress0,&wAddress1,&wAddress2, &wAddress3,&wAddress4,&wAddress5);
if( !wRetVal )
{
switch( wTypeID )
{
case 0: printf("==> %02d Board Name:PCI-P16R16\n",i);
P16R16_BaseAddress=wAddress2;
wP16R16No++;
break;
case 1: printf("==> %02d Board Name:PCI-P8R8\n",i);
P8R8_BaseAddress=wAddress2;
wP8R8No++;
break;
case 2: printf("==> %02d Board Name:PCI-TMC12\n",i);
break;
case 3: printf("==> %02d Board Name:PCI-DA16\n",i);
break;
case 4: printf("==> %02d Board Name:PCI-DA8\n",i);
break;
}
printf(" --> Addr0:%04x | Addr1:%04x | Addr2:%0x\n",
wAddress0,wAddress1,wAddress2);
printf(" --> Addr3:%04x | Addr4:%04x | Addr5:%0x\n\n",
wAddress3,wAddress4,wAddress5);
}
}
/* Getting the Driver version */
wRetVal=PCI_GetDriverVersion(&wVal);
printf("Driver Version=%x\n",wVal);
/* call a function to test if exact calling LIB */
nVal=PCI_ShortSub2(1,2);
printf("P180X_ShortSub2(1,2) = %d\n",nVal);
/* call another function to test if exact calling LIB */
fVal=PCI_FloatSub2(1.0,2.0);
 
printf("P180X_FloatSub2(1.0,2.0) = %f\n",fVal);
if( wP16R16No<1 )
{
putch(0x07);
printf("Please plug one PCI-P16R16 in PC !!!\n");
exit(0);
}
/*************************************/
/***** PCI-P16R16 DO/DO demo *****/
/*************************************/
printf("The PCI-P16R16 DO/DI testing !!!\n");
P16R16_DO(P16R16_BaseAddress,0x0000); /* Digital output */
delay(500); /* Delay a little time 500ms */
wInData=P16R16_DI(P16R16_BaseAddress); /* Digital input */
printf("Digital Output -> 0000H | Digital Input -> %04xH\n",wInData);
P16R16_DO(P16R16_BaseAddress,0xFFFF); /* Digital output */
delay(500); /* Delay a little time 500ms */
wInData=P16R16_DI(P16R16_BaseAddress); /* Digital input */
printf("Digital Output -> FFFFH | Digital Input -> %04xH\n",wInData);
P16R16_DO(P16R16_BaseAddress,0x5555); /* Digital output */
delay(500); /* Delay a little time 500ms */
wInData=P16R16_DI(P16R16_BaseAddress); /* Digital input */
printf("Digital Output -> 5555H | Digital Input -> %04xH\n",wInData);
P16R16_DO(P16R16_BaseAddress,0xAAAA); /* Digital output */
delay(500); /* Delay a little time 500ms */
wInData=P16R16_DI(P16R16_BaseAddress); /* Digital input */
printf("Digital Output -> AAAAH | Digital Input -> %04xH\n",wInData);
PCI_DriverClose();
return 0;
}
Les erreurs sont les suivantes :
LINKER ERROR sur toutes les fonctions que j'appel (PCI_FLOATSUB2; PCI_DRIVERINIT, ...)
Ces fonctions sont définies dans le fichier entete P16R16.H, donc c'est forcément un soucis de link! Aidez moi SVP !