Public or user defined function codes?

J

Thread Starter

jignesh mehta

Hi,
In Modbus data model, the object type are single bit and 16-bit word. but I have two bits object type. Shall I use public function codes or I have to go for user defined function code for two bit object type? We have to take two bits because each field element contains four status (normal, reverse, flashing and free). I am confused about how to implement modbus?
Please suggest us.
 
Jignesh,
My sugestion is that whenever we work with standards (Modbus is a standard), we should stick ourselves to the specifications of the standards.
In you case if you want a two bit model, use the 16 bit register format. It is better and you don't have to worry about implementing your own function codes.

Also, this will give you room for additional facilities in case you want to have them in future.

Again while implementing this, it would be easier and nicer if you assign one bit for each status, thereby saving you on the routine which you may have to write for infering the content. Will make it easier on the SCADA system also.

You can get loads of information on Modbus at http://www.modbus.org

Alok
 
For inter-operability, please not not define you own function codes. It is not necessary for the application you are developing.

You could use a 16-bit word to save all four states (kind of wasteful, but easy) or use two consecutive single bits. There are Modbus functions that assure atomic update and read of multiple bits. Go to http://www.modbus.org if you need more help on Modbus.
 
A

Alex Pavloff

Implement it with public function codes.

1) Put this state in a single 16 bit register. Document that only 2 bits in this register matter.
or
2) Put the 2 bits in bit space. Document that to make any sense they're going to have to read 2 bits.
or
3) Do both.

In all cases your documentation will specify what is in the various bits and registers available. Use public function codes to do all data reading.

Alex Pavloff - [email protected]
Eason Technology -- www.eason.com
 
Top