I have been assigned the task of repairing a Meade Lx200 EMC telescope. I'm remaking the entire circuit of the telescope from the scratch. The problem that i'm currently facing is all about the encoder. The encoder had 5 outputs coming out from it? what kind of an encoder is this? I'm intending to use pic 16f877a for this purpose.
Can someone help me out to figure out this encoder and how to connect that 5 outputs to the pic?
Can someone help me out to figure out this encoder and how to connect that 5 outputs to the pic?
I would guess that it is a quadrature encoder with single ended outputs. The outputs may be either a line driver or an NPN style. The NPN style needs pull up resistors, probably to 5 volts DC. If I am correct, the 5 wires are +DC, GND, A, B, C. The A and B tell the change of position and direction. The C channel is typically one pulse per rev for synchronizing the counter. Hopefully, the wires from the encoder are color coded in some standard way, like red for +dc and black for gnd. Sometimes blue is used for +dc and brown is for gnd. You should be able to follow these traces, +dc and gnd will go all over the board. The other three wires should come from one chip, maybe. I hope this helps...
Bill Sturm
Bill Sturm
Thanks Bill for the information..
One more clarification. I'm using pic16f877a to control the motors and the encoders. So where do these 3 wires fit in the pic (A,B,C terminals of the encoder). The pic does not have an encoder module, so how am I supposed to program me the pic and calculate the number of pulses. I'm giving PWM pulses to the motors and getting the feedback from the encoders. It would be greatly appreciated if I could get a help here
One more clarification. I'm using pic16f877a to control the motors and the encoders. So where do these 3 wires fit in the pic (A,B,C terminals of the encoder). The pic does not have an encoder module, so how am I supposed to program me the pic and calculate the number of pulses. I'm giving PWM pulses to the motors and getting the feedback from the encoders. It would be greatly appreciated if I could get a help here
I won't answer in great detail, mostly because the information is out there to be Googled. Microchip has some app notes also, I think. I would either tie the encoder lines to port B and use the change of state interrupts, or tie the A or B channel to the interrupt input. You probably shouldn't try to poll the encoder lines, as they are definitely a hard real time situation.
Bill Sturm
Bill Sturm
This is a quadrature encoder with single ended outputs?
Bill is right
Andre, www.automationandmaintenance.com
Bill is right
Andre, www.automationandmaintenance.com
5 wires? What are the colors, i would think Sine, Co Sine but 5?
For the decoding logic, just google "quadrature decoder circuit" or similar. One good page I found was:
http://www.fpga4fun.com/QuadratureDecoder.html
Your trickiest task will be figuring out the power and ground lines, because applying power the wrong way coud fry the encoder. Once you've got that, you can experiment pretty easily without worrying.
Curt Wilson
Delta Tau Data Systems
http://www.fpga4fun.com/QuadratureDecoder.html
Your trickiest task will be figuring out the power and ground lines, because applying power the wrong way coud fry the encoder. Once you've got that, you can experiment pretty easily without worrying.
Curt Wilson
Delta Tau Data Systems
I thought of connecting channel A to port B int pin (rb0) and connecting channel B to RB4. Then where should I connect channel z? Then how does it go from here?
I'm a novice pic programmer and I spent nearly 2 day in Google trying for a sample code in mikroc to count encoder pulses, but didn't come across anything. It would be a great help for me if I could get a sample code in mikrc regarding encoder direction and distance calculation.
I'm a novice pic programmer and I spent nearly 2 day in Google trying for a sample code in mikroc to count encoder pulses, but didn't come across anything. It would be a great help for me if I could get a sample code in mikrc regarding encoder direction and distance calculation.
If you connect ABC to port B 0, 1, 2 respectively, you may be able to use the Port B interrupt on change. If your PIC supports this, the interrupt routine can use a state machine to decide which input has changed. With a basic understanding of quadrature encoding and some experimentation, you should be able to get it working.
Bill Sturm
Bill Sturm
If you trigger RB0 and set up an interrupt on change, then the direction of rotation will be indicated by the value of the other channel - 0 for one way and 1 for the other.
You can keep track of the count in many different ways. One would be to set a register to 2, then test RB4 and skip if zero. The skipped instruction clears the register. Then decrement the register to get either 0x01 or 0xFF. This can be added to a counter to keep track of position.
movlw 0x02
movwf DIRECTION
btfsc PORTB,RB4
clrf DIRECTION
decf DIRECTION,w
addwf POSITION
You can keep track of the count in many different ways. One would be to set a register to 2, then test RB4 and skip if zero. The skipped instruction clears the register. Then decrement the register to get either 0x01 or 0xFF. This can be added to a counter to keep track of position.
movlw 0x02
movwf DIRECTION
btfsc PORTB,RB4
clrf DIRECTION
decf DIRECTION,w
addwf POSITION
Your use of this site is subject to the terms and conditions set forth under Legal Notices and the Privacy Policy. Please read those terms and conditions carefully. Subject to the rights expressly reserved to others under Legal Notices, the content of this site and the compilation thereof is © 1999-2010 Nerds in Control, LLC. All rights reserved.
Users of this site are benefiting from open source technologies, including PHP, MySQL and Apache. Be happy.
Fortune
If all the world's a stage, I want to operate the trap door.
-- Paul Beatty







