View previous topic :: View next topic |
Author |
Message |
Nick Guest
|
Incremental encoder using 2 bit gray code question |
Posted: Mon Aug 30, 2004 4:30 pm |
|
|
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
|
|
Posted: Mon Aug 30, 2004 4:38 pm |
|
|
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
|
|
Posted: Mon Aug 30, 2004 4:45 pm |
|
|
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
|
|
Posted: Mon Aug 30, 2004 4:48 pm |
|
|
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
|
|
Posted: Mon Aug 30, 2004 4:48 pm |
|
|
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
|
|
Posted: Mon Aug 30, 2004 5:34 pm |
|
|
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
|
|
|
Nick Guest
|
|
Posted: Mon Aug 30, 2004 8:16 pm |
|
|
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
|
Absolute Rotary encoder |
Posted: Mon Aug 30, 2004 8:43 pm |
|
|
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. |
|
|
|