LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Modbus

Disclaimer: I am very inexperienced w/ labview and only a beginner so please be patient with me. 

 

I am trying to control a TEMPCO TEC-9100 Temperature Controller using labview. The controller uses MODBUS to communicate. I currently have it connected through a serial connection to my computer (through a serial to USB adapter). I have confirmed that there is connection between the controller and my computer. Now I would like to create a labview program that will allow me to control the controller from my computer.

 

Please let me know if you can help and please share all helpful resources!! 

0 Kudos
Message 1 of 21
(3,708 Views)

For basic serial communication, I always start with the Simple Serial example found in the Example Finder.  Go to Help >> Find Examples and search for Simple Serial.  It is a basic VI that sends some data to a serial port, waits, then reads it back.  A more advanced design will implement either asynchronous communication with terminating characters, or timeouts to know when the data is done being received.

 

That being said there are tons of Modbus APIs written for LabVIEW that might make life easier for you if you can understand how to use the API.  It will attempt to make a higher level calling to the device so you don't need to worry about the raw bytes going out or in.  Some people like this, but debugging problems with communications can be harder.  If you search your palette for Modbus you may already have one of these APIs installed.  These usually come with examples, but if it doesn't they are usually easy enough to use with an Open, Read, Write, Close concept.  For me I use the Modbus library under Data Communication >> Modbus, but I'm not sure if that gets installed with the base LabVIEW or if it came when I installed real-time.

 

As for basic LabVIEW training, here are some links to free online training usually seen on the forums.

 

NI Learning Center

NI Getting Started

-Hardware Basics

-MyRIO Project Essentials Guide (lots of good simple circuits with links to youtube demonstrations)

-LabVEW Basics

-DAQ Application Tutorials

-cRIO Developer's Guide 

Learn NI Training Resource Videos

6 Hour LabVIEW Introduction
Self Paced training for students
Self Paced training beginner to advanced, SSP Required

0 Kudos
Message 2 of 21
(3,693 Views)

Although I can communicate with the device through the software given by the manufacturer  and control the temperature effectively from my computer (so I know the serial communication is running correctly) ,when I test the serial connection using the Simple Serial VI you mentioned, I get an error "Error -1073807246".

 

I have closed all other programs and restarted labview before testing, and I still get the same error. Does this mean that labview cannot communicate with my device? 

0 Kudos
Message 3 of 21
(3,678 Views)

@wakho wrote:

Does this mean that labview cannot communicate with my device? 


No, it means LabVIEW cannot communicate with your COM port.  Some application is running that is locking that resource.

 

Although I can communicate with the device through the software given by the manufacturer... 


Is this software closed?  Because this will also prevent LabVIEW from accessing it.  Is MAX open with a test panel to the VISA resource?  Because this will also prevent LabVIEW from accessing it.

0 Kudos
Message 4 of 21
(3,665 Views)

No, I closed all programs, including labview, and then tried testing it again. Still getting the same error....Not sure why

0 Kudos
Message 5 of 21
(3,657 Views)

I don't have it open anywhere else, I even restarted labview and still getting the same issues. Through the Modbus I/O Server for the attribute "Commfail" I am getting it to be true, meaning there is no connection. Could this be because of my rs232 Serial to USB converter I am using? Again, the simple serial test is also still not working.

Thank you so much in advance!

0 Kudos
Message 6 of 21
(3,641 Views)

It might be the USB converter.  They were notorious for flaky behaviour in the past but they're much better these days at truly replacing all the functionality of a real PC COM port.  

 

If you post your code we can take a look and tell if you've just made a simple LabVIEW error or set up your RS-232 parameters wrong.

 

For MODBUS I always just use the NI MODBUS Library available in the VI Package Manager.

LabVIEW Pro Dev & Measurement Studio Pro (VS Pro) 2019
0 Kudos
Message 7 of 21
(3,635 Views)

I'm currently not getting that error anymore but I am still confused as to whether connection between the device and labview is present or not. I am trying to test the connection using the simpleserial.vi as well as  Continuous Serial Write and Read.vi but when I run both I don't get any results. Also when I run the continuous test I get a timeout error. (As seen in the picture below) This leads me to believe that labview cannot connect to the Serial Port. commfail.PNG

0 Kudos
Message 8 of 21
(3,627 Views)

I am looking to control a Tempco TEC-9100 temperature controller using labview. I have established connection between the device and my computer through a RS-232 to USB converter.

 

When I attempt to run anything through Labview, I am not sure whether or not there is connection between Labview and my controller (which I think may be due to the USB converter).

 

Once I can establish connection within Labview, I would like to use the NI MODBUS Library to create a simple program that will allow me to control the temperature of the device.

 

Thank you in advance!!

0 Kudos
Message 9 of 21
(3,645 Views)

Hi wakho,

 

I am not sure whether or not there is connection between Labview and my controller

When you are unsure you need to check/test this connection…

 

I would like to use

That's ok. Do whatever you like to do! 😄

 

What exactly is your (LabVIEW) problem?

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 10 of 21
(3,643 Views)