How do you program modbus channels?
Programming Modbus ChannelsBackground
Modbus is an application layer messaging protocol that provides client-server communication between devices connected on different types of buses and networks. It is similar to RS-485, and has been a standard industrial protocol since 1979 when Modicon introduced the protocol in its PLCs (Programmable Logic Controller). Schneider Electric now owns Modicon.
Modbus is a request/reply protocol and offers services specified by function codes. These function codes are elements of the Modbus request/reply protocol data units (PDUs).
There are three categories of Modbus:
•Modbus Serial – Either Modbus ASCII or Modbus RTU
•Modbus ASCII – Each eight-bit byte in a message is sent as two ASCII characters. The main advantage is that it allows time intervals of up to one second to occur between characters without causing an error.
•Modbus RTU – Each eight-bit byte in a message contains two four-bit hexadecimal characters. The main advantage is its greater character density allows better data throughput than ASCII for same baud rate.
•Other Serial Modbus – Several manufacturers have made modifications to the Modbus protocol to meet their specific application needs; these would include a Modbus Daniels, Modbus Omniflow, Modbus Tek Air and others.
Modbus RTU is the standard used by the Modbus channel in CBAS. In order to use this channel, an add-on license must be purchased for each site. This will enable you to program as many Modbus RTU channels as you need at the site, so you don’t have to put all Modbus devices on the same channel.
When first added to CBAS in January of 2003, the Modbus channel was only intended for use with Veris Hawkeye 8035 and 8036 meters. If you program a Modbus channel in CBAS, you will find these in the list of controllers to add to the channel. For more information, see the December 2004 issue of Computrols’ Automate newsletter.
Most Modbus devices on the market offer a choice between 4-wire and 2-wire communications. Just like a RS-485 channel, a Modbus RTU over RS-485 channel uses two wire communications, which is a misnomer because it uses 3 wires: +, -, and shield.
Because all Modbus RTU devices use the same standards and we were getting requests to add more and more devices to the channel, it was only natural to add a new controller to the channel. With CBAS version 2.0.1, the Modbus Generic controller type was added to the channel to handle any and all of these requests. Since then, many different manufacturers’ equipment has been programmed using this controller type. Until recently, the channel had a limit of 64 addresses that could be programmed. As of CBAS version 2.2.4, up to 255 addresses can be programmed.
Modbus Generic Programming
Each Modbus controller on the market has a list of points that are available to be monitored. You don’t have to monitor all of them, but for each one that you want to monitor, you will need 2 pieces of information: Modbus Register or Position, and Modbus Data Type or Range. This information can be obtained from the equipment manufacturer or dealer, and can often be found on their website.
To add a Modbus RTU channel, in Hardware View:
1.Locate the controller that will be acting as the Modbus host.
2.Click on the controller and click Channels.
3.Click on “Add a Channel” next to RS-485 Host or RS-485 Secondary.
4.Give the channel a descriptive name and choose Modbus RTU over TCP/IP for the configuration.
5.Click Add Channel Now.
To add the controllers to the channel:
1.Right-click twice and locate the Modbus channel you just created.
2.Click on the channel, click Controllers, and locate the line that has the address that you want to give the Modbus device.
3.Click Add a Modbus Controller on that line and give the controller a descriptive name. Choose the Generic Modbus controller from the list under “Select Configuration”.
4.Click Add Controller Now and you are finished.

To add points to the controller:
1.Click on the controller and click Points. You will see Add a Modbus Point.
2.Add the points you want to use by clicking on Add a Modbus Point and giving each point a descriptive name. If you have more than one Modbus controller, you will want to include the name of the controller in the point’s name.
3.Choose a configuration type from the list.
4.Click Add Point Now!
To configure the points:
1.Click the point then the Modbus button in the bottom left of the Point Program screen.
2.Click the Modbus Position field and enter the address, which will be a number between 40,001 and 49,999
3.If you need to change the Modbus Type, click on the field and select from the list.
4.Right click or ESC to save.
Note: After changing any Modbus parameters in CBAS you must restart CBAS before the changes will take effect.
More on The Modbus Generic Controller
This controller is limited to Reading/Writing of Holding registers. Holding registers have addresses in the range of 40001 to 49999. You will need the documentation from the controller’s manufacturer to get these address values. The controller needs to only support the following two message types: Read Holding Register and Preset Single Register. The Modbus spec says that you subtract 40001 from the address when sending a message to the controller. But some Modbus controllers only subtract 40000 instead of 40001. If the Modbus controller that you are connecting to only subtracts 40000, then you will have to add 1 to the address when entering it into CBAS. The Modbus Generic controller is limited to 256 points.
Below is an explanation of each type of Modbus point that is supported by CBAS.
•FLOAT – This point type takes up 2 register addresses, making it 32 bits. The first register is the upper 16 bits.
•Integer – Uses 1 register and is 16 bits. Range of 0 to 65,000.
oAn Unsigned 16-bit is an Unsigned Integer in CBAS.
oA Signed 16-bit is a Signed Integer in CBAS.
•Binary Input, Binary Output – Uses 1 register.
•Integer – Uses 1 register. Range -30,000 to 30,000.
•A LONG is 32 bits, so it takes 2 Modbus registers, just like a Float.
oA Signed 32-bit is a LONG, which can go negative or positive. However, CBAS has no Signed LONG, so you have to use an Unsigned LONG, and negative numbers will be displayed incorrectly.
oUnsigned Long – Uses 2 registers. The first register is the Lower 16 bits. Range 0 – 999,999.
•Bit points are points that have the same register, but do different things, depending on the Bit you set.
You need to add the “1 Bit” point type. Or 16 of them for each address (40001 for example). Then in the configuration for the Modbus point, enter the 1-16 number in the “Start Bit Position.”
So for each Modbus Bit address you would have 1 point each of type “1 Bit,” all with the same Modbus address. The only difference between them will be their “Start Bit Position.” CBAS Alarms Play Through Sound Card
Normally, CBAS Alarms play through the built-in speaker inside the computer case. This can be hard to hear in a mechanical room where a lot of noisy equipment is running. As of CBAS Version 2.0.1 and later, CBAS Alarms automatically play through any installed sound card. Also, Computrols computers now come with a built-in sound card and a pair of powered speakers.
When an alarm sounds, it plays the Windows “Critical Stop” sound. In order to make this sound more noticeable, we have changed the wave file to a more irritating sound that is hard to ignore. To change this sound to a wave file of your choice, go to Windows Control Panel, Sounds and Multimedia.
Highlight “Critical Stop” and click on the down arrow next to the Name field. You will see a list of wave files in the C:WINNTMedia folder, which is the default folder for Windows sounds. You can choose a sound from there or click the Browse button and select one from another location. To test the sound, click the right arrow between the name field and the Browse button.
- Was this article helpful?
- Yes 8 people found this article helpful.
- No 0 people did not find this article helpful.
- Give us feedback


