11-02-2023 04:20 AM
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.
Regards,
Holas
11-02-2023 05:16 AM
Try first with Unit ID = 1 in the MBAP header
11-02-2023 05:44 AM
it shows illegal function, with Unit ID = 1
11-02-2023 05:50 AM
11-02-2023 06:08 AM
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.
11-02-2023 06:17 AM
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.
My coil output from MB ethernet read vi still false.
Thanks,
Holas
11-02-2023 06:49 AM
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.
11-03-2023 05:01 AM
Have you tried with in built Modbus example? You can use the example Module Modbus Master/Slave and try to fetch the Values.
11-03-2023 07:11 AM
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