#include 
#include 
#include 
#include 
#include 
#include 
#define AD16jr 0x330   //set the base address of the A to D board.

float a1[10010];

void timething (int i8);
void makescr(void);

int main(void)
{
	long Digitalinput1,reading1;
	float voltage1;

	int gdriver = VGA;
	int gmode   = VGAHI;
	initgraph ( &gdriver, &gmode, "c:\\tc\\bgi" );
	cleardevice();

 //Initialize the board.


 //Get user ready to enter the voltage.
	int inc,count,cnt;




	count = 0;
	delay(1000);
	for (inc=0;inc<630;inc++)
	{

	outp(AD16jr,2);    //set up +/-1.25volts range.
	timething(150);
	outp(AD16jr+2,0x00);  //read from channel 0 only
	timething(150);
	outp(AD16jr,0); //initiate an A->D conversion by writing to base address.
	timething(150);

	Digitalinput1 = inpw(AD16jr); //reads a 16 bit word from base and base+1
	timething(150);
	reading1 = Digitalinput1 >> 4;  //this removes the unwanted channel info.
	//reading = Digitalinput/16; this statement
	//could also be used to do the same thing.
	//printf("The 12 bit reading is %ld ",reading1);
	//Convert the 12 bit number to a voltage.


	voltage1 = (reading1/4095.0)*1.25; //0=+/- 1.25 volts.
	voltage1 = (voltage1 -0.61)*10000;

	a1[inc] = voltage1;

	count = count + 1;

	if (count>600) {
	count = 1;
	makescr();
        cleardevice();
	}

	putpixel (count,a1[inc],15);

	}

	return 0;
	}

	void timething (int i8)
	{

	float r3,r4;
	int cnt;

	r4=1.4;

	for (cnt=0;cnt>scrfilename;
if (scrfilename[0]=='q') return;
scrfout=fopen(scrfilename,"wb");

unsigned char ch1b,ch2b,ch3b,ch4b,ch5,ch6;
int scrwid=630;
int scrhgt=200;
int scrx0=5;
int scry0=5;
setcolor(12);
line(scrx0,scry0-1,scrx0+scrwid-1,scry0-1);
line(scrx0,scry0+scrhgt,scrx0+scrwid-1,scry0+scrhgt);
ch3b=scrwid/256;
ch1b=scrwid%256;
ch4b=scrhgt/256;
ch2b=scrhgt%256;
fprintf(scrfout,"%c%c%c%c%c%c%c%c%c%c%c%c%c",'s','c','r',ch3b,ch1b,ch4b,ch2b,'0','0','0','0',13,10);
int ipixcol,ix,iy;
gotoxy(73,10);cout<<"saving";
for (iy=scry0;iy

    Source: geocities.com/hyperionphysics