#include<stdio.h>
#include<conio.h>
#include"a822.h"

int Base=0x220;
int Buf[1000];
int wCardMode;
void main(void)
{ int err;
  int i;
  float rate=5.0/2048.0;
  wCardMode=A822_SetCardModel(A822_Mode);
  err=A822_Initialize(0,Base,-1,-1);
  if(err){
     if(err==CheckBoardError){
        printf("Address 0 Error!\n");
     }
     else if(err==CardNumError){
        printf("Card Number Error!(range:0-7)\n");
     }
     return;
  }
  printf("\nCard 0 [polling test]\n");
  printf("Using [A822_AD_PollingArray]\n");
  A822_AD_SetChGainMode(0,A822_BI_1,POLLING_MODE);
  A822_AD_PollingArray(Buf,1000);
  for(i=0;i<1000;i+=100){
         printf("[%3d]%6.3f\n",i,rate*(Buf[i]-2048));
  }
  printf("Using [A822_AD_PollingVar]\n");
  Buf[0]=A822_AD_PollingVar();
  printf("PollingVar=%6.3f\n",rate*(Buf[0]-2048));
}
