Reading data from an absolute encoder EPM50S8-1013-B-S-24 using Mega 2560

These are the detailed queries on the Absolute rotary encoder ( EPM50S8-1013-B-S-24 ) . Below I attached the datasheet of the encoder.

ENCODER NUMBER: EPM50S8-1013-B-S-24
ENCODER TYPE: MULTI-TURN ABSOLUTE ENCODER
OUR EXPERIENCE WITH ABSOLUTE ENCODER
· Connected encoder with Arduino
· Supplied 14v to the encoder
· Generated clock pulse of frequency 313KHz
· Clock + and Clock – pulses are shifted by 90 degrees with 5v supply from Arduino board
· Read output from Data+ and Data- pins through an oscilloscope
· Tried to digitally read from data pins. But the output was random 0s and 1s irrespective of encoder position.
· Tried to read analog values from the data pins. But the output was random.
· Tried to use counter concept (increase if rotated CW and decrease if rotated CCW). But it resulted in frequent increments of counting.
· Tried to use a bitwise shift concept. But it failed
· Tried to use the encoder library which was available in Arduino. It also doesn’t work

image.png

OUTPUT OBTAINED FROM DATA+ & DATA-
image.png

DOUBTS
· Is there any circuit connection diagram to connect the absolute encoder to any microcontroller?
· Is there any working code for this encoder with arduino?
· How to read values from data pins?
· Does it work like a counter or sends position value?

We didn’t get support from the encoder manufacturer for configuring with Arduino as they said they have only experience with PLC. Thanks in advance.

EPM50S_EN_MA_1800821_W.pdf (394 KB)

My best guess:
Connect Clock- and Data- to Arduino Ground.
Connect Clock+ to an Arduin data pin
Connect Data+ to an Arduino data pin

const byte ClockPin = 2;
const byte DataPin = 3;


void setup()
{
  Serial.begin(115200);
  
  pinMode(ClockPin, OUTPUT);
  digitalWrite(ClockPin, HIGH); // Clock idles HIGH
  pinMode(DataPin, INPUT);
}


unsigned long ReadEncoder()
{
  unsigned long encoderData = 0;


  digitalWrite(ClockPin, LOW);
  digitalWrite(ClockPin, HIGH);
  for (int i = 0; i < 24; i++)
  {
    encoderData <<= 1;
    digitalWrite(ClockPin, LOW);
    encoderData |= digitalRead(DataPin);
    digitalWrite(ClockPin, HIGH);
  }
  return encoderData;
}


void loop()
{
  unsigned long enc = ReadEncoder();
  
  if (enc & 0x00800000) // Bit 24 is the overflow bit
  {
    Serial.println("Overflow");
  }
  else
  {
    float revolutions = enc / 1024;
    Serial.println(revolutions, 4); // Display to 4 decimal places
  }
  delay(500);
}