2022-01-12 02:14 AM
i am driving STEPPER MOTOR using TIMER in PWM mode use interrupt for counting PULSES
now how can i accelerate motor slowly(acceleration time 200ms) then running at set speed?
acceleration time(ex 200ms) is variable how can i do it? Can iuse dma for very frequency?
2022-01-12 05:37 PM
ARR period can be recalculated as follows:
nPeriod = (nPeriod * 15) / 16; // Acceleration
nPeriod = (nPeriod * 21) / 16; // Deceleration
Of course you have to replace the ratio constants with your specific ones. Just take a note that the divider is recommended to be a power of 2, as that will be optimized to a simple and fast bit shift instruction.
2022-01-16 08:51 PM
what is 15 & 21 in nPeriod equation?
nPeriod value 16bit ? it is full pulse value ON+OFF time (50% duty)?