LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Temperature monitoring Omega CN16PT

Solved!
Go to solution

Hello everyone,

 

I just started working with LabVIEW, and I've reached a blockage.  I am trying to use LabVIEW to monitor the current temperature, but can't figure out how to edit the program.  It already allows me to read and write one thing at a time, but I need to be able to monitor temperature consistently throughout the experiment.  Any help would be greatly appreciated!

 

I've been using the Platinum_MB_Example Serial Master.VI from the library below.

0 Kudos
Message 1 of 8
(4,662 Views)

You've attached a modbus library, but you haven't attached your VI.  You say "can't figure out how to edit the program" but didn't attach any program you are trying to edit.

 

You say you have something that allows you to read and write one thing at a time.  But if you want to do something continuously, do you know what structure to put around your code repeatedly do something?

 

Please attach your VI.

Maybe I'm presuming too much, but I think I would recommend that you look at the online LabVIEW tutorials to start learning the basics.
LabVIEW Introduction Course - Three Hours 
Learn LabVIEW

 

PS:  Where did you get this Modbus library? It's called "PlatinumModbus" which I have not heard of before, but looking inside, it looks like the regular Modbus Library that NI has published on their website for the past 15+ years available at this page.  http://www.ni.com/example/29756/en/ 

0 Kudos
Message 2 of 8
(4,637 Views)

I am sorry I forgot to attach the VI I like I meant to.  I used the example that was published by the manufacturer.  I have attached the VI I have been working with below.  I have a pretty solid grasp on the basics, but the example VI is more complicated then anything I have dealt with before. There are already to For Loops built in, and I can't seem to find the right place to put a temperature monitor. Thank you!

0 Kudos
Message 3 of 8
(4,621 Views)

First.  those are While Loops, not For Loops.

 

The architecture is producer/consumer with an event driven producer.  Not something you truly need for something to run continuously.  Tear apart that example and get rid of the event structure.  I have a feeling you aren't ready for that yet.  Just use a single while loop.

 

Put the initialization code before the while loop, put your Read in the inside the While Loop.  It doesn't sound like you want to write any values to the device, so leave that out.  Put a wait function in the while loop.  Wire your stop button to the while loop's conditional terminal.  Put the VISA close after the while loop.

0 Kudos
Message 4 of 8
(4,609 Views)

I apologize for taking so long to reply.  I wanted to make sure that I had tried everything I could before I asked for more help.  I do need to be able to write values so I added that in using the provided express VI's.  The program will run, but I can't actually read data or write values.  I can not find my error.  Would you please take a look for me?


Thank you

0 Kudos
Message 5 of 8
(4,564 Views)

Okay.  I can see now that the "platinum" modbus driver is a library that puts wrappers around the NI Modbus library 1.2.1  We'll assume that everything they did is correct.  By the way, they are not Express VI's.  Express VI's are a LabVIEW specific term that refers to nodes on the block diagram that are light blue, and when you double click them you get a dialog box that let's you configure the node.  It essentially hides some level of programming behind the user interface.

 

You say you can't read or write to the device.  Are you getting errors?  If so, what are they?

 

Does Omega supply any other software of their own making that you can try communicating to the device with?

 

More details could help, but if something is not communicating, there are a few places to start looking.

1.  Wire issues.  Null modem vs. straight through cables on RS-232 ports.  Broken cables.  Incorrect wiring on RS-485 ports.  Termination issues if RS-485.

2.  Port settings.  Are you sure the baud rate, stop bits, data bits and all that are correct?

3.  Driver issues.   Something not installed.

4.  Address issues.  Are you sure the slave address in the device is 1 like you have it in your VI?

 

Going back to #2, I came across something in my own code while first starting to use the older NI Modbus Library.  I found that the Modbus Init, which is being used as subVI within the Omega Platinum MB open you attached, assumed a setting of 8 data bits and 1 stop bit for Modbus RTU.  But a device I was using had 2 stop bits in its Modbus RTU setupl.  So I swore off ever using the Init that comes with the Modbus Library and I use the regular Serial Configure subVI and set all the baud rates, stop bits, data bits, parity to specifically what the device called for.

 

 

0 Kudos
Message 6 of 8
(4,550 Views)

I went through the device, and checked the baud rate, stop bits, data bits, and parity were all set correctly so there shouldn't be an issue there.  The VI initial attached was provided by omega, and now produces an error message saying

" Property Node (arg 7) in MB Serial Init.vi

->Platinum_MB_SerOpen.vi-

>Platinum_MB_Example Serial Master (2).vi"

when I try to connect to the device.  I downloaded Omega's software and the device is connecting properly.  However, the provided software does not work effectively with my other V'I's.

 

I think the issue relating to my inability to read and write is the lack of the "open" and "Write"  It seems like this would explain why the provided VI gives an error message, but mine does not.  If this sounds correct would there be a way to add these buttons without the extremely complicated loop structure found in the first VI?

 

I pondered changing from the "Omega Platinum MB open" to  Serial Configure subVI, but ultimatly decided to stay with the "Omega Platinum MB open because the data bits and stop bits in the ModBusINIt match the machine settings.


Thank you for your time.

Jacson

0 Kudos
Message 7 of 8
(4,539 Views)
Solution
Accepted by topic author jackson040

Was there any error number a part of the error message for MB Serial Init?

 

Argument 7 is Flow Control.  Their Open VI is kind of bad because they used completely different datatypes to write to the MB Serial Init. There are coercion dots all over that block diagram.  But it is set for Flow Control =  None which is a value of 0.  That shouldn't be a problem.

 

"I think the issue relating to my inability to read and write is the lack of the "open" and "Write" It seems like this would explain why the provided VI gives an error message, but mine does not. If this sounds correct would there be a way to add these buttons without the extremely complicated loop structure found in the first VI?"

 

I don't know what you mean by adding buttons an extremely complicated loop structure.  VISA Serial Resources will inherently open when you start using them.  The Omega Platinum MB Open you are kind of forces to use because they build up a cluster that is used in their other Modbus wrapper VI's.

 

I don't like how their port name control is just as string.  They should've used a VISA control.  Are you sure the port name you entered in that string is valid?

 

If this was my project.  I'd throw away their library and just use the NI Modbus library.  Except I'd use Serial Configure and not the MB Init that is in the NI library.  I'd read the manual to see what all the serial settings would be, and what all the register addresses are.  Perhaps the only useful VI in the "Platinum" library is the subVI Platinum_MB Protocol.vi.  Assuming it is correct and matches the manual, it provides a nice conversion from an enum of registers (It is a typedef so you'll need that file also) to the register number for Modbus read and write functions to use.

 

Don't mess with any writes yet.  Just work on trying to get a single reading of a register to work properly.

 

PS:  It is spelled "Temperature" not "Tempreture"

0 Kudos
Message 8 of 8
(4,531 Views)