PWM for the PIC18F1330
Here’s a little example code for the PIC18F1330 that generates 3 different PWM signals. It’s done with MPLAB and HI-Tech’s PICC-Lite compliler. It’s probably a little over done in that I wanted to be able to just enter a decimal value for each of the duty cycles. That resulted in some code that is a little memory intensive.
I just picked up the CCS compiler and my understanding is that the CCS libraries will allow me to do a little more with less. I plan on writing some code for comparison. I’ll post it when I’m finished.
First, here’s the configuration …put this in a separate file called configuration-word.h.
Here’s the Main loop…
You’ll see wnen you examine it that I should have put some of the code into functions. That would have helped it’s size conserably. Oh well, maybe another time.
Rich Dennison

