View previous topic :: View next topic |
Author |
Message |
joseph20480
Joined: 21 Dec 2011 Posts: 42
|
SOLVED - dsPIC33fj64GS610 - PWM generation |
Posted: Sun Mar 20, 2016 9:08 am |
|
|
Hi,
I'm trying to generate a pwm signal but nothing...
I use for that an Explorer 16 dev. board + dsPIC33fj64gs610.
I give you my code:
Code: |
setup_timer3(TMR_INTERNAL|TMR_DIV_BY_1|TMR_CONTINUE_IDLE);
setup_capture(1, capture_off);
setup_compare(1,COMPARE_PWM_FAULT|COMPARE_TIMER3);
set_pwm_duty(1,1000); ;
|
If you see a big mistake, tell me please !
Last edited by joseph20480 on Mon Mar 21, 2016 2:02 am; edited 1 time in total |
|
|
Ttelmah
Joined: 11 Mar 2010 Posts: 19520
|
|
Posted: Sun Mar 20, 2016 10:02 am |
|
|
You are not giving the timer a 'time'. Second value for the setup, is the count at which it is to reset. So assuming (say) a 50% duty cycle:
setup_timer3(TMR_INTERNAL|TMR_DIV_BY_1, 2000);
Without this it'll default to 65535, so the actual pulse would be tiny.
I'm ignoring idle at the moment.
Then you have fault enabled. With this, the PWM will go off, unless the fault pin is in the clear state. Is it?. (OCFA). |
|
|
joseph20480
Joined: 21 Dec 2011 Posts: 42
|
|
Posted: Mon Mar 21, 2016 2:05 am |
|
|
sure.....
thanks ! |
|
|
|