Robert Lewis

PWM wave files using AN2250

Discussion created by Robert Lewis on Apr 17, 2007
Latest reply on Aug 14, 2008 by CrasyCat
I am trying to use/understand the code from AN2250 on wave files and the PWM on the H12 family. The program takes a normal .wav file and creates a series of flash pages of data. The data in the wave file is converted to ascii char's for some reason and as far as I can see when the data is again retrieved from the flash pages it is stored directly into the duty cycle register of the PWM. The modulus counter is used to interrupt at a hardcoded value, and the next value in the array is retrieved.

But this doesn't make any sense to me; why would ascii data be stored into duty cycle register. Is this an aribitrary offset that combined with the modulus counter interrupt generates the correct freguency?. Can someone please explain the methodology behind the code and how it generates a wave sound?

Or can anyone suggest other code to do the same function? This app code is poorly explained in my opinion.