Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

Problem with Rotary Encoder

Status
Not open for further replies.

divinecosmos

Newbie level 3
Joined
May 10, 2012
Messages
4
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,317
I am using LPC 1769 for my microcontroller project. The microcontroller is ARM Cortex M-3.

I am having trouble programming the rotary encoder. It is of the incremental type. Any code fragments or any other help would be great.

A single click on rotary encoder makes it turn by 15 degrees. How do I detect a single turn (ie a rotation of 15 dgrees) clockwise and anticlockwise?
 

My experience with rotary encoders is that they have two outputs. One click in either direction generates a pulse on both outputs. The timing of those two pulses depends on which direction you are turning the knob. Turn the knob one way and the leading pulse will be on the opposite output from the one where the leading pulse is if you turn the knob in the other direction.
 

Is the datasheet available for the rotary encoder?

Is the rotary encoder located on a development board?

If so, which development board is it?

BigDog
 

The rotary encoder is on a P24 board meant for PIC processor. This board is connected to another board (P30) on which the ARM processor is attached. I am looking for a code fragment or algorithm to detect rotary encoder turns. I have an infinite while loop which can poll the rotary encoder. Now I am not able to figure out how to detect turns. Do I need to give any patterns to the rotary encoder? Or just monitoring the 2 outputs is sufficient?
 

Rotary encoder 5 pin
 

Attachments

  • rotary_encoder.pdf
    235.4 KB · Views: 88

The rotary encoder is on a P24 board meant for PIC processor. This board is connected to another board (P30) on which the ARM processor is attached. I am looking for a code fragment or algorithm to detect rotary encoder turns. I have an infinite while loop which can poll the rotary encoder. Now I am not able to figure out how to detect turns. Do I need to give any patterns to the rotary encoder? Or just monitoring the 2 outputs is sufficient?

Monitoring of outputs should be sufficient.
Normally, you would read the phase difference between both square waves – that would be your direction, and then you would count pulses (from any output, X Y or, if available Z) – that would be the rotation.
From the data sheet or the label on the rotary encoder read what is the number of pulses per revolution (100, 360, 1000, ..) and use this number to compare with the pulse-count to calculate the rotation and/or speed ..
:wink:
IanP
 

Rotary encoder interfacing
 

Attachments

  • ise.pdf
    131.1 KB · Views: 53

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top