// experi9b.c #include #include #include #include #include #include #include extern unsigned get_port(void); main() { unsigned ADC_Chan0,dac1,eoc; int count; char data[30000]; ADC_Chan0 = get_port(); if(ADC_Chan0 == 0) { printf("no hardware found\n"); return; } dac1 = ADC_Chan0 + 8; eoc = ADC_Chan0 + 0x18; printf("ADC Channel 0 after get_port = %X\n",ADC_Chan0); while(!kbhit()) { puts("Recording"); disable(); for(count=0; count<30000; count++) { outp(ADC_Chan0, 0); // start channel 0 conversion while(!(inp(eoc) & 0x80)); // wait for ready data[count] = (char)inp(ADC_Chan0); } enable(); puts("Playing"); disable(); for(count=0; count<30000; count++) { outp(ADC_Chan0, 0); // start channel 0 conversion while(!(inp(eoc) & 0x80)); // wait for ready outp(dac1, data[count]); // put the data in the DAC } enable(); // for(count=0; count<30000; count++) // printf("%4d",data[count]); } } // experi9b.c