05-27-2009 03:32 PM
Thank you very much for your help so far and you dedication. I am attaching my GUI VI. It is in process. I do not have state module, and several other modules. So I had to punt allot. The GUI is on going to daily changes from the lab.
The VI Temp system with 152K is the beginning of the VI GUI.
Thanks for your super persistance.
Philip
05-27-2009 03:49 PM
Where is the VI that does the Modbus communication begin operating? It has a front panel and uses event structures. Is it coming to the front? Do you want your operator to interact with two different front panels?
Your use of global variables creates a race condition. The registers GV will likely get read before the modbus command gets sent out through the numeric and data global variables. Which means the response from your other VI won't get read until the next loop iteration.
This VI has a long string of a flat sequence structure with multiple long time delays. This VI will take a long time for one iteration of the loop to execute.
I think you need to rethink your architecture on this whole project. You should probably have a state machine architecture (not the same as a state chart module which is an NI addon toolkit). Look in the example finder and under File / New.... for examples on state machines (as well as numerous discussion forum threads.)
You may even need a producer/consumer architecture where your Modbus communication is handled in a separate loop (so it runs independently from the rest of your code). It can receive commands and pass back data through queues.
05-27-2009 04:19 PM
I re tested my Modbus VI with and without the globals. The Modbus VI without the globals worked fine. I entered the data manualy. With the globals I could not communicate. My GUI is the pits I know. Is there a way to pass globals to the original VI?
Philip
05-27-2009 09:13 PM - edited 05-27-2009 09:15 PM
You still haven't answered the questions about how your MB Interface VI operates.
1. What starts it running? I did not see anything in the GUI VI calling it.
2. Does the front panel of the interface VI come up?
Your MB Interface VI is set up like it is its own independent running program. It has a while loop. It requires operator interaction to do anything. The user must hit open to open the Com port. Hit the query button to write and read a command. Must hit Stop to stop the VI. It is a top level program.
If you want to use it as a subVI, you need to structure it as such. SubVI's generally don't have user interaction. They usually don't have while loops or event structures. They have inputs and outputs attached to their connector panel. They take information in, do a job, pass information back out.
Have you taken any training courses in LabVIEW? Have you completed any of the tutorials? If not, I recommend going through the tutorials here. How to Learn LV
05-28-2009 08:21 AM
Ok I will call the case closed. I am new at Labview. I am limited in tools from Labview. The plan was:
1) Develop a stand alone modbus interface. I was going to manualy enter the data. This worked.
2) Add globals into the VI Modbus. " I had some help from a NI apps engineer.
3) Start working on a GUI to satisfy the lab group.
I am still learning labview on the fly. My background is in C, VB6 and Java.
With a lack of tools and a full understanding of Modbus in Labviewthis was not simple for me.
Thanks for the help
Philip