PDA

View Full Version : PIC16F819 HPWM CCP1 clariffication



earltyso
- 20th March 2008, 16:58
I think I should just change my login ID to "confused" sometimes....or is that already taken?
Anyway I am currently using a 16f819 for an electric scooter control board overhaul. I currenly am using HPWM on PORTB.3/ CCP1 with no problems.

'short clip from my code
main:
adcin 1,B0 'Pot value is stored in B0 variable
hpwm 1,B0,1000 'B0 is fetched from ADC as an 8-bit value 0-255
'return
IF PORTB.7 = 0 Then blinkleft
IF PORTB.6 = 0 Then blinkright
IF PORTB.5 = 0 Then headlight
IF PORTB.4 = 0 Then brakelight
IF PORTA.3 = 0 THEN BEEP
return
goto main


What I am confused about is why there are (2) CCP1 pins (PORTB.2 & PORTB.3)? Why are they not labled CCP1 & CCP2 in the pin diagram? Even though I have in my code to use channel 1, I still am given the option to choose my CCP1 bit/channel under fuses with a drop down menu. After reading section 5.29 in the PBP manual I can only guess there are alternate pins for HPWM and they are just labeled the same in the pin diagram....?

Probably a dumb question but I really would like an answer.

thanks ahead of time.

skimask
- 20th March 2008, 17:08
I think I should just change my login ID to "confused" sometimes....or is that already taken?
Nope...it's open! :D


What I am confused about is why there are (2) CCP1 pins (PORTB.2 & PORTB.3)?
As you've already figured out, there's only one channel on this PIC.
Yes, they are alternate pins for the same function.
If my reading is right, you can have it one of a few ways:
1 - No CCP module, hardware serial data out, and low voltage programming
2 - Use the CCP module, don't use hardware serial data out, and keep low voltage programming
3 - Use the CCP module, keep the low voltage programming, but lose the hardware serial data output.
I guess it's all about the options...
(check the PIC24 and PIC32 and their use of the whole 'assignable pin function' deal. It's slick)

earltyso
- 20th March 2008, 18:43
thanks!
I just need HPWM, no serial, so I will keep it as I have it!