Go Down

Topic: SOLVED: SSI absolute encoder directly on Arduino Uno (Read 2148 times) previous topic - next topic

szapo

Hello!

I have problems getting data from a Sick AHS36B absolute encoder.
https://www.sick.com/media/pdf/3/43/043/IM0058043.PDF

The encoder is connected via Clock-, Clock+, Data-, Data+ directly to ports 11,12 and 2,3.
For simplicity, I am trying it the direct way without an intermediate line IC.

I am generating a clock with inverted clock- signal and receive the bits coming from Data- and Data+.
Every position package consists of 14 bits Gray encoded with a 15th error bit. With every tick()

But apparently it doesn't work.
From my understanding i should get different combinations of ones and zeros as i turn the rotary encoder's axis, but I only get 15 zeros (or 15 ones if i read from the Data- port) over and over.

I have a second encoder to check for defects, but I get the same result. Even initializing the encoder by putting the SET pin to Vc for 250ms doesn't change it.

Am I missing something important?


Here is the code I have so far:

Code: [Select]

int CLOCKMINUS = 11;
int CLOCKPLUS = 12;
int DATAMINUS = 2;
int DATAPLUS = 3;
int gray[15]; //14 data bits, 1 error bit
int binary[14]; //14 data bits
String datastring = "";


void setup()
{
  pinMode(CLOCKMINUS, OUTPUT); //clock-
  pinMode(CLOCKPLUS, OUTPUT); //clock+
  pinMode(DATAMINUS, INPUT); //data-
  pinMode(DATAPLUS, INPUT); //data+
  delay(500);
  Serial.begin(115200);
}


void loop()
{
    datastring = "";
    for(int i = 0; i<15; i++)
    {
      PORTB = B00010000; //clock tick
      delayMicroseconds(13);
      int b1 = digitalRead(DATAMINUS);
      datastring+=b1;
      PORTB = B00001000; //clock tick
      delayMicroseconds(13);
    }
    Serial.println(datastring);
    delayMicroseconds(16000); //wait for next position bits
  }

szapo

OK, just to share it: I took a MAX490 that did the trick. Using this chip reduces necessary ports to 2: one for clock, one for data.

jessejess

I Know this is a very old post, but does anyone know how to wire the MAX490.
I need to get data from an SSI absolute encoder as well, not getting it to work yet.

Thanks

hda011094

I Know this is a very old post, but does anyone know how to wire the MAX490.
I need to get data from an SSI absolute encoder as well, not getting it to work yet.

Thanks
I have a same question

Go Up