Hello, I have a PIC 16F88 and the programme is:
;Chip Settings #chip 16F88,8 #config OSC=INTRC_IO
;Defines (Constants) #define PWM_Freq 1 #define PWM_Duty 50
DIR PORTB.0 out
'Main code do forever
'Turn up brightness over 2.5 seconds For Bright = 1 to 255 HPWM 1, 1, Bright wait 25 ms next
'Turn down brightness over 2.5 seconds For Bright = 255 to 1 HPWM 1, 1, Bright wait 25 ms next loop
This programme works well, but with PIC 16F1827 ¡Does not work! The programme is as follow:
;Chip Settings #chip 16F1827,8 #config OSC=INTOSC
'Turn up brightness over 2.5 seconds For Bright = 1 to 255 HPWM 1, 1, Bright wait 50 ms next
'Turn down brightness over 2.5 seconds For Bright = 255 to 1 HPWM 1, 1, Bright wait 50 ms next loop
Can you help me? Thanks
The 16F1827 has CCP1 on PORTB.3 by default. You can get CCP1 to use PORTB.0 using -
set APFCON0.CCP1SEL on
or just set PORTB.3 as an output and use that.
Thank you very much. And … if I need PORTB.0 and PORTB.3 ?
Right. I see ….
For example:
set APFCON0.CCP1SEL , 0 DIR PORTB.3 out set APFCON0.CCP2SEL, 0 DIR PORTB.6 out
Log in to post a comment.
Hello, I have a PIC 16F88 and the programme is:
;Chip Settings
#chip 16F88,8
#config OSC=INTRC_IO
;Defines (Constants)
#define PWM_Freq 1
#define PWM_Duty 50
DIR PORTB.0 out
'Main code
do forever
'Turn up brightness over 2.5 seconds
For Bright = 1 to 255
HPWM 1, 1, Bright
wait 25 ms
next
'Turn down brightness over 2.5 seconds
For Bright = 255 to 1
HPWM 1, 1, Bright
wait 25 ms
next
loop
This programme works well, but with PIC 16F1827 ¡Does not work! The programme is as follow:
;Chip Settings
#chip 16F1827,8
#config OSC=INTOSC
;Defines (Constants)
#define PWM_Freq 1
#define PWM_Duty 50
DIR PORTB.0 out
'Main code
do forever
'Turn up brightness over 2.5 seconds
For Bright = 1 to 255
HPWM 1, 1, Bright
wait 50 ms
next
'Turn down brightness over 2.5 seconds
For Bright = 255 to 1
HPWM 1, 1, Bright
wait 50 ms
next
loop
Can you help me? Thanks
The 16F1827 has CCP1 on PORTB.3 by default. You can get CCP1 to use PORTB.0 using -
or just set PORTB.3 as an output and use that.
Thank you very much.
And … if I need PORTB.0 and PORTB.3 ?
Right. I see ….
For example:
set APFCON0.CCP1SEL , 0
DIR PORTB.3 out
set APFCON0.CCP2SEL, 0
DIR PORTB.6 out