LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Master Modbus has a bug in the Write function.

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://sine.ni.com/devzone/cda/epd/p/id/4756.
I have tested the LabVIEW Modbus Master by using a third part industrial Modbus Slave in order to exclude any Slave problem.
The LabVIEW Modbus Master reads correctly all the 100 Coils, 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

Download All
Message 1 of 4
(3,766 Views)
Now the attached screen shots are there!

Asper
Download All
0 Kudos
Message 2 of 4
(3,762 Views)
Hi Asper,
thank you for your work!
Let me work on it and I will tell you if it is a bug.
Thank you again
Beppe
0 Kudos
Message 3 of 4
(3,732 Views)

Excelent solution.

 

I've tried and it worked for me.

 

Thanks Asper!!

0 Kudos
Message 4 of 4
(3,364 Views)