Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- dev_tim_t tim;
- tim.pwm.channel = 1;
- tim.pwm.polarity = 0;
- tim.pwm.remap = 0;
- // timer freq = 10 khz, pwm period = 1 sec, pwm pulse = 0.1 sec
- dev_tim_pwm_init_mms(&tim, 1, 1000000, 16000, 1600);
- // pwm pulse = 0.3 sec
- // dev_tim_pwm_set_pulse_1k(&tim, 75);
- int d = -90;
- while(1)
- {
- dev_tim_pwm_set_pulse(&tim, 1600 + 2000 * d / (180));
- d++;
- TIMER_WAIT(100);
- if(d==90)d=-90;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement