How to use the Rotary Encoder to control the cs3310 ? - diyAudio
Go Back   Home > Forums > Source & Line > Digital Source

Digital Source Digital Players and Recorders: CD , SACD , Tape, Memory Card, etc.

Please consider donating to help us continue to serve you.

Ads on/off / Custom Title / More PMs / More album space / Advanced printing & mass image saving
Reply
 
Thread Tools Search this Thread
Old 23rd July 2007, 06:51 PM   #1
cac liu is offline cac liu  China
diyAudio Member
 
Join Date: Apr 2005
Location: ShenZhen China
Default How to use the Rotary Encoder to control the cs3310 ?

I want to use the Rotary Encoder to control the cs3310,but I don't known how to use the Rotary Encoder,Could anyone help me?
  Reply With Quote
Old 23rd July 2007, 06:59 PM   #2
diyAudio Member
 
jan.didden's Avatar
 
Join Date: May 2002
Location: Great City of Turnhout, Belgium
Blog Entries: 7
You would need to use a microcontroller to decode the rotary control pulses and to write to the CS3310 registers. Have you ever done anything with microcontrollers?

Jan Didden
__________________
If you don't change your beliefs, your life will be like this forever. Is that good news? - W. S. Maugham
Check out Linear Audio!
  Reply With Quote
Old 23rd July 2007, 07:10 PM   #3
cac liu is offline cac liu  China
diyAudio Member
 
Join Date: Apr 2005
Location: ShenZhen China
I just know about the 89s51(mcs51)

I want to use to 89s51 to connect Rotary Encoder
  Reply With Quote
Old 23rd July 2007, 07:16 PM   #4
diyAudio Member
 
analog_sa's Avatar
 
Join Date: Aug 2002
Location: Sofia
Quote:
Originally posted by cac liu
I just know about the 89s51(mcs51)

I want to use to 89s51 to connect Rotary Encoder

Use it if you want. Probably an overkill but will certainly do the job.
  Reply With Quote
Old 23rd July 2007, 07:18 PM   #5
cac liu is offline cac liu  China
diyAudio Member
 
Join Date: Apr 2005
Location: ShenZhen China
but how to write the program???
  Reply With Quote
Old 23rd July 2007, 07:20 PM   #6
diyAudio Member
 
jan.didden's Avatar
 
Join Date: May 2002
Location: Great City of Turnhout, Belgium
Blog Entries: 7
You only need two input lines. Here's a bit of documentation from a project I did once:

;--------System design notes-------------------------------------
;
; The encoders output a 2-bit value:
; the A-bit signals rotation,
; the B-bit signals the direction of rotation.
; encoder movement is detected by polling and debouncing in the b-port.
;
;CW channel A ___ ___ ___ [channel A leads channel B]
; ___| |___| |___|
;
; channel B ___ ___ ___
; |___| |___| |___|
;
;
;
; CCW: channel A ___ ___ ___ [channel A trails channel B]
; ___| |___| |___|
;
; channel B ___ ___ ___
; __| |___| |___|
;
; A-bit B-bit Direction
; 0>1 0 CW
; 1 CCW
; 1>0 0 CCW
; 1 CW

You poll the A-bit (or hang it on an interrupt line) and then check the B-bit for direction of rotation. Ther's probably a ton of other ways to do this, this happened to work for me.

Edit: I realize the formatting is screwed up, if needed I can email it to you.

Jan Didden
__________________
If you don't change your beliefs, your life will be like this forever. Is that good news? - W. S. Maugham
Check out Linear Audio!
  Reply With Quote
Old 23rd July 2007, 07:32 PM   #7
cac liu is offline cac liu  China
diyAudio Member
 
Join Date: Apr 2005
Location: ShenZhen China
I had try to write some,but it has dithering,so it is not steady

Could you send me the program you had write for MCS51 , I want

to have a reference.

my mail box is cacworld@126.com
  Reply With Quote
Old 23rd July 2007, 07:36 PM   #8
diyAudio Member
 
jan.didden's Avatar
 
Join Date: May 2002
Location: Great City of Turnhout, Belgium
Blog Entries: 7
You have to debounce the bits. At the moment the switches close/open they bang around some time, depending on the quality of the encoder, but they all do it. So once you detect bit change, you wait a couple of milliseconds (I forgot exactly how many, it's trial and error and depends as I said on the type/brand of encoder), then after the delay you check the bit values and do your processing.

Edit: I think I used 6 msec debounce. Can't take too long, else you miss some pulses if someone turns it real fast...

Jan Didden
__________________
If you don't change your beliefs, your life will be like this forever. Is that good news? - W. S. Maugham
Check out Linear Audio!
  Reply With Quote
Old 23rd July 2007, 07:51 PM   #9
cac liu is offline cac liu  China
diyAudio Member
 
Join Date: Apr 2005
Location: ShenZhen China
I think I start to understand what you have just say.

I get to try again !

Could you send me your program to me to be referance?

Thank you very much !!!
  Reply With Quote
Old 24th July 2007, 10:46 AM   #10
diyAudio Member
 
jan.didden's Avatar
 
Join Date: May 2002
Location: Great City of Turnhout, Belgium
Blog Entries: 7
Quote:
Originally posted by cac liu
I think I start to understand what you have just say.

I get to try again !

Could you send me your program to me to be referance?

Thank you very much !!!

I'm sorry but there is no 'program' to speak of...
It depends on the microcontroller you use, in 'meta-speak', you can do (with polling):

- see if the A bit is different from last time you looked;
- if yes, wait the debounce period;
- test the A-bit status (one or zero);
- test the B-bit status;
-depending on one of the four combinations, go to a routine to do whatever you want to do as action to the encoder movement.

I did this in a PIC and it is just a bunch of bittest and goto statements, but embedded in the program so I can't really send it to you.

But if you understand the process it should be a no-brainer.

Jan Didden
__________________
If you don't change your beliefs, your life will be like this forever. Is that good news? - W. S. Maugham
Check out Linear Audio!
  Reply With Quote

Reply


Hide this!Advertise here!
Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
nice rotary encoder for audio? h_a Parts 4 14th February 2009 10:43 AM
Rotary encoder instead of buttons robmil Parts 11 16th April 2008 05:30 PM
Optical Rotary Encoder Volume Control unit using the Grayhill 62P DJ Exprice Everything Else 17 1st January 2008 08:50 PM
Rotary Encoder. Need help very much! vytas Digital Source 11 23rd November 2005 12:47 PM
Digital rotary encoder rho Parts 17 3rd December 2003 03:39 PM


New To Site? Need Help?

All times are GMT. The time now is 12:44 AM.


vBulletin Optimisation provided by vB Optimise (Pro) - vBulletin Mods & Addons Copyright © 2014 DragonByte Technologies Ltd.
Copyright 1999-2014 diyAudio

Content Relevant URLs by vBSEO 3.3.2