@ everybody(Erik, Per & ...) it is very interesting for me to know how did you found that i am an electronic student??? and which school session, is finished at October (in my country)? unfortunately internet is full of 'EXPERT TROLLs' instead of real 'engineers'.
Amir
OK got it!
Exactly what RPM are you planning to run the motor, and exactly what position precision are you demanding?
i decide to run the motor at 79310 encoder pulses per second and 34 encoder pulses precision. in other words, it must run at 34 pulses per 428 microseconds.
i think there are two approaches :
I. set PWM1->MR0 (lim register) to (428/2=214)microseconds and setup an interrupt at the end of cycle includes PID routine that adjusts 17 pulses per this pwm cycle.
(this method has about 1/17 pulse error)
II. set PWM1->MR0 (lim register) to 14 microseconds but setup interrupt for QEI ENCLK_Int(encoder pulses) that takes about 12.5 microseconds and change PWM1->MR1 (match register) using PID during this interrupt for the next pwm cycle.
is it applicable to implement 2nd approach? thanks
Hi another question I have doubts about LER in PWM. assume that:
LPC_PWM1->MR0=1000000; LPC_PWM1->MR1=500000
and TC value is about 20 and it haven't been mached with 500000 ! now if an interrupt occurs that contains:
LPC_PWM1->MR1=200 LPC_PWM1->LER =0x01;
does the match occurs for MR1=200 or the program runs the match for MR1=500000 and uses the new value (MR1=200) for the next cycle?
thanks