#include <stdio.h>
#include <dos.h>
#include <stdlib.h>
#include <conio.h>
#include "iso813.h"


int Base = 0x220;
WORD Buf[20000];
/* DWORD ArrayTimes , ErrorTimes; */

void main(void)
{
    int rtErr;
    DWORD t0 , t1 , i, dt;
    WORD wGainCode, wBipolar, wJump10v, wChannel ;

    /* 
    ArrayTimes = 0;
    ErrorTimes = 0;
    */

    /* Initialize Timer and ISO813 Board and then check it. */
    rtErr = ISO813_DriverInit();
    if (rtErr != ISO813_NoError ) {
	printf("\nISO813 Driver open error!");
	return;
    }

    rtErr = ISO813_Check_Address( Base );
    if (rtErr != ISO813_NoError ){
        printf("\nISO813 Board Address 0x220 Error");
	return ;
    }

    printf("\nCard 0x220 [polling test]");
    printf("\nUsing [ISO813_ADs_Hex(BaseAddress, Channel, GainCode, wBuf, DataNo) ]");
    wChannel = 0;  /* Set to Channel 0 */
    wGainCode = 0; /* Gain 0 */
    rtErr = ISO813_ADs_Hex( Base, wChannel, wGainCode, Buf, 1000 );
    if ( rtErr == ISO813_NoError )
	    for( i=0;i<1000;i+=1)
		printf("\n[%3lu]:[%4x]:[%6d]",i,Buf[i],Buf[i]);
    else
	printf("\nISO813_ADs_Hex Error!!\nErrorCode : %d",rtErr);


    ISO813_DriverClose();

}


