
Visit our shop for nerds in control lifestyle products.
- PC reliability?
- Windows, real time
- PID loops
- PCs vs. PLCs
- Replacing people
- MS 'monopoly'?
- Software quality
- Where do we go from here?
- Why pay?
Don't even try to understand,
Just find a place to make your stand,
And take it easy.
-- The Eagles, "Take It Easy"
www.control.com/rss
My factory purchase some Siemens Sentron PAC power meters. We would like use it to monitor several panels we have.
The operating manual mentioned that the device uses Modbus TCP as its communication protocol, and also mentioned some Modbus commands to deal with.
Now we are going to create a Visual Basic program to read the measurement from a PC. To do this, I have read some literature on Visual basic Winsock control and Modbus protocol. But now there are some questions in my mind.
I have nither experience nor knowledge on Modbus so would you mind to help answer some questions below?
On Modbus commands (0x03,0x04, 0x10), what does "x" mean?
On the Sentron PAC manual, they inserted a table of communication parameters. On this table there are "Offset" and "Number of Tabs" Columns, what should I do with data on each column?
I have read some web site talking about OPC servers. Is this software to manage a database like SQL server?
Am I on the right track using Winsock to create an "Ethernet base" connection from VB 6 program?
Thank you for all of your kindness to help.
Irwan_Grahadian @ Telkom. net
Having numbers written as "0x03,0x04," or "0x10" is not normal Modbus convention. It is however common programming convention in most programming languages for expressing hexadecimal numbers. So, their equivalent in normal decimal would be 3, 4, and 16.
Modbus commands are called "functions". The functions are numbered 1, 2, 3, 4, etc. The function numbers you referred to above do the following. 3 is "read holding registers". 4 is "read input registers". 16 is "write multiple registers".
The Modbus protocol classifies device memory as discrete inputs, coils (both of these being bit addresses), input registers, and holding registers (both of these being 16 bit integers). The addresses themselves are simply numbered from 0 to 65,535 for each type of address (although the actual address range in your meter may be much smaller). Note that this is how the Modbus *protocol* numbers addresses. Some people do things at the application level such as offset the numbers by one, or add a numerical prefix to indicate which memory type they are referring to. Neither of these is part of the Modbus protocol standard itself though.
How your power meter uses these addresses was up to the power meter designer. You will have to read the manual to find out what addresses to read and/or write.
An "OPC server" is a type of communications protocol driver. OPC is an industry trade organisation that came up with a common interface to protocol drivers. OPC servers can be quite complex as it is a generalised interface with a lot of features (most of which you won't need).
You can buy OPC servers (drivers) for the Modbus/TCP protocol which you can interface to your VB program. However, since Modbus is actually an open protocol (unlike many others in industry), there are many alternative drivers as well which don't use an OPC type interface.
You probably only need to open an Ethernet socket connection if you are writing your own driver. If you are using an off the shelf driver (OPC or a Modbus/TCP library), then that driver should take care of opening its own socket.
Hi,
I have had several projects using similar devices that uses Modbus protocol and the minimum requirements were to use VB6. Rudolf R-DPA and Genius Power Meters were the devices used.
Just to get you started.
VB6 format for modbus protocol:
slave address, function code, data, crc
Example:
---------------------------
| 05 | 03 | 03 | 00 | crc |
---------------------------
where:
05 = slave address
03 = function code (holding registers)
03 = 0300 hex addr of the value for the meter
00 =
crc = modbus crc format
temp = chr("&H"+"05") + chr("&H"+"03") + chr("03") + chr("&H"+"00") + chr("&H"+ crc_highbyte) + chr("&H"+ crc_lowbyte)
then send the temp to the winsock if using Modbus TCP.
Note:
You could uses Modbus RTU using serial comm
by using a device server from Moxa.
You can get in touch with me if you need more detailed example for a Modbus implementation.
I could also give you some codes to produce the Modbus CRC in VB implementation.
Cheers!
alvan_basco @ yahoo. com. ph
- OPC: Painless migration, classic OPC DA to OPC UA, partership
- Easier: panel designs, short-circuit current rating compliance
- MechatronicsZone road show kicks off
- ODVA, DeviceNet: New CIP specs; ControlNet added; 2009 meeting
- Partnership: Advanced, interoperable motion control, machine tools
- Protect intellectual property: Encrypt firmware, control code
- Embedded, wireless devices, dynamic IP routing
- Portable computing: Operators can be mobile with rugged HMI
Users of this site are benefiting from open source technologies, including PHP, PostgreSQL and Apache. Be happy.
Patronize our advertisers!



