MartinViljoen Posted September 4 Share Posted September 4 I have a web front end that runs on an ESp32 and want to populate some values from the inverter , The TX and RX pins on the ESP32 is connected to a serial converter which is connected to the inverter's DB9 port. I dont know how to request data and the documentation is not clear to me. From the documentation i have this. function code Function code type explain remark 0x03 Public function code Read the register Contains reads to a single register and multiple registers 0x10 Public function code write the register Contains writes to a single register and multiple registers 2.6.1(0x03) 2.6.1 read register (function code: 0x03) 1 PDU Request the PDU data structure data length data range function code 1 1 byte 0x03 Starting register address 2 2 byte 0x0000~0xFFFF Number of registers 2 2 byte 0x0001~ 0x007D 2 PDU Normal response PDU 2.6.1 read register (function code: 0x03) data structure data length data range function code 1 1 byte 0x03 byte count 1 1 byte N×2 Register values N×2 N×2 byte N= Note: N= number of registers 3 PDU Abnormal response PDU 107 3 PDU Request to read out three consecutive register values starting at address 107 (describe PDU only) : request normal response exceptional response field name ● field value field name field value field name field value function code 0x03 function code 0x03 wrong code 0x83 Hi Starting address Hi 0x00 byte count 0x06 exception code 0x04 Lo Starting address Lo 0x6B [107]Hi Register [107] Hi 0x02 Hi Number of registers Hi 0x00 [107]Lo Register [107] Lo 0x2B Lo Register number Lo 0x03 [108]Hi Register [108] Hi 0x00 [108]Lo Register [108] Lo 0x00 [109]Hi Register [109] Hi 0x00 [109]Lo Register [109] Lo 0x64 I tried sending some hex values to it but I dont get any response from the inverter it remains dead quiet. Tried sending the below byte message[] = {0x03, 0x06}; Serial.write(message, sizeof(message)); and also Serial.write(0x03); Serial.write(0x06); server.send(200, "text/plain", "message sent"); I tested and made sure that the ESP32 tx/rx pins are the correct way around, by sending data back and forth using an USB-RS232 cable and putty. ESP and pc receives the data fine and the baud rate is correctly set to 9600 I'm convinced I'm not sending the correct request data. Anyone care to assist ? Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.