PDA

View Full Version : Timer 3 config for HPWM using remappable pins



jimbostlawrence
- 5th December 2012, 13:23
Hi all,

Hope everyone has their Xmas wishlist prepared for Santa :P

Quick question... trying to use Timer3 on an 18F26J53 together with HPWM command to make an LED go dim/bright/dim/bright etc...

Code snippet:


EECON2 = $55
EECON2 = $AA
PPSCON.0 = 0
RPOR4 = 19
EECON2 = $55
EECON2 = $AA
PPSCON.0 = 1
CCP2CON = %00001100
PSTR2CON = %00000010
CCPTMRS0 = %00001000
t3con = %01001101
loop1:
SEROUT2 Serial_out,84,[$a,$d,dec RPOR4," ",bin8 CCPTMRS0]
hpwm 2,127,1000
pause 500
hpwm 2,255,1000
pause 500
goto loop1


Is there anything obviously wrong? I'm setting the remappable pin B1 for ECCP2, channel 2, etc, just can't get the LED to light using PWM.

Many thanks in advance

Jimbo

jimbostlawrence
- 5th December 2012, 14:26
... perhaps I'm misunderstanding the use of the HPWM command?
Is 'channel 2' on HPWM the same as using ECCP2?

- Jimbo -