8 bit encoder interface

Go To Last Post
6 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Greetings EveryBody!
I am trying to interface an 8-bit absolute encoder (datasheet attached) with ATMEGA16.
I am trying to read values so that I tried several web links and I searched on the google even but could not find the good way.
Kindly guide me a way how to do ths.

Many Thanks for your kind consideration.

Attachment(s): 

Last Edited: Mon. Apr 21, 2014 - 07:47 AM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

assadmahmood wrote:
(datasheet attached)
No it isn't. But irrespective of that, what have YOU actually done apart from searching for ready made code?

Ross McKenzie ValuSoft Melbourne Australia

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Sorry mistakenly I didnt attach datasheet but now attached in the first one.
secondly i have'nt done anything. I just want to understand the position of the encoder but as I am using 8 bit so it would have 256 positions (means 256 separate codes) would i have to define 256 different codes in AVR for position detection?

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I have looked at the table in the data sheet and see no obvious computable correspondence between position and value output. It seems to me that you need to have a lookup table (LUT) to translate between the output value and position.

E.g. something like

uint8_t position_table[256] = {
   0,    // Output value 0 is not used
   56,   // Output value 1 corresponds to position 56
   40,   // Output value 2 corresponds to position 40
   55,   // Output value 3 corresponds to position 40
   24,   // Output value 4 corresponds to position 24
   0,    // Output value 5 is not used
   39,   // Output value 6 corresponds to position 39
   .
   .
   .
  112,   // Output value 254 corresponds to position 112
    0,   // Output value 255 is not used
}

The usage is easy. Assuming you have the eight pins of the encode attached to PINB you simply

uint8_t position = position_table[PINB];

To not waste RAM you might put this table in flash.

As of January 15, 2018, Site fix-up work has begun! Now do your part and report any bugs or deficiencies here

No guarantees, but if we don't report problems they won't get much of  a chance to be fixed! Details/discussions at link given just above.

 

"Some questions have no answers."[C Baird] "There comes a point where the spoon-feeding has to stop and the independent thinking has to start." [C Lawson] "There are always ways to disagree, without being disagreeable."[E Weddington] "Words represent concepts. Use the wrong words, communicate the wrong concept." [J Morin] "Persistence only goes so far if you set yourself up for failure." [Kartman]

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

GOOGLE: bourns ace

http://www.piclist.com/techref/p...

http://www.krafti.co.uk/steve/bo...
Even if we don't like it, we can share code from PICs

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Many thanks to all of you, Your replies and your kind considerations are very helpful.