09-19-2011 10:53 PM
Hey Everyone!
I am reaching my limits in terms of experience with LabVIEW at the moment.
I am building a tester for car keys. I have written smaller VIs to handle the little jobs, like sending data to a micro controller. I am attempting to create a GUI and put everything together, but am having difficulty tackling the problem as I have not dealt with this scenario before.
Attached in my code which is just icons and a general layout. As you can see, I have tried to organize it as best as possible as to not get overwhelmed.
The sub VIs create a hex string for a micro controller which in turn controls the tester.
When I press a button on either of the tabs, I want the correct string to be sent with the correct variables. I understand that calling a sub vi more than once takes up memory. Hence I am only trying to call the "stringfunctiongenerator v2" once.
Basically, I thought I would tackle manual control first, then try my hand automation.
Can someone please point out some basic tips for tackling these problem or suggest smarter ways of doing things as I am attempting with an event structure.
I should mention that I need to make the program as reliable as possible - and there will be a data logging component as well (already written the sub vi for that)
Cheers
Kamilan
09-20-2011 04:26 PM
Good afternoon Kamilan,
You attached 2 VIs titled StringFunctionGenerator v2.vi. Did you mean to attach another VI?
Can you also give a brief description of what you would like to accomplish (for example, in the default case of the case structure) vs what you're actually seeing?
Thanks,
Lisa
09-20-2011 07:25 PM - last edited on 11-14-2011 09:40 AM by JordanG
Gidday,
Attached in my GUI I intend to use.
Ok, so here goes.
The tester has 5 plungers, an indexing table with a nest of 20 samples (as pictured in the GUI). Each Key as per the GUI has 5 buttons.
Settings Tab
The NEST Array is disabled and only there for visual purposes. I want to enter a unique ID for each sample (normally 18 samples) and the corresponding Transponder ID. Then LOCK those settings in so that someone cannot edit the data while the tests are running.
Bench Test
This tab allows the operator to test the key manually if needed and does not invoke the tester.
Fixture Control
From here I wish to send serial commands from LabVIEW to the Tester via a micro controller (micro handles the plunger and index table control, and sensor inputs). This will allow the operator to load the keys into the nest.
For example - If I say "Trigger x" I want to the Test to trigger button x (x = 1 to 5)
Is Plunger x Home? > Preload Button x > Trigger Button x >Move Plunger Home
However, there will be a simple command procedure.
And this will be repeated depending on the procedures required.
So I created a string function generator based on the functions I require. This will obviously change during the course of development.
Automated Control
Now Depending on the data in the Settings Tab, I want to test each key in the locked arrays for x number of cycles.
So this means
That is one cycle. The machine will run for 2 months straight.
Future Additions
Pause Function to interrupt the cycles.
Do I call stringfunctiongen each time I want to do something and have a massive VI as I may call it a lot of times. Or is there a crafty way?
Any help would be appreciated.
Cheers
K
09-21-2011 05:23 PM
Hi Kamilan,
It sounds like you're looking for some tips on optimization and automation. Take a look at this article on dynamically called subVIs, which are loaded into memory and kept in memory at the start of the program. Additionally, a state machine will help you route through the different messages to send.
Let me know if you have more questions,
Lisa
09-21-2011 07:19 PM
Hi Lisa,
So I have a few questions about 'Open VI Reference' and 'Close VI Reference'
If I have a sub VIs within another sub VI and I use the 'Open and Close' do the sub VIs with the called VI open and close as well.
Attached is a an example I drew up after looking at how this is done.
I will be calling Query a lot!
Could I have Query in a while loop checking the status of the micro controller every 100ms for example. Then when a sub VI is being excuted, it can look at a reference of the status and if "not busy" it will proceed. This way I only call it once.
However!
if I have two routines such as Index, then Plunger that follow each other, I will want to check the microcontroller status inbetween sub VIs which means will the status running in the main front panel update in a sub vi while the sub vi is running?
Cheers
Kamilan
09-21-2011 10:24 PM
Here is a updated vi.
So both call Index.
What are the draw backs to opening and closing a sub VI like this as per the bottoms case structure?
Cheers
09-22-2011 06:20 PM
Kamilan,
When the reference to the VI is closed, the memory of that VI is cleared. Have you taken a look through the state machine document? I believe it would make it easier for you to put the code from your subVIs into a state machine structure that allows for automation.
The previous document about opening and closing VIs by reference states, "The advantage of making this sort of call is that the subVI is in memory only from the open to the close, rather than during the entire execution of the program." Using a large number of subVIs without dynamically calling them could cause memory usage problems.
Thanks,
Lisa