#include   <stdio.h>	     /******************************************/
#include   "A812.h"         /*                                        */
			     /* for A812			      */
unsigned int   Buffer[2000]; /* 				       */
			     /******************************************/
main(void)
{
int  Ch,G,i,j;
float  volt,temp,v0,v1,v2,v3,v4,v5,v6,v7;
unsigned int PollData;

A812_Initialize(0,0x220,-1,-1);

for (;;)
{
Ch=0; G=0;				  /* Channel_0, Gain=1, Bipolar */
A812_AD_SetChGainMode(Ch,G,POLLING_MODE); /* Polling */
A812_Delay(4*2);			  /* GAIN setting time=4  us */
PollData=A812_AD_PollingVar();
temp=(float)PollData;
volt=(temp-2048)/2048.0*5.0;
v0=volt;

Ch=1; G=1;				  /* Channel_1, Gain=2 , Bipolar*/
A812_AD_SetChGainMode(Ch,G,POLLING_MODE); /* Polling */
A812_Delay(5*2);			  /* GAIN setting time=5  us */
PollData=A812_AD_PollingVar();
temp=(float)PollData;
volt=(temp-2048)/2048.0*5.0;
v1=volt/2.0;

Ch=2; G=2;				   /* Channel_2,Gain=100,Bipolar*/
A812_AD_SetChGainMode(Ch,G,POLLING_MODE);  /* Polling */
A812_Delay(5*2);			   /* GAIN setting time=5   us */
PollData=A812_AD_PollingVar();
temp=(float)PollData;
volt=(temp-2048)/2048.0*5.0;
v2=volt/4.0;

Ch=3; G=3;				   /*Channel_3,Gain=1000,Bipolar*/
A812_AD_SetChGainMode(Ch,G,POLLING_MODE);  /* Polling */
A812_Delay(7*2);			   /* GAIN setting time=7    us */
PollData=A812_AD_PollingVar();
temp=(float)PollData;
volt=(temp-2048)/2048.0*5.0;
v3=volt/8.0;

Ch=4; G=4;				   /*Channel_4,Gain=16	,Bipolar*/
A812_AD_SetChGainMode(Ch,G,POLLING_MODE);  /* Polling */
A812_Delay(7*2);			   /* GAIN setting time=7    us */
PollData=A812_AD_PollingVar();
temp=(float)PollData;
volt=(temp-2048)/2048.0*5.0;
v4=volt/16;

printf("\nA812:[0]=%7.5fV,[1]=%7.5fV,[2]=%7.5fV,[3]=%7.5f,[4]=%7.5fV",v0,v1,v2,v3,v4);
printf("\n----- press ESC to STOP -----\n");
delay(1000);
if (kbhit()!=0) {getch(); return;}
}
}
