I am using an optical encoder from Omron (E6A-CW100) as feedback the motor speed to MicroCore11. I am using asm language. I do not know where to start with. Anyone can help??? Thanks Regards Ivy __________________________________________________ |
|
using optical encoder for feedback to MicroCore11
Started by ●December 7, 2004
Reply by ●December 7, 20042004-12-07
In a message dated 12/7/04 9:13:46 P.M. Eastern Standard Time, writes: I am using an optical encoder from Omron (E6A-CW100) as feedback the motor speed to MicroCore11. I am using asm language. I do not know where to start with. Anyone can help??? Thanks =================================== Of course, the obvious place to start is to google for optical encoder algorithm or something. The manufacturers have to explain how these things work, and they have great data sheets. But anyway, here's a short hint... the 2 signals A and B are 90 deg out of phase.... if you draw this on a piece of paper you can work out how to tell which way the thing is turning: wait for one of the signals to go from lo to hi, then look at the other signal and if its hi or lo you are going this way or that. It is possible to quadruple the resolution of this technique (quadrature mode). You can poll or use edge sensitive interrupts. Depends on how good of a programmer you are and/or how much time you have. Can also buy a chip that keeps track of the count for you. (encoder chip). |
|
Reply by ●December 8, 20042004-12-08
Thks for the previous advice. My encoder can detect the speed of the motor.
Now my question is how am i going to program my MicroCore11 to capture the
rising and falling edges? thanks wrote: In a message dated 12/7/04 9:13:46 P.M. Eastern Standard Time, writes: I am using an optical encoder from Omron (E6A-CW100) as feedback the motor speed to MicroCore11. I am using asm language. I do not know where to start with. Anyone can help??? Thanks =================================== Of course, the obvious place to start is to google for optical encoder algorithm or something. The manufacturers have to explain how these things work, and they have great data sheets. But anyway, here's a short hint... the 2 signals A and B are 90 deg out of phase.... if you draw this on a piece of paper you can work out how to tell which way the thing is turning: wait for one of the signals to go from lo to hi, then look at the other signal and if its hi or lo you are going this way or that. It is possible to quadruple the resolution of this technique (quadrature mode). You can poll or use edge sensitive interrupts. Depends on how good of a programmer you are and/or how much time you have. Can also buy a chip that keeps track of the count for you. (encoder chip). Yahoo! Groups Sponsor Get unlimited calls to U.S./Canada --------------------------------- Yahoo! Groups Links To __________________________________________________ |
Reply by ●December 8, 20042004-12-08
In a message dated 12/8/04 3:07:07 A.M. Eastern Standard Time, writes: Thks for the previous advice. My encoder can detect the speed of the motor. Now my question is how am i going to program my MicroCore11 to capture the rising and falling edges? thanks ======================================= Algorithm to detect rising edge on PORTA bit 0: char pa,pa0,pa0r,pa0f,pa0last; pa=PORTA; pa0=pa & 1; pa0r=pa0 && !pa0last; pa0f=pa0 && !pa0last; pa0last=pa0; |
|
Reply by ●December 8, 20042004-12-08
Wouldn't it be much eaiser to use the Pulse Accumulator? From how I
read the manual, this would not be so CPU intensive. Just wondering. LF wrote: In a message dated 12/8/04 3:07:07 A.M. Eastern Standard Time, writes: Thks for the previous advice. My encoder can detect the speed of the motor. Now my question is how am i going to program my MicroCore11 to capture the rising and falling edges? thanks ======================================= Algorithm to detect rising edge on PORTA bit 0: char pa,pa0,pa0r,pa0f,pa0last; pa=PORTA; pa0=pa & 1; pa0r=pa0 && !pa0last; pa0f=pa0 && !pa0last; pa0last=pa0; Yahoo! Groups Sponsor Get unlimited calls to U.S./Canada --------------------------------- Yahoo! Groups Links To --------------------------------- |
Reply by ●December 15, 20042004-12-15
Your best bet is that if the optical encoders have an index output pin, use that to determine speed. That pin produces a pulse every time the enocder makes a revolution. If so then you tie that output to the IC1 to positive edge triggered IRQ and every IRQ, record the time in the TIC1 register. At 5000 RPM, you get 83.3333 pulses per second or one pulse about every 12 mS. This method will allow you to measure speeds in excess of 20,000 RPM at a buss clock of 2 MHz. If your encoders do not have an index output, there is another more complex method that is limited in top measureable speed maybe around 10,000 RPM. This is due to the cycle time required to process an IRQ service. What you are basically will be doing is mesuring the time between when the Phase A and Phase B pulses are generated from the optical encoder. Phase A will either lead or lag Phase B depending on clockwise or counter clockwise rotation. These two are in quadrature and therefore are 90 degrees out of phase. Thus the two events happen 1/4 of the cycle apart and hence speed times 4!. Revolution is frequency and the inverse of frequency is time. This will require the use of IC1 and IC2 of Port A. Like the example above the Input Captures of Port A record the value of the free running 16 bit TCNT counter. So when IC1 receives a leading edge pulse , it generates an IRQ that is enabled with IC1I in the TMSK1 register and read in the TFLG1 register. Likewise the IC2 has the IC2I and IC2F bits of the TMSK1 and TFLG1 registers. All you need to do is calcualte the difference in time, invert and multiply by 4. This is because the difference in time between phase A and phase B pulses will be one fourth of a cycle. This method is limited simply because you have to do more and the pulse come quicker. The best method is to have encoders with the index output. One advantage of the second method is that you can also determine direction as well as speed. james --- In , ng seng lee <senglee88@y...> wrote: > > I am using an optical encoder from Omron (E6A-CW100) as feedback the motor speed to MicroCore11. I am using asm language. I do not know where to start with. Anyone can help??? Thanks > > Regards > > Ivy > __________________________________________________ > |
Reply by ●January 31, 20052005-01-31
--- In , ng seng lee <senglee88@y...> wrote: > > I am using mc68hc11 to control theinduction motor speed, I do not know where to start with,and how can I generat the PWM signales from MC68hc11. Anyone can help??? Thanks > > Regards > > kama |
Reply by ●January 31, 20052005-01-31
--- In , ng seng lee <senglee88@y...> wrote: > > I am using mc68hc11 to control theinduction motor speed, I do not know where to start with,and how can I generat the PWM signales from MC68hc11. Anyone can help??? Thanks > > Regards > > kama |
|
Reply by ●January 31, 20052005-01-31
This is a pretty complicated topic. My best suggestion would be to study the implementations in existing HC11 based robotics controllers, the Handyboard (http://www.handyboard.com) is a good example of an existing well recieved HC11 based design with PWM motor controls. Good Luck, Hope that helps. Jim kama_333 wrote: >--- In , ng seng lee <senglee88@y...> wrote: >>I am using mc68hc11 to control theinduction motor speed, I do not >> >> >know where to start with,and how can I generat the PWM signales from >MC68hc11. Anyone can help??? Thanks >>Regards >> >>kama >> >> >> > > >Yahoo! Groups Links > > |
Reply by ●February 1, 20052005-02-01
The speed of an AC induction motor can only be changed by varying the frequency. PWM can be used to control the speed of a DC motor. PWM pulses can be generated rather nicely using the output compare features of the HC11. Nick Reitter -----Original Message----- From: kama_333 [mailto:] Sent: Monday, January 31, 2005 8:23 AM To: Subject: [m68HC11] Re: using optical encoder for feedback to MicroCore11 --- In , ng seng lee <senglee88@y...> wrote: > > I am using mc68hc11 to control theinduction motor speed, I do not know where to start with,and how can I generat the PWM signales from MC68hc11. Anyone can help??? Thanks > > Regards > > kama Yahoo! Groups Links |