LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

What is the problem in my vi to get the data from Modbus TCP/IP?

Dear All,
 
           I have Modbus TCP/IP vi, which i have downloaded from this forum itself, but i am unable to get the data from the TCP/IP port through this vi, can anybody please tell me what could be the problem in this vi, so that I am not getting the data, I have attached library file with this post, please download and extract the files to one folder and run the MB Ethernet Master query and please tell me what is the problem, why i am not able to get the data.
 
Thanks in Advance,
Nishant
0 Kudos
Message 1 of 8
(3,924 Views)

I can't look at your LLB, but I have used this library and it does work, so just uploading it will not allow anyone to help you.

The reasons for not being able to communicate can be anything from having the cable disconnected to having your Modbus settings wrong (device number, etc.).

You should use probes to see if you are getting any answers back at all (I think the VIs are reentrant so you will need to change them temporarily) and see what error you're getting (you might be getting a Modbus error code). You should also try using another program which uses Modbus to see if you can talk to the device at all.

If you still need help after doing all this, you should upload more details (exactly what you are sending, what are you getting back, etc.).


___________________
Try to take over the world!
0 Kudos
Message 2 of 8
(3,922 Views)

Hiii tst,

              Thanks for the quick reply, but as far as i am concern there is no problems in the cable connection, but tell me what kind of cable i should use, should it be the cross or it should be straight?

             Another thing is I am getting the error in MB write.vi driver "TCP Write in MB Ethernet Transmit.vi->MB Ethernet Master Query.vi", but dont know what is that?

            Do you have any idea about any other freeware software from which i can run the Modbus TCP/IP? which can give me the data? I want to take the data of 10 registers from the device with the function code 03, but it is not happening.

            Another question in my mind that what about the IP address of the device, how should we specify it? because there is no option in the vi to give the IP address of the device from which we are fetching the data.

I know i have write so many things but hope that you wont mind it.Smiley Wink

Thanks,

Nishant

0 Kudos
Message 3 of 8
(3,918 Views)
0 Kudos
Message 4 of 8
(3,904 Views)

I suggest you look at Unclebump's suggestion, because the library you posted is missing a lot of files found in the original (I assume you did a "Save with Options").

As for not specifying the IP address - of course, you can't, you're expected to give the original MB Ethernet Master Query VI (before your modifications) a TCP connection reference, which you can only obtain after using the TCP VIs, where you do supply the IP address. Look at Unclebump's link for an example.

I'm not a Modbus expert, but I remember using a program called Modbus Scanner to do some quick and dirty tests. I don't know if it supports Modbus ethernet, but even if it doesn't, there are probably others which will.

Above all, my suggestion would be not to change the VIs - they should work properly.


___________________
Try to take over the world!
0 Kudos
Message 5 of 8
(3,891 Views)

Hmmm.... You are right tst, the files i have missing some the files as i look at Uncle's solution, but thing is i have download it from the Ni forum this all the files and from there onwards, these are the files. anyways, now i have download the files, so i will check them and i think they will work also.

             Modbus tester is a good software to do some "quick and dirty Smiley WinkSmiley Very Happy" tests, and that software is also provided with the TCP/IP modbus, so it is good to use.

            What is the Remote port, which has been given 502 in the vi? can anybody please tell me?

Thanks,

Nishant

0 Kudos
Message 6 of 8
(3,879 Views)


@Nishant wrote:

What is the Remote port, which has been given 502 in the vi? can anybody please tell me?


I have no experience with MB ethernet, so I can't give you a definite answer, but my guess would be either that this is a standard port number (which means you can find it in the Modbus specifications) or that it depends on the device you're trying to communicate with (in which case you need to read the documentation). My guess would be the latter is more likely.

___________________
Try to take over the world!
0 Kudos
Message 7 of 8
(3,873 Views)

Hiiii tst,

        I also think this is the standard port number, becuase i also found it in the Modbus tester software, which is standard one to check the Modbus data either on the serial or on the Ethernet, this could be the standard Ethernet port number.

Thanks,

Nishant

0 Kudos
Message 8 of 8
(3,869 Views)