• Page:
  • 1
  • 2

TOPIC: C++ Builder Modbus CodeExample

C++ Builder Modbus CodeExample 6 months 1 week ago #13540

Hi guys,
I need to read Modbus data 0x03.
I need any code sample for try. :)

Thanks in advance.

Please Log in or Create an account to join the conversation.

C++ Builder Modbus CodeExample 6 months 1 week ago #13546

Hi Marcos,

Modbus is a vague term here: Do you need Ascii modbus or binary (RTU) modbus? Are you using serial port (RS232 or RS485) or ethernet? Are you running on a Windows PC?

The modbus serial spec specifies time delays as part of the protocol. These are not always easy to guarantee when running on windows. In practice it is rarely a problem provided you are using a specific bit of hardware and are running on a specific PC.
Hope this helps, Regards, Roger
The following user(s) said Thank You: Marcos

Please Log in or Create an account to join the conversation.

C++ Builder Modbus CodeExample 6 months 1 week ago #13548

Hi Roger,

ooohh Sorry, Im using ModBus TCP, I running code in Windows, I need recived data from Scheneider ION Electrical Meter.

Regards,
Marcos

Please Log in or Create an account to join the conversation.

C++ Builder Modbus CodeExample 6 months 6 days ago #13556

Hi Marcos,
I have never actually worked with Modbus over TCP/IP but I believe it is the same underlying protocol with just a different transport medium (ie TCP/IP rather than RS232/RS458).
I am also unsure if both forms of modbus are supported over TCP/IP - you will need to study the Schneider manual to establish this. My guess is that it is likely to be the binary (RTU) form of modbus.

There is some stuff on the web re: using modbus RTU over serial connection to connect to temperature controllers made by CAL Controls. This might be a starting point for you. If you use this it would be polite to acknowledge S. Hammond in your source code comments!
S.Hammond

www.thermoelectric.com/2010/manuals/pdf/TC-3300-modbus.pdf

ppewww.physics.gla.ac.uk/~batesr/ATLAS/P...AL%20Poll/ModBus.cpp

ppewww.physics.gla.ac.uk/~batesr/ATLAS/P.../CAL%20Poll/ModBus.h

Do let me know how you get on.....

Regards, Roger

Please Log in or Create an account to join the conversation.

C++ Builder Modbus CodeExample 6 months 4 days ago #13587

Hi Roger,

Something of this code will serve me, especially the function of the CRC. Many Thanks,
Thanks S.Hammond too

You know how to send by TCP port 502 this?

char buffer [256];

buffer [0] = 0x00;
buffer [1] = 0x03;
buffer [2] = 0x00;
buffer [3] = 0x00;
buffer [4] = 0xAF;
...

I need to write the buffer in Hex, in the socket.

I do not know if the Write function of TCPClient is correct

Thank in advance
Marcos

Please Log in or Create an account to join the conversation.

C++ Builder Modbus CodeExample 6 months 21 hours ago #13616

Hi Marcos,
I have successfully used the Indy components for TCP/IP comms.
In particular use TIdTCPClient and methods Connect(), Disconnect() and functions in IdTCPClient->IOHandler for the actual i/o.
Let us know how you get on.
Regards, Roger

Please Log in or Create an account to join the conversation.

  • Page:
  • 1
  • 2
Moderators: April Anne