From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

LabVIEW Modbus

Solved!
Go to solution

I'm glad you have found a way to make it work.

 

What settings did you set in MAX?

 

Above you attached 3 files.

  • 24DIO.vi which seems to be related to other devices and not your Modbus connection.
  • RS-485 Checking 2.vi    That seems to be your main program.  In it you set the serial port to 19,200 baud, 1 stop bit, no parity bits, and on an unknown com port.  At least those are the values saved as default.
  • Configure RS-481 NI PXI 8431   In there, you configure the serial port to 38,400 even parity on com8.  8 date bits, and the stop bits default to 1.  However, I don't see where you are calling this VI anywhere in your code

Which of these serial port settings are the correct ones your device is expecting.

So if you fixing the parameters in MAX makes it work, then must not be setting those parameters in your LabVIEW code.

 

The problem seems to be what Bill pointed out in his 2nd paragraph back in message 12.

 

0 Kudos
Message 21 of 26
(514 Views)

RS 485 checking 2 default values wont be used. When I run the program it will com port 8, 38400 baud rate and parity even and so on. Check the screenshot of the front panel above. It is same as the configure RS 485 vi. Second point you have mentioned is I didnt use this VI. Which was a mistake. I did use it right after the 24DIO vi. In the block diagram it comes right after 24 DIO to configure this to the above mentioned values and then give it to the next set which is the modbus. I did it like that and it didnt work. The one I uploaded was a mistake. That was me try something different. Instead of uploading the original version, I uploaded the changed one. I have uploaded the original one again. But I didnt understand what is the error. 

0 Kudos
Message 22 of 26
(508 Views)

Put indicators or probes on your error wires.  Just in case something is causing an error and preventing later code from executing.

 

If you can get your code to work in once situation, but can't in another, then obviously something is different.  I can't execute your code since I don't have your equipment.  You'll have to apply the troubleshooting techniques to sort it out.

 

Good luck!

0 Kudos
Message 23 of 26
(506 Views)

So what you are saying is it should work. Can you just check the flow of the program and see if anything is wrong, that is had I put everything in the right place? I am not talking about the values. Just the connections. Are all the connections right. That is what I want to know.  You don't have to execute the code. Anyway thanks a lot for your help so far. 

0 Kudos
Message 24 of 26
(503 Views)

Everything I see on the block diagram seems good to me.

0 Kudos
Message 25 of 26
(499 Views)

Ok thank you very much. 

0 Kudos
Message 26 of 26
(492 Views)