Skip to content

Commit

Permalink
Allow start duty to reach PWR_MAX_START again.
Browse files Browse the repository at this point in the history
  • Loading branch information
sim- committed Sep 12, 2012
1 parent 7d2edad commit f4dc1dc
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions tgy.asm
Expand Up @@ -1713,10 +1713,14 @@ start_from_running:
comp_init temp1 ; init comparator comp_init temp1 ; init comparator
RED_off RED_off


ldi YL, low(PWR_MIN_START) ; Start with limited power to
ldi YH, high(PWR_MIN_START) ; reduce the chance that we
movw sys_control_l, YL ; align to a timing harmonic

sbr flags0, (1<<SET_DUTY) sbr flags0, (1<<SET_DUTY)
; Set sys_control (start power) and STARTUP flag and call ; Set STARTUP flag and call update_timing which will set
; udpate_timing which calls set_new_duty which clears ; last_tcnt1 and set the duty (limited by STARTUP) and
; POWER_OFF, sets duty, and sets last_tcnt1. ; clear POWER_OFF.
rcall wait_timeout rcall wait_timeout
rcall com5com6 ; Enable pFET if not POWER_OFF rcall com5com6 ; Enable pFET if not POWER_OFF
rcall com6com1 ; Set comparator phase and nFET vector rcall com6com1 ; Set comparator phase and nFET vector
Expand Down Expand Up @@ -1785,7 +1789,7 @@ run6:
inc temp1 inc temp1
sts goodies, temp1 sts goodies, temp1
; Build up sys_control to PWR_MAX_START in steps. ; Build up sys_control to PWR_MAX_START in steps.
adiw YL, ((PWR_MAX_START - PWR_MIN_START) + 3) / 4 adiw YL, ((PWR_MAX_START - PWR_MIN_START) + 7) / 8
ldi temp1, low(PWR_MAX_START) ldi temp1, low(PWR_MAX_START)
ldi temp2, high(PWR_MAX_START) ldi temp2, high(PWR_MAX_START)
rjmp run6_3 rjmp run6_3
Expand Down Expand Up @@ -1839,9 +1843,6 @@ demag_timeout:
;-----bko----------------------------------------------------------------- ;-----bko-----------------------------------------------------------------
wait_timeout: sts goodies, ZH wait_timeout: sts goodies, ZH
sbr flags1, (1<<STARTUP) sbr flags1, (1<<STARTUP)
ldi YL, low(PWR_MIN_START) ; Reduce power since this
ldi YH, high(PWR_MIN_START) ; should only happen in a
movw sys_control_l, YL ; motor stall situation.
rjmp wait_commutation ; Update timing and duty. rjmp wait_commutation ; Update timing and duty.
;-----bko----------------------------------------------------------------- ;-----bko-----------------------------------------------------------------
wait_for_low: cbr flags1, (1<<ACO_EDGE_HIGH) wait_for_low: cbr flags1, (1<<ACO_EDGE_HIGH)
Expand Down

0 comments on commit f4dc1dc

Please sign in to comment.