CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to CCS Technical Support

Incremental encoder using 2 bit gray code question

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
Nick
Guest







Incremental encoder using 2 bit gray code question
PostPosted: Mon Aug 30, 2004 4:30 pm     Reply with quote

I have an increment encoder I'm about to start using with CCS, I have a question about these. If the electronics is turned off and the nob is moved, the pic will not know I.E. position any more. Is this correct?


Nick
newguy



Joined: 24 Jun 2004
Posts: 1907

View user's profile Send private message

PostPosted: Mon Aug 30, 2004 4:38 pm     Reply with quote

Right. Therefore if you need to remember where the knob was, you either need a pic with an internal eeprom, or you need an external eeprom. Considering the rather short rated life of the pic's internal eeprom (about 10,000 write cycles if I remember correctly), it would probably be best to go with an external eeprom. Small ones (about 128 bytes) are very inexpensive, if you have lines on the pic to spare to communicate with it.
Nick
Guest







PostPosted: Mon Aug 30, 2004 4:45 pm     Reply with quote

thats is going to be a bad problem, dang it.


I need a solution that is avalible even if the knob has been turned when its off. I dont want to go with a POT, but it might be a good solution.

Thanks for the info,
Nick
rnielsen



Joined: 23 Sep 2003
Posts: 852
Location: Utah

View user's profile Send private message

PostPosted: Mon Aug 30, 2004 4:48 pm     Reply with quote

If the PIC is turned off it will most likely not have any idea what position the encoder is in. There will most likely be variables that will be used to track the position and once the PIC loses power those variables will be cleared on power-up, unless they are stored in some sort of non-volatile memory like the onboard eeprom. But then, like you said, if the encoder is moved while the PIC is powered down it will have no idea it has moved. If you need to know an absolute position the encoder will need to be rotated until a 'home' pulse is detected and then the PIC can track the position from there.

Say, if you had a radio that used an encoder, instead of a POT, to adjust the volume. You wouldn't necessarily need to know the position of the encoder. You would simply want to know if it's been turned while the power was on. If you DO want to know what the position is, at all times, then you would need to ensure that the PIC circuit was powered up at all times. Otherwise, you would lose those pulses. Clear as mud?

Ronald
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Mon Aug 30, 2004 4:48 pm     Reply with quote

For 16F628, the data EEPROM has a minimum endurance of 1M cycles
and a typical endurance of 10M, according to the data sheet.
Though, they admit these numbers are not tested.
Nick
Guest







PostPosted: Mon Aug 30, 2004 5:34 pm     Reply with quote

that sounds great for volume control, but horrible for my situation.

Is there a type of encoder that outputs normal binary code? So that I dont have worry about if someone moves the knob while the power is off.

Nick
Kenny



Joined: 07 Sep 2003
Posts: 173
Location: Australia

View user's profile Send private message

PostPosted: Mon Aug 30, 2004 5:55 pm     Reply with quote

Absolute position optical encoders would do the job but are quite expensive.
Contacting ones are much cheaper. This one is cheap, even from Farnell:
http://www.bourns.com/pdfs/ACE.pdf

Maxim make non-volatile pots that save the last position at powerdown.
Not suited to your situation perhaps but FYI
An example is
http://www.maxim-ic.com/quick_view2.cfm/qv_pk/4092
Nick
Guest







PostPosted: Mon Aug 30, 2004 8:16 pm     Reply with quote

I recall the older pots go bad after awhile, do the newers still do this? the the old car steroe knobs.


Nick
dyeatman



Joined: 06 Sep 2003
Posts: 1933
Location: Norman, OK

View user's profile Send private message

Absolute Rotary encoder
PostPosted: Mon Aug 30, 2004 8:43 pm     Reply with quote

Since we dont know your application or requirements, heres a CTS grey code unit that is only $3.50 ea that may work for you:

http://rocky.digikey.com/WebLib/CTS/Web%20Data/288%20Series.pdf

This one is 16 positions per 360 rev. You can get some with 24 positions and higher. CTS also makes binary output versions.

One other option you might try is the position encoder for an inkjet printer. You can usaully find a scrap one around somewhere. Some of those are absolute encoders.
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group