stoyanoff
Joined: 20 Jul 2011 Posts: 375
|
set_motor_pwm_duty() strange behaviour ?! |
Posted: Mon Mar 25, 2013 4:50 am |
|
|
Hi! I have pcb with dsPIC30F5015. I`m using
Code: |
setup_motor_pwm(1,MPWM_FREE_RUN,20000);
|
to set the period and the mode. Next I`m setting the pwm units:
Code: |
set_motor_unit(1,1,MPWM_ENABLE_L,0,0);
set_motor_unit(1,2,MPWM_ENABLE_H,0,0);
|
First module: active low channel 0 deadtime
Second module: active high channel 0 deadtime
Here comes the problem! As the ex_motor_pwm I`m using
Code: |
set_motor_pwm_duty(1,1,255);
set_motor_pwm_duty(1,2,65535);
|
In the example the 0xFFFF should be 100% duty cycle, BUT for the low channel my max value is 255. If I set bigger value from 255 the module blocks after the first counting! 255 for low channel sets the duty cycle to 100%. I`m using MPLAB 8.88 and CCS v4.134!
Where does this difference come? Am I doing something wrong?
If I run a simulation with MPLAB SIM with 255 max for both channels everything is OK! BUT in practice when I load the program the high channel demands 65535 max! |
|