LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

LabVIEW Modbus

Solved!
Go to solution

Sorry I forgot that part. But what could be the reason for no answer. Could it be a software error or a hardware error. 

0 Kudos
Message 11 of 26
(1,002 Views)

@govindsankar wrote:

Sorry I forgot that part. But what could be the reason for no answer. Could it be a software error or a hardware error. 


It could be anything.  It's really your job to figure that part out.  I'll give you some ideas on where to get started.

 

One large group of issues are related to low level communications: e.g., Am I talking to the right instrument?  Are the instrument communications parameters configured the way I expect them to be configured/are my communication parameters configured the way the instrument expects them to be configured?  Anything broken?

 

Another big group of issues concern actually talking to the instrument using the communications protocol: e.g., Am I sending commands the way the instrument expects me to send them?  Am I trying reading the responses correctly?

 

Any of these issues can cause a timeout error.

 

 

Bill
CLD
(Mid-Level minion.)
My support system ensures that I don't look totally incompetent.
Proud to say that I've progressed beyond knowing just enough to be dangerous. I now know enough to know that I have no clue about anything at all.
Humble author of the CLAD Nugget.
0 Kudos
Message 12 of 26
(985 Views)

Thank you. But the thing is I tried doing the same with a different software called Modbus poll. There I used the same configuration parameters as the one I used in labview, but there it worked whereas in labview it didnt. That is why it is confusing for me. 

0 Kudos
Message 13 of 26
(958 Views)

If it works with other software, that is a good sign it is not a hardware or wiring problem.

 

Now you just need to figure out what the differences are between the setup in the other program and your LabVIEW VI.  Although you say you configured them the same, there is probably something else you overlooked.

 

I would recommend trying a port sniffing program that shows you the actual communication.  Run it with the other program that works and then with your VI.  Compare the byte streams.  It might show you a difference.  If you can't run a port sniffer, snoop in on the actual serial wires and connect them to another serial port that just sits there and reads the bytes and logs them.  A simple LV program can be written to do that.

 

Look at https://modbus.org/tech.php and the specifications there.  It will give you details on what a Modbus message is structured.

 

 

0 Kudos
Message 14 of 26
(947 Views)

Sorry for being an idiot. I checked the other software in a different pc. There it worked. I did the same software again in the lab pc it doesnt work. The two differences are the one where it worked is my office desk pc. Here i connected the modbus device directly to the pc using an usb to rs 485 converter. But in the lab it is a completely different setup where I connect the pc to the modbus device using a pxie chassis with a rs 485 com port. But in this software I am selecting the exact com port of the pxie device and yet there is an error. Now the error here is checksum error if i use the length of registers to be read as 1 and an insufficient bytes recieved error if the length of registers to be read is more than one. If I can find out why the error is happening here, then maybe I can find the solution in labview as well. 

0 Kudos
Message 15 of 26
(945 Views)
Solution
Accepted by govindsankar

Are you working with 2 wire or 4 wire RS-485.  RS-485 is most commonly 2 wire.  Some devices need special settings to know they are in 2 wire mode.  That is too allow sufficient delays between send and receive and allow the sending and transmitting parts of the UART to know when to start and stop listening.  Some devices have to deal with an echo since the send and receive lines are the same.  I feel that NI produced serial ports are more sensitive to these types of things than other 3rd party adapters you might get, like the one on your PC.  Check the port settings for the PXI.  See if there are any property nodes that need to be set to tell it whether to be in 2-wire or 4-wire mode.

0 Kudos
Message 16 of 26
(940 Views)

Dilbert says that everyone is an idiot at least once a day.  I'm an overachiever.

Bill
CLD
(Mid-Level minion.)
My support system ensures that I don't look totally incompetent.
Proud to say that I've progressed beyond knowing just enough to be dangerous. I now know enough to know that I have no clue about anything at all.
Humble author of the CLAD Nugget.
0 Kudos
Message 17 of 26
(937 Views)

Its a 2 wire device only Rx and Tx. 

0 Kudos
Message 18 of 26
(926 Views)

RS485Checking Bloack Diagram.jpgRS485Checking Front Panel.jpg

 

I have also attached the program which is RS485 checking. Rest are subVIs. I have configured the COM port to RS485 2 wire auto transceiver mode and still there is no output. Can you go through the program and kindly let me know what is the mistake? Thank You.

0 Kudos
Message 19 of 26
(910 Views)

I have finally got it working. But still I have a doubt. I have got it working by changing the configuration of that COM port in NI Max. Then it started working. But before I tried to change the configuration using programming in LabVIEW. I tried to set the baud rate and parity and everything using configure visa serial port in labview. You can see that in the Configure RS485 program which I attached above. But at that time it didn't work. Why is that?

0 Kudos
Message 20 of 26
(902 Views)