Encoder usdigital ak

Hola,
Alguien que tenga expertise con el encoder a2k de usdigital (https://www.usdigital.com/products/encoders/absolute/kit/a2k/), intento realizar la comunicación, pero solo tengo FF cómo respuesta. Ya pude comunicar rs485 de python a Arduino, pero no puedo recibir nada del encoder.

También he intentado comunicarme o leer el encoder sar-ml50a de Nikon, pero no logro comunicarme en absoluto.

Muchas gracias por su atención

El código es el siguiente:
#define RX 19 //For Arduino Mega
#define TX 18

//#define RxTx 3
#define Re 3
#define De 5

#define Transmit HIGH
#define Receive LOW

#define Pin13LED 13

uint8_t byteIn;
int byteOut;

void setup() /****** SETUP: RUNS ONCE ******/
{
Serial.begin(9600);
while (!Serial) {
; // wait for serial port to connect. Needed for native USB port only
}
Serial.println("Serial ready for transmitting");

pinMode(Pin13LED, OUTPUT);
pinMode(Re, OUTPUT);
pinMode(De, OUTPUT);

//digitalWrite(RxTx, Receive); //Initialize transciever to receive data
RS485Receive();

Serial1.begin(9600); // set the data rate

}//--(end setup )---

void loop() /****** LOOP: RUNS CONSTANTLY ******/
{
digitalWrite(Pin13LED, HIGH); //On when not transmitting
if (Serial.available())
{
Serial.println("Sent"); //Serial indicator
byteOut = Serial.read(); //Locally store the transmitted string

RS485Transmit(); 
Serial1.write(byteOut);      // Send byte to encoder

digitalWrite(Pin13LED, LOW);      // Off momentarily 
delay(10);
RS485Receive();
delay(250);    

}

if (Serial1.available()) //Look for data from encoder
{
Serial.println("Received");
digitalWrite(Pin13LED, LOW); // Off momentarily
byteIn = Serial1.read(); // Read received byte
Serial.println(byteIn);
delay(10);
}
}

void RS485Transmit()
{
digitalWrite(Re, LOW);
digitalWrite(De, HIGH);
}

void RS485Receive()
{
digitalWrite(Re, HIGH);
digitalWrite(De, LOW);
}

No tengo el esquema, pero las conexiones son:
Un adaptador de TTL a rs485 en los pines definidos para rx, tx y RE, DE, de ahí se conecta al encoder con RS485, el cable A va a DataL, y el cable B va a DataH.

PD: Incluso probamos cambiando el orden de A y B por si estaba mal, pero no ayuda en el comportamiento

Por favor edita tu post y adjunta el código de acuerdo a las Normas del Foro en Español, punto 7. También usa la opción "Autoformato" del menú "Herramientas" de la IDE antes de copiar el código así nos facilitas su lectura.

También adjunta el esquema de conexiones, no hace falta que lo hagas con Eagle, EasyEDA, etc., con una buena foto de un esquema hecho a mano es suficiente, no somos quisquillosos siempre que se entienda.

Luego de editar el código como se te ha pedido busca en la lupa arriba derecha porque creo recordar que este enconder fue presentado como problema similar hace un tiempo.

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.