Hello.
I am trying to test this inductive ring encoder on an Arduino Uno, but so far I've only gotten zeros as output, so I'm worried that I'm doing something seriously wrong.
The model number of the encoder is INC-3-150-111001-SPI1-AFL1-24-AN
Also, here is the datasheet for this product line
Most of my reliance has been on page 29, showing the wires, and pages 43 and 45, showing the SPI information.
I'm not the most knowledgeable about SPI, but it's weird not seeing any sort of register address or MOSI being mentioned, so I'm wondering if my setup here in the code is okay. My biggest questions are about all the timing. I included some small delays trying to stick with the charts in the datasheet, but I don't know if those even help or are implemented right.
Right now, my main concern is just getting reasonable data from the encoder, since I'm pretty sure I know how to interpret the 11 position bits once I get them.
Any help with this would be appreciated.
Also, here is my most recent code below
#include <SPI.h>
#define SS 10
uint8_t readbyte[6];
void setup() {
// put your setup code here, to run once:
Serial.begin(115200);
pinMode(SS, OUTPUT);
digitalWrite(SS, HIGH);
SPI.begin();
SPI.setClockDivider(SPI_CLOCK_DIV32);
SPI.setBitOrder(MSBFIRST);
SPI.setDataMode(SPI_MODE2);
delayMicroseconds(100);
}
void loop() {
// put your main code here, to run repeatedly:
digitalWrite(SS, LOW);
uint8_t val = 0x00;
for (int k=0; k <= 5; k++){
readbyte[k] = SPI.transfer(val);
delayMicroseconds(5);
}
digitalWrite(SS, HIGH);
for (int a = 0; a <= 5; a++){
Serial.print(readbyte[a]);
}
Serial.println("");
delayMicroseconds(30);
}