> Resurrecting this thread from a month ago. > > I had issues fitting a piggy-back pc-board into the original product. > However, I have been slowly migrating the parent of this product from a > 16F to an 18F23k22 and accelerated that effort as it would've possibly > let me use the D/A technique below... specifically because I'm using the > internal oscillator, and the 18F will let me run that much faster. > > Net result is that it works nicely -- at 32Mhz. And since I'm using C > now for my 18F apps, it got implemented very rapidly. Thanks for > informing me of this technique. > > Now though, I have to ask about this method -- why exactly the need for > a random number? I am simply sampling as much as possible, and toggling > the output bit depending on if the sampled value is greater or less than > the measured value. That measured value being the filtered output bit. > > Cheers, > -Neil. >From your description, it sounds like you're using an adc to measure the output voltage and then setting the output bit high or low as appropriate. This is similar to delta modulation. Is this what you're doing? I think the random number approach did not use an ADC. Instead, the desired output is compared to random numbers and the pin set high if the desired output is above the random number and low if it's below. If the random number were not random, but were, instead, a steadily increasing number, you'd get standard PWM. But, you would have to increment the number at fixed intervals to get the required duty cycle. As I read this random number method, you can call run it at irregular intervals and the output will still be correct due to the use of the random numbers. It's a really interesting idea. Harold --=20 FCC Rules Updated Daily at http://www.hallikainen.com - Advertising opportunities available! Not sent from an iPhone. --=20 http://www.piclist.com PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist .