求助:各位大人帮我看一下我的程序错在哪?不胜感激
时间:12-13
整理:3721RD
点击:
这是ac1080数据采集程序,编译有错误,各位大虾帮我看看,小弟不胜感激!
/*
* CIN source file
*/
#include "extcode.h"
#include "hosttype.h"
#include "dos.h"
#include "conio.h"
/*
* typedefs
*/
typedef struct {
int32 dimSize;
float64 Numeric[1];
} TD1;
typedef TD1 **TD1Hdl;
CIN MgErr CINRun(uInt16 *basea, uInt8 *channel, int32 *samples, TD1Hdl Wavef
orm);
CIN MgErr CINRun(uInt16 *basea, uInt8 *channel, int32 *samples, TD1Hdl Wavef
orm) {
/* ENTER YOUR CODE HERE */
int16 dbyte;
float64 value;
float64 array;
int32 i,j;
MgErr err=noErr;
if(err=SetCINArraySize((UHandle)Waveform,3,*samples))
goto out;
(*Waveform)->dimSize=*samples;
array = (*Waveform)->Numeric;
for(i=0;i<*samples;i++)
{
outp(*basea,channel);
// delay 20uS, that's 2 a/d converting
for(j=0;j<2;j++)
{
outp(0x211,0);
while((i=inp(0x210) & 1) !=0);
}
dbyte=inp(0x212) + inp(0x213)* 256;
value=(float)(dbyte-2048)*5000.0/2048.0;
array=value;
array++;
}
out:
return noErr;
}
错误:
e:\labviewcin\iofiles\cintools\iofiles.c(34) : error C2115: '=' : incompatib
le types
e:\labviewcin\iofiles\cintools\iofiles.c(38) : warning C4047: 'function' : '
int ' differs in levels of indirection from 'unsigned char *'
e:\labviewcin\iofiles\cintools\iofiles.c(38) : warning C4024: 'outp' : diffe
rent types for formal and actual parameter 2
Error executing cl.exe.
iofiles.obj - 1 error(s), 2 warning(s)
/*
* CIN source file
*/
#include "extcode.h"
#include "hosttype.h"
#include "dos.h"
#include "conio.h"
/*
* typedefs
*/
typedef struct {
int32 dimSize;
float64 Numeric[1];
} TD1;
typedef TD1 **TD1Hdl;
CIN MgErr CINRun(uInt16 *basea, uInt8 *channel, int32 *samples, TD1Hdl Wavef
orm);
CIN MgErr CINRun(uInt16 *basea, uInt8 *channel, int32 *samples, TD1Hdl Wavef
orm) {
/* ENTER YOUR CODE HERE */
int16 dbyte;
float64 value;
float64 array;
int32 i,j;
MgErr err=noErr;
if(err=SetCINArraySize((UHandle)Waveform,3,*samples))
goto out;
(*Waveform)->dimSize=*samples;
array = (*Waveform)->Numeric;
for(i=0;i<*samples;i++)
{
outp(*basea,channel);
// delay 20uS, that's 2 a/d converting
for(j=0;j<2;j++)
{
outp(0x211,0);
while((i=inp(0x210) & 1) !=0);
}
dbyte=inp(0x212) + inp(0x213)* 256;
value=(float)(dbyte-2048)*5000.0/2048.0;
array=value;
array++;
}
out:
return noErr;
}
错误:
e:\labviewcin\iofiles\cintools\iofiles.c(34) : error C2115: '=' : incompatib
le types
e:\labviewcin\iofiles\cintools\iofiles.c(38) : warning C4047: 'function' : '
int ' differs in levels of indirection from 'unsigned char *'
e:\labviewcin\iofiles\cintools\iofiles.c(38) : warning C4024: 'outp' : diffe
rent types for formal and actual parameter 2
Error executing cl.exe.
iofiles.obj - 1 error(s), 2 warning(s)
array = (*Waveform)->Numeric[0];