joseph20480
Joined: 21 Dec 2011 Posts: 42
|
pic 24F and period of Pwm [solved] |
Posted: Sun Sep 09, 2012 8:41 am |
|
|
Hi,
I'm working on a motor control with a PWM brigh power. My Pic is 24Fj128g104, my ccs is 4.128.
I'm trying to set the period of my pwm signal but i encounter a problem : In spite of value, the period is always the same...
this is my fuses :
Code: |
#include <24FJ64GA104.h>
#DEVICE *=16
#device adc=10
#fuses FRC_PLL,NOWDT
#FUSES ICSP2
#FUSES NOIOL1WAY //Allows multiple reconfigurations of peripheral pins
#FUSES OSCIO //OSC2 is general purpose output
#FUSES SOSC_IO //SOSC0/RA4
#FUSES NOPR //Pimary oscillaotr disabled
#use delay(clock=32M,internal)
|
this is my code...
Code: | setup_timer2(TMR_INTERNAL|TMR_DIV_BY_1,100);
setup_compare(1,COMPARE_PWM_EDGE | COMPARE_TIMER2 );
setup_compare(2,COMPARE_PWM_EDGE | COMPARE_TIMER2 );
set_pwm_duty(1,1000);
set_pwm_duty(2,1000);
|
Now i able to change the duty cycle with change value of "Set_pwm_duty", but anything for the period.
If anyone have an idea ???
thanks in advance |
|