# include " dos . h " # include " math . h " # include " stdio . h " # include " stdlib . h " int data [600]; void q _ad0; main () { q_ad() } void q _ ad() { int i , dl , dh , base , n _ time ; base -512; n _ time =10; outportb ( base ,0); dl = inportb ( base +3); for ( i =0; i <=600; i ++) { dl = inport ( base +3); for (i=0;i<=600;i++); if ( inportb ( base +2)>=128) break ; dl = inportb ( base +3); dh = inportb ( base +2); data [ i ]=( dh <<8)+ dl ; delay ( n _ time ); } }
时间: 2024-04-10 09:30:27 浏览: 59
#include <stdio.h>
#include <stdlib.h>
#include <dos.h>
#include <conio.h>
#define BASE -512
#define SIZE 600
#define DELAY_TIME 10
void q_ad();
int data[SIZE];
int main()
{
q_ad();
return 0;
}
void q_ad()
{
int i, dl, dh;
outportb(BASE, 0);
dl = inportb(BASE + 3);
for (i = 0; i < SIZE; i++)
{
dl = inportb(BASE + 3);
for (i = 0; i < SIZE; i++)
{
if (inportb(BASE + 2) >= 128)
break;
}
dl = inportb(BASE + 3);
dh = inportb(BASE + 2);
data[i] = (dh << 8) + dl;
delay(DELAY_TIME);
}
}
阅读全文