View previous topic :: View next topic |
Author |
Message |
fkl
Joined: 20 Nov 2010 Posts: 44
|
pwm + pic18f14k50 |
Posted: Tue Sep 17, 2013 11:04 pm |
|
|
hi.
Help. How to configure PWM output RC3?
Code: | setup_timer_2(T2_DIV_BY_4,249,1);
setup_ccp1(CCP_PWM);
set_pwm1_duty(500); |
|
|
|
Ttelmah
Joined: 11 Mar 2010 Posts: 19504
|
|
Posted: Wed Sep 18, 2013 4:16 am |
|
|
You have to use 'pulse steering'.
Code: |
setup_timer_2(T2_DIV_BY_4,249,1);
setup_ccp1(CCP_PWM | CCP_PULSE_STEERING_C);
//RC3, is P1C, hence the 'C' here.
set_pwm1_duty(500);
|
A few older compilers, don't correctly set the TRIS when this is done, but current ones do. If your's doesn't, add 'output_drive(PIN_C3);'.
Best Wishes |
|
|
fkl
Joined: 20 Nov 2010 Posts: 44
|
|
Posted: Wed Sep 18, 2013 7:37 am |
|
|
thank you very much. |
|
|
|