i am currently working on acceleration of steeper motor using LPC1768. there is a acceleration table for it which i have to follow. can anyone help me with code on how to approach. by PWM or by timer or by following some library.
the table looks like this.
You are right, if you use two winding of stepper motor, it is okay to use MCPWM module, the CTimer module is NOT capable of controlling the motor.
how do i approach with MCPWM?. i saw a application note which uses MCPWM to control the BLDC. http://www.strong-ic.com/upload/1336633627_407.pdf . but in this note it uses a hall ssensor to get the position of the motor.
all i need to know is if i want to accelerate my stepper motor in 40 steps(may be using for loop) each time i might have to change to different time according to the table. so how do i solve that problem.
First of all, as you know that the stepper motor does not need closed loop, the hall sensor is NOT required.
Regarding the accelerating table, i think you can develop a table based on your required accelerating curve which define the PWM cycle time and duty cycle, you can use PIT to generate ISR, in the ISR you can assign the one vector in the table to the registers of PWM which can specify the PWM cycle time and duty cycle.
Hope it can help you
Do you just ONE PWM signal to control stepper motor?
If you just need one PWM signal to control stepper motor, you can use 50% duty cycle PWM to control motor, the PWM signal can be from CTimer or PWM modules.
Pulse rate(pps) PWM cycle time(ms), PWM duty cycle,
111 9 50%
179 5.58 50%
1033 0.968, 50%
Assume that the PCLK is 10MHz, the match3 of CTimer controls the cycle time of PWM signal, the match0 control the PWM duty cycle, this is the list:
Pulse rate(pps) PWM cycle time(ms), PWM duty cycle, match3 register, match0 register
111 9.027 50% 90270 90270/2=24135
179 5.58 50% 55800 55800/2
1033 0.968, 50% 9680 9880/2
From firmware, you have to generate interrupt for each PWM cycle, then in ISR, compute the updated match3 and match0 register value.
If you need two or more PWM signals to control stepper motor, you have to use PWM signal from PWM module, because there is timing requirement for the two PWM signals.
Hope it can help you