G'day all, just getting back into starting to get some stuff happening with PICs, and am after some advice/help as to whether I'm understanding things correctly. I am trying to figure out how to play a 16kHz 8bit sound; I think I've got the method for converting sound to hex file sorted out (for embedding in internal memory), just need to check that my logic is correct for playback. Does this sound correct; Run the PWM module at as high a rate as is possible to make it's own frequency inaudible, and set up an interrupt at the audio's sample rate (16kHz) to populate the duty value from the sound array? I found a few different timer and PWM calculators here: http://eng-serve.com/pic/index.html [1] which looks pretty cool, I'm using a PIC18F2620 or possibly a PIC24FJ64 in future, but from my searches the code produced should work for them, correct? So to get a 16kHz interrupt (or close enough) from Timer0, with a 20MHz OSC, I should be using a 1:4 prescaler and a TMR0 preloader of 178? Also, according to the PWM register calculator: http://eng-serve.com/pic/pic_pwm.html [2] different values will result in different maximum duty values; if I'm using an 8bit sound, should I simplify things by aiming for a maximum duty value of 256 (OSC@20MHz, PWM freq @ 78kHz), or am I missing the point? If I use the "full" code for setting up interrupts, PWM, etc., this should be compatible with all C compilers, rather than using proprietary "short" methods? The shortcut to the compiler I'm using says "PIC C", installed it ages ago so I'm not sure which compiler it actually is, Hitec C, CCS, dunno? I just know that the old projects I have lying around used shorthand methods of setting things up, but all of the info I've found lately on interrupts etc use the longer methods, which I think I'm finally understanding, so should I stick to the longer methods for cross-compiler compatability? Any input would be greatly appreciated Lee Links: ------ [1] http://eng-serve.com/pic/index.html [2] http://eng-serve.com/pic/pic_pwm.html -- http://www.piclist.com PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist