Master Modbus has a bug in the Write function.

Master Modbus has a bug in the Write function.

Post by aspe » Sat, 21 Jul 2007 01:10:06


Dear NI support, the Master, of the Modbus Library for LabVIEW 8.2, has a bug in the "Write Multiple Coils" function.The "Write Multiple Coils" function fails when it writes more than 16 Coils.I have attached an example of a Modbus Master that manage 100 registers for each type of  Modbus Register.The example is a LabVIEW project and require the Modbus Library for LabVIEW 8.2 installed.For the Modbus Library for LabVIEW 8.2 see: http://www.yqcomputer.com/ , Input Status, Holding Registers and Input registers. The LabVIEW Modbus Master writes correctly all 100 Holding Registers. The LabVIEW Modbus Master fails when it writes the Coils starting from the 17th.I have look inside the "Write Multiple Coils" function and I have found a bug in the "MB Modbus Command to Data Unit.vi".In this vi the Case Structure manage the distinct Modbus commands, the case 15 correspond to the "Write Multiple Coils" command.In the case 15, the boolean array representing the Coils is packed in a word array where each word is a byte (8 bits). The boolean array is recursively divided in packets of 8 elements by using the "Split 1D Array" function and the "Shift Register" of the "While Loop".The input "index", of the "Split 1D Array" function, is connected to a constant (8) that it is multiplied for the loop iteration terminal plus 1, this is erroneous (see the attached screen shot: Faulty_loop.png).The input "index", of the "Split 1D Array" function, have to be connected to a constant (8) (see the attached screen shot: Correct_loop.png).Regards,Asper


modbus_master_example.zip:
http://www.yqcomputer.com/


Faulty_loop.png:
http://www.yqcomputer.com/


Correct_loop.png:
http://www.yqcomputer.com/
 
 
 

Master Modbus has a bug in the Write function.

Post by aspe » Sat, 21 Jul 2007 01:10:07

Now the attached screen shots are there! Asper


Correct_loop.png:
http://www.yqcomputer.com/


Faulty_loop.png:
http://www.yqcomputer.com/