Thanks for the reply Jesse. I'm intrigued by the calibration requirement though. Was the variation in the AVR or the analogue circuitry? Was it due to the lack of resolution in the A2D? David... Jesse Lackey wrote: > Hi, I did this with an AVR a year and a half ago. There are some > niggles. Depending on how accurate you'd like to be, how fast you can > sample, and the voltage range of the incoming signal, how accurate you > need to be for 100Hz vs. 1Khz vs. 10Khz frequencies, you may or may not > need to: > > 1. amplify or cut incoming signal to scale to the A/D range > 2. use a peak detector. I used the precision half-wave rectifier sample > circuit from the National Semi LM3916 datasheet. > 3. calibrate for unit-to-unit variation in peak detector output for a > given input signal level > 4. do some tweaking of averaging of samples to get a > reasonably-responsive VU display > > The device this was for had small size and power consumption as critical > parameters, and I decided to do it in firmware. The original plan was > to sample the internal digital audio stream (it is a mic pre with A/D, a > specialty portable pro audio thing) but the AVR couldn't do it for 96Khz > or 192Khz audio sample rates, a mistake I made from not reading the AVR > datasheet closely enough and no space/time for a CPLD or other external > helper digital logic. So this was all something of a (successful) hack, > unfortunately. > > I am able to get -30db (relative to about 2.5Vpp fullscale input) > reliably. But each unit requires calibration, a hassle. > -- ___________________________________________ David Duffy Audio Visual Devices P/L Unit 8, 10 Hook St, Capalaba 4157 Australia Ph: +61 7 38235717 Fax: +61 7 38234717 Our Web Site: www.audiovisualdevices.com.au ___________________________________________ -- http://www.piclist.com PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist