// a2d.c - A2D functions // // Version 14.3 // ADC prescaler changed to 64, to give 125kHz AD clock freq. // With continious sampling, this gives 4,580 samples per second per channel. #include #include "a2d.h" // Static variables holding the latest values from the ADC static short ADValue[8]; // ---------------------------------------------------------------------------------------------------------------------------------------------------------------- // Initialize Analogue to Digital converters. // Use single ended conversion - one channel at a time, // Setup to sample channels only when triggered. (not free running) // For accurate 10 bit conversion, AD clock must be between 50kHz and 200kHz void A2D_Init(void) { uint8_t n; for (n=0;n<8;n++) ADValue[n] = 400; ADCSRA = (1< 0x07) chanNum = 0x03; /* only use high-order pins (pinc0-pinc2 are digital inputs) */ // ADMUX = (1<