Ich versuche verzweifelt einen Absolut Encoder von Wachendorff auszulesen.
Folgende Hardware: Encoder SN75179B RS485
Arduino Mega
Anschlüsse:
A and B to Data+ and Data-
R to receive in arduino input (DI6)
Y and Z to clock+ and clock-
D as arduino output to generate clock (DI5)
Code:
const int CLOCK_PIN = 5;
const int DATA_PIN = 6;
const int BIT_COUNT = 13;
void setup() {
//setup our pins
pinMode(DATA_PIN, INPUT);
pinMode(CLOCK_PIN, OUTPUT);
//give some default values
digitalWrite(CLOCK_PIN, HIGH);
Serial.begin(19200);
}
void loop() {
unsigned long reading = readPosition();
Serial.print("Reading: ");
Serial.println(reading, DEC);
delay(1000);
}
//read the current angular position
int readPosition() {
unsigned long sample1 = shiftIn(DATA_PIN, CLOCK_PIN, BIT_COUNT);
return sample1;
}
//read in a byte of data from the digital input of the board.
unsigned long shiftIn(const int data_pin, const int clock_pin, const int bit_count) {
unsigned long data = 0;
for (int i=0; i<bit_count; i++) {
data <<= 1;
digitalWrite(clock_pin, LOW);
delayMicroseconds(1);
digitalWrite(clock_pin, HIGH);
delayMicroseconds(1);
data |= digitalRead(data_pin);
}
return data;
}
Hallo,
ich hab mit mal den Encoder angesehen, der ist ja für 10-30V geeignet. Mit dem SN Ding willst Du das auf 5V Pegel wandeln, oder wozu soll das sein ? Ich kenne mich mit SSI schnittstelle auch nicht aus, deshalb wäre es erst mal wichtig heraus zubekommen ob die Signale erkannt werden.
Ich hatte beruflich mit Wachendorff zu tun , die sind eigentlich sehr hilfsbereit bei Problemen.
es scheint auch eine Lib zu geben für SSI Schnitstelle .
Wiso wirst Du nicht fündig 66.000 Ergebnisse in 0,5s suchen und filtern musst Du schon selber.
Da Du vermutlich zur you tube Generation gehörts als Einstieg.
laut dem Datenblatt kann der Dncoder auch mit 4.75 -5.5V betrieben werden, benötigt dann jedoch anstatt der 50mA (bei 10VDC-30VDC) 80mA.
Das SN-Dingens wegen dem RS485, denn laut Datenblatt ist der Daten-Output für RS485 Interface.
Ich habe es vor ca. 30 minuten zum laufen gebracht!
Danke für eure Links und motivierenden Worte!
Sobald ich wieder am Rechner bin (Morgen) werde ich euch mitteilen welche Quellen und Angehens-weisen ich verwendet habe.