Hi Ian, A simple passive RC lowpass filter on the A/D input should do the trick. Put it between whatever amplifier you use to amplify the current sense signal and the A/D input. This is roughly equivalent to your software averaging approach. Later, Eric >Hi all, > >An interesting observation arose for me just now whilst cutting the code on >an f877 to do the A/D for current sensing from a device being controlled >from a PWM voltage source. > >My PWM is at 5kHz. I discovered that the current readings were not >averages, because the A/D acquisition time is much faster that the PWM >frequency, so the current sense readings were sometimes coming back as >maximum, and sometimes as zero ! It is obviously catching either the low or >high state of the PWM output. Only occasionally were they coming back >somewhere in between - obviously when the A/D acquisition happened to catch >the PWM on a rising or falling edge. > >My simple solution was to take a number of readings and average them. In >this case, I took 20 readings, which seems now to give me a good "average" >current output, which is what I was after. Any comments on better ways to >do this would be appreciated. > >Rgs >Ian. > >-- >http://www.piclist.com hint: The list server can filter out subtopics >(like ads or off topics) for you. See http://www.piclist.com/#topics > > > -- http://www.piclist.com hint: The list server can filter out subtopics (like ads or off topics) for you. See http://www.piclist.com/#topics