To implement Modbus Poll

S

Thread Starter

sonainv

Hi all

I am trying to implement a Modbus poll command to query the registers of the Energy meter which communicates using RS485 using Modbus RTU protoco.

I am able to successfully generate the command to query the function holding registers of an energy meter.
The command consists of (Slave id,function,address,Databytes and CRC checksum).

I am sending the data to the energy meter through a RS232-RS485 interface.

I am sending the data 8bytes in one message without any delay between the bytes.

But I am not getting any response from the device.

My serial port settings and the Energy meter settings are matching.

Kindly give me your inputs to achieve this.

The whole code is written in c and using Evc++ serial port handler functions for sending the data to the meter.
 
Try to get a ModBus Slave simulator, and test your code. Also you could get a ModBus Master simulator and test if your energy meter ModBus functions.

Feel free to contact me at autcon20ATyahooDOTcomDOTar
 
Hello,

Download the serial slave simulator from http://www.peakhmi.com and verify your code.

If it works the problem is in the meter. If it does not work the problem is in your code or the hardware.

Remove the 232<->485 device and go 232<->232. If it works the hardware is the problem.

If it does not work then your code is the problem or your 232 wiring.

Good luck,

Mark
http://www.peakhmi.com
 
Check your slave address.Also check the energy meter with the RS232-RS232 communication then the modbus cable. Use the Mb simulator to test the program.

thanks

Colman
 
S
Hi all,

Thanks for your replies and suggestions.

I have tested the Power meter using the Modbus poll simulator downloaded from modbustools.com

Using the Modbus poll I'm able to communicate with my meter. But I am unable to do the same with my code.

I'm sending the following command to the meter:

1. To poll the slave id 12 and function number 17 (diagnostic)

I am sending the command like last two bytes are CRC checksum.

0C11C4BC

2. To query the data in the specific register,
my address starts from 30001 and slave id is 12 and function number is 04.

0C04753100017B14

I am sending the data using the serial port communication.
 
Hello,

Good. The meter works. Get the slave simulator I mentioned and try your code against it.

It will display the bytes the simulator receives and parse the message. If the CRC is bad it will tell you.

Good luck,

Mark
http://www.peakhmi.com
 
Top