In SX Microcontrollers, SX/B Compiler and SX-Key Tool, JonnyMac wrote: Rodney, Now that I've been playing and digging deeper, I think your pitch table is off. The reason is that you calculate the number of cycles for the entire period (P = 1/F, cycles = P/ISR_timing) but that's for the whole period; the ISR toggles the tone output when the cycles count is reached -- this means you have to divide the cycles count by 2 for each half of the square wave. I verified this by calculating the half-cycles count for A4 (A4), let it play, and hooked up a 'scope. The frequency was dead-on 440. You can fix your program by dividing PitchCount by 2 before enabling the sound output in the ISR. I'm presently calculating a new table. ---------- End of Message ---------- You can view the post on-line at: http://forums.parallax.com/forums/default.aspx?f=7&p=1&m=283554#m283713 Need assistance? Send an email to the Forum Administrator at forumadmin@parallax.com The Parallax Forums are powered by dotNetBB Forums, copyright 2002-2008 (http://www.dotNetBB.com)