LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Reading modbus data from PLC to LABVIEW

Hello all,

 

I am in learning phase for this kind of code.

 

I want to read the Modbus ethernet based data from PLC to LabVIEW, I have attached my vi in that I have used TCP open connection and given my PLC IP and starting address 17028 is to read the Boolean coil. 

 

I am not able read anything from this code, can anyone help me what correction is required to read the Boolean coil. 

 

Attached picture of MB ethernet master read vi also, check if anything needs to be changed.

 

Holas1505_1-1698916718847.png

 

 

Regards,

Holas

0 Kudos
Message 1 of 9
(1,226 Views)

Try first with Unit ID = 1 in the MBAP header

Paolo
-------------------
LV 7.1, 2011, 2017, 2019, 2021
0 Kudos
Message 2 of 9
(1,207 Views)

it shows illegal function, with Unit ID = 1

0 Kudos
Message 3 of 9
(1,194 Views)

Holas1505_0-1698922218116.png

 

0 Kudos
Message 4 of 9
(1,190 Views)

Getting an exception code means that the slave at least answered to the command, so the correct Unit ID should actually be 1.

Illegal function means that the command is not supported, at least on that address. So maybe the address is wrong.

Paolo
-------------------
LV 7.1, 2011, 2017, 2019, 2021
0 Kudos
Message 5 of 9
(1,176 Views)

Yes, Paolo you are right, now my code is running without error but still I am not able to read the coil output from PLC.

 

Holas1505_0-1698923813307.png

 

My coil output from MB ethernet read vi still false.

 

Thanks,

Holas 

0 Kudos
Message 6 of 9
(1,170 Views)

And you are sure the adress for the registre is 17027 ? 

Have you tried 7027 ? 

Sometime the address in is defined with the function code added in front. 

0 Kudos
Message 7 of 9
(1,157 Views)

Have you tried with in built Modbus example? You can use the example Module Modbus Master/Slave and try to fetch the Values.

----------------------------------------------------------------------------------------------------------------
Palanivel Thiruvenkadam | பழனிவேல் திருவெங்கடம்
LabVIEW™ Champion |Certified LabVIEW™ Architect |Certified TestStand Developer

Kidlin's Law -If you can write the problem down clearly then the matter is half solved.
-----------------------------------------------------------------------------------------------------------------
0 Kudos
Message 8 of 9
(1,097 Views)

Thank you all,

 

Now I am able to read and write the data, problem was wrong function I have used read coils in place of read holding registers.

 

Thanks,

Holas

0 Kudos
Message 9 of 9
(1,073 Views)