[sdiy] precise square waves

Fredrik Carlqvist Fredrik.Carlqvist at iar.se
Wed Mar 8 10:42:26 CET 2006


The rotary encoder puts out two out-of-phase square waves. The sequence
of states tells which direction it is travelling. If we call the state
of the two outputs 0 and 1, it would be something like this:

turning clockwise:
output 1: 011001100110011001
output 2: 001100110011001100 

turning counter-clockwise:
output 1: 001100110011001100
output 2: 011001100110011001

So a transition from {0,0} to {0,1} is a decrement and from {0,0} to
{1,0} is an increment. Depending on how you program your PIC, you can
make one or two increments/decrements per cycles of the encoder, that is
to use both the transitions mentioned plus {1,1} -> {1,0} and {1,1} ->
{0,1} respectively. Both {0,0} and {1,1} are stable states with "snaps".

You could wire up a quad XOR package to get pulses for "step up" and
"step down" if you think it is easier, but it's probably better to do it
inside the PIC.

Hope this doesn't confuse you too much. Which I could be clearer
sometimes. As a swedish writer once put it: The obscurely spoken is
obscurely reasoned.

 
Fredrik C
 

________________________________

From: owner-synth-diy at dropmix.xs4all.nl
[mailto:owner-synth-diy at dropmix.xs4all.nl] On Behalf Of Rafael Cohen
Sent: den 8 mars 2006 02:30
To: synth-diy
Subject: [sdiy] precise square waves


 
Hi all,
I have an idea for a master clock synth module that would be basically a
very precise square wave including an LCD screen with a readout in Hz.
For easy generation of clock divisions to interface with my modular.  So
far I have found this kit: 
 
http://www.invent-electronics.com/freq_Counter.htm#
 
For the LCD etc... but now it is a matter of generating the square wave
with precise control.
 
I have found these cheap rotary encoders on Mouser, 
 
http://www.mouser.com/?handler=data.listcategory&Ne=100&terms=rotary+enc
oder&Ntt=*rotary*%2b*encoder*&crc=false&Ns=SField&N=3180
<http://www.mouser.com/?handler=data.listcategory&Ne=100&terms=rotary+en
coder&Ntt=*rotary*%2b*encoder*&crc=false&Ns=SField&N=3180> 
 
*sorry for the wrap here's a PDF too*
 
http://www.mouser.com/catalog/specsheets/TW-700029.pdf
 
but I do not know how to connect them to PICs or whatever.  My
understanding is that they put out a click of some kind with each
"detent" they hit during rotation and they rotate freely 360 degrees.
Do you know how these could be hooked up to a PIC to produce a good
square wave with precise resolution?  Somehow the PIC registers the
click and goes up .01Hz or whatever.  Maybe one for coarse and one for
fine, or maybe even three...?  I don't know how the PIC knows the
difference between turning clockwise and counter-CW. 
 
I have a friend who is helping me out somewhat with the
digital/programming side of it, as my experience is mostly analog.
 
Any help is appreciated.
 
Cheers,
 
Rafael



More information about the Synth-diy mailing list