发表于:2003-12-02 10:57:00
楼主
我用c编的程序如下:
#include <conio.h>
#include <stdio.h>
#include <stdlib.h>
#include <dos.h>
#include "acl.h"
#include "aclerr.h"
#include "std.h"
#include "video.h"
#include "key.h"
#include "8316.H"
#define ACL_BaseAddress 0x220
#define FIFO_HALF_SIZE 512
#define AD_SAMPLE_CNT FIFO_HALF_SIZE * 2
I16 acl_Buffer[AD_SAMPLE_CNT*2];
void main()
{
int i;
U8 status, ad_ch_no, ad_range, irq_no, autoscan, ad_mode,x;
U8 tmpBuf[80];
U16 ad_count, real_count, disp_count, c1, c2;
I16 ad_data,err;
F32 volt;
F32 xx[1024];
if( _8316_Initial( CARD_1 , ACL_BaseAddress ) != ERR_NoError ) {
printf( "ACL-8316 Initialization Error !!\n" );
exit(0);
}
textmode(C80);
textbackground(BLUE);
textcolor(RED);
cprintf("%s","press any key to start.");
ad_ch_no = AD_CH_0; /* AD channel #0 */
ad_range = AD_B_5_V; /* AD Gain = 2 */
irq_no = 15; /* IRQ Level = 15 */
ad_count = AD_SAMPLE_CNT;
c1 = 5;
c2 = 10;
autoscan = FALSE;
ad_mode = INT_MODE_1; /* internal timer trigger, FIFO half full interrupt */
for(i=0; i<AD_SAMPLE_CNT; i++) acl_Buffer[i] = 0xFFFF; /* initial buffer */
_8316_AD_INT_Start(ad_mode,autoscan,ad_ch_no,ad_range,irq_no,ad_count,acl_Buffer);
_8316_AD_Timer(c1, c2);
getch();
do {
_8316_AD_INT_Status( &status, &real_count );
} while ( status == AD_INT_RUN && !kbhit() );
_8316_AD_Timer(0, 0);
_8316_AD_INT_Stop(&real_count );
clrscr();
gotoxy(10,10);
L:x=inportb(ACL_BaseAddress+8); /*读取A/D转换状态位*/
if((x&0x20)==0x20)goto M; /* 如果A/D转换状态位EOC=1,转向M*/
goto L; /* 如果EOC=0,转向L*/
M: for(i=0;i<512;i++){
xx[i]=_8316_AD_Read_FIFO(&ad_data);
cprintf("%f",xx[i]);}
}
但是,用fifo半满中断,当时采集到的数据为0000。还请各位指导