Open yuguifly opened 3 years ago
I see 19200 in the plc serial configuration and 9200 in your code...
sorry, I've put wrong in the post, I had 19200 on the test
Hello I solved the problem... the plc`s documentation is wrong!!!! I have to read a position less... the register 511D is 511C,
Can you please tell your wiring? I'm trying to use arduino uno with Max485 but all I keep getting is 226
Can you please tell your wiring? I'm trying to use arduino uno with Max485 but all I keep getting is 226
Try to wire TX to TX and RX to RX.
Can you please tell your wiring? I'm trying to use arduino uno with Max485 but all I keep getting is 226
Did you able to solve the problem?
Hello, I'm trying communicating with a PLC with this library but I get a bad data and I don't know what is wrong. the image 1 is PLC configuration, the image 2 first line is the data I want recived, the image 3 is the documentation where this data are and this is the code I
m using to comunicate with PLC and the response I
m getting. Some one could help me, I'he tried a lot of things but I don't what's the problem. Thank you.CODE
define MAX485_DE 3
define MAX485_RE_NEG 2
// instantiate ModbusMaster object ModbusMaster node;
void preTransmission() { digitalWrite(MAX485_RE_NEG, 1); digitalWrite(MAX485_DE, 1); }
void postTransmission() { digitalWrite(MAX485_RE_NEG, 0); digitalWrite(MAX485_DE, 0); }
void setup() { pinMode(MAX485_RE_NEG, OUTPUT); pinMode(MAX485_DE, OUTPUT); // Init in receive mode digitalWrite(MAX485_RE_NEG, 0); digitalWrite(MAX485_DE, 0);
Serial.begin(19200,SERIAL_8E1);
// Modbus slave ID 1 node.begin(49, Serial); // Callbacks allow us to configure the RS485 transceiver correctly node.preTransmission(preTransmission); node.postTransmission(postTransmission); } bool state = true;
void loop() { uint8_t result; uint16_t data[6];
// Read 16 registers starting at 0x3100) result = node.readHoldingRegisters(0x511D, 2); Serial.println("---- ENTRADA 1 ----"); if (result == node.ku8MBSuccess) {
}
delay(1000); }
Response 1Q A---- ENTRADA 1 ---- Valor de REG1q: 52429 Valor de REG2: 16649