Hi,
I'm currently working on the following project:
I want to send and receive data to a Piezo driver via RS485.
For that purpose, I use this hardware:
- MKR 1010 Wifi
- MKR 485 Shield
- PMD401 Controller (Manual: https://piezomotor.com/wp-content/uploads/2019/03/150025_PMD401_Technical_Manual.pdf)
- Piezo LEGS Motor
The MKR 485 Shield is connected like that to the PMD401:
Y to Data+
Z to Data-
GND to GND
And jumper positions
- FULL set to OFF
- Z // Y set to ON
And here is my code:
#include <ArduinoRS485.h>
void setup() {
RS485.begin(115200);
Serial.begin(115200);
RS485.receive();
}
int counter = 0;
byte rx_byte = 0;
void loop() {
Serial.print("Count No: ");
Serial.println(counter);
RS485.beginTransmission();
RS485.write("X1J20,0,150\r");
RS485.write("X1E\r");
Serial.flush();
delay(500);
while (RS485.available()) {
// get a byte RS485
rx_byte = RS485.read();
// send the byte to the Monitor
Serial.write(rx_byte);
}
RS485.endTransmission();
Serial.println(" ");
delay(10000);
counter ++;
}
And the output from the terminal:
Count No: 1
X1J20,0,150X1E
Count No: 2
X1J20,0,150X1E
Count No: 3
X1J20,0,150X1E
What I don't understand is the following:
If I send the command
RS485.write("X1J200,0,200\r");
The motor runs. -> so sending works, I think.
But if I send that command (like it is written in the manual page 2, point 7)
RS485.write("X1E\r");
I get no feedback at all. (like you see in the terminal)
So what do I have to do, that the Controller gives me feedback from the encoder? I tried a lot of different commands from the manual, but nothing works....
It just reads the last sent commands.