|
|
我用的是研华818L的采集卡,下面是我编的一个DLL,但是在VC++下就是编译不能通过,
出错的地方是在(*arg3)->elt=arrayA这一句,大侠们救我一下!!!谢谢!!!
/* Call Library source file */
#include "extcode.h"
#include "hosttype.h"
#include "conio.h"
#include "stdlib.h"
/* Typedefs */
typedef struct {
long dimSize;
float elt[1];
} TD1;
typedef TD1 **TD1Hdl;
_declspec(dllexport) void goal(unsigned short int *basea, long *samples, TD1
Hdl arg3); //basea为板卡的基地址,sanmples为采用点数,,
_declspec(dllexport) void goal(unsigned short int *basea, long *samples, TD1
Hdl arg3)
{
/* Insert code here */
short int dbyte;
float value;
short int i;
float * arrayA;
arrayA=(float *) calloc (*samples,sizeof(float));
(*arg3)->dimSize=*samples;
(*arg3)->elt=arrayA;
for(i=0;i<*samples;i++)
{
_outp(*basea+1,0x00); //这些为写和读板卡的端口
_outp(*basea+2,0x00);
_outp(*basea+0,0x00);
while(_inp(*arg1+8)&0x00);
dbyte=_inp(*basea+1)&0xff+(_inp(*basea+0)&0xf0)*256;
value=(float)((dbyte)*10/4096-5);
*arrayA=value;
arrayA++;
}
}
|
|