Philip Pemberton wrote: >> VBG.. Been there, done that.. >> In the AVR, I was able to sync my current sample to the PWM output, >> and by trimming nops, put the ADC sample point in a "quiet" zone. > > That's my plan too, but I don't like wasting cycles in ISRs :) There should be no need to trim with NOPs. Why can't the A/D be triggered from the same timer that controls the PWM, or at least a timer synchronized to the PWM or start of pulse? And do you really need to measure the current at all? You've basically got a buck converter if I understand this right. By measuring the input voltage and output voltage, you can compute the necessary pulse length to produce the desired average output current. I've used this technique, and Dave Tweed and I have a patent pending on its application to various aspects of power factor corrected power supplies. Your battery charger would likely not be infringing ;-) ****************************************************************** Embed Inc, Littleton Massachusetts, (978) 742-9014. #1 PIC consultant in 2004 program year. http://www.embedinc.com/products -- http://www.piclist.com PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist