I think I just had a real win. Something only took me about 15 minutes and the use of some expensive equipment to solve. However I was lucky – it was one of those jobs that I thought was going to take closer to three hours than 15 minutes…. I could just see it. Thankfully it did not.

So what was I doing? Well, in a nutshell I was wanting to make an obnoxious noise on some hardware. An alarm noise actually, but it becomes obnoxious. The processor allows you to set up any pin to output a tone for use as an alarm, but everything else stops when that is happening. Serial input stops. LED outputs stop. You name it. This is because the processor is just sitting there working on the task. So, I was looking for a better way. The way to do this is to use what is called the PWM, or Pulse Width Modulator. Basically this is hardware to digitally create the noise in the processor without the processor actually doing anything.

The thing is that the manual for the processor makes ancient greek look understandable to me. The manual hinted at setting using TIMER 2 or TIMER 4 when using PWM on CCP2 on the PIC18F4520. But it was not explicit. Not by any means. After looking at the manual for the nTH time, I tried setting the device to use timer 4, and it worked. I was impressed. Very impressed!

So now I can do the work that I want to without needing lots of CPU just to make noise…