bsodmike
New Member
Hi folks,
Thanks to many people here I was pointed in the direction of the 18F1330 PIC featuring 3 on-board PWMs.
I've gotten as far as this, simulated in MPLAB. Coded with Hi-Tech's PICC18 STD compiler:
**broken link removed**
I was able to configure the PIC to only enable PWM on the 'odd' port pins, and output a 500Hz signal, which works nicely as it brings the PWM resolution to a maximum of 13.96 (odd). This works out to '16000' representing a 100% duty cycle, which is a nice round number.
In the above simulation I had the code loop from 0% to 100% duty cycle and at the end to flip the state on the other 'RB' pins (configured as I/O rather than PWM).
Next up: Implement a serial 'receive' interrupt to adjust the duty cycle on the fly based on data received from a PC.
Thanks to many people here I was pointed in the direction of the 18F1330 PIC featuring 3 on-board PWMs.
I've gotten as far as this, simulated in MPLAB. Coded with Hi-Tech's PICC18 STD compiler:
**broken link removed**
I was able to configure the PIC to only enable PWM on the 'odd' port pins, and output a 500Hz signal, which works nicely as it brings the PWM resolution to a maximum of 13.96 (odd). This works out to '16000' representing a 100% duty cycle, which is a nice round number.
In the above simulation I had the code loop from 0% to 100% duty cycle and at the end to flip the state on the other 'RB' pins (configured as I/O rather than PWM).
Next up: Implement a serial 'receive' interrupt to adjust the duty cycle on the fly based on data received from a PC.