Hi,
As far as I can see there's no CCP module connected to PortB.2 so that one is out.The device is a 28-pin PIC18F25K22, and I need to have the pulse on either PORTB.2 or PORTB.3.
PortB.3 on the other hand can have the CCP2 module connected to it but by default it's connected to PortC.1. You select which pin (either PortB.3 or PortC.1) the CCP2-module should be connected to with the CCP2MX bit in the CONFIG3H configuration word. The purpose of the DEFINE is to let the compliler know how you've configured the device - at least that's how I understand it.
Then, since it's the CCP2 module you need to use HPWM 2, 200, 10000.
Finally, in your code you're trying to get an output frequency of 2Hz, that's not going to work.
/Henrik.




Bookmarks