07-28-2009 06:56 AM
07-28-2009 08:28 AM
Thank you, Thank u very much sir..It would have taken me years to get solutions like this.. You are really a genious sir I had tried the logic you said it I was able to get rid of the excess controls I have . But I still have to set the default values to the controls taking the values from the spread sheet.
-Lucky.
07-28-2009 09:00 AM
Originally when you mentioned default value, I was thinking you were just trying to set the initial value which is what you were already doing. In general, I think the default value is useful only to have an initial value already set when you first start a VI and since you are programmatically defining your VI when it begins to run, that really doesn't matter. The only other place where default value becomes useful is if a user right clicks on a control and uses Reinitialize to Default Value while it is running. This is something I don't tend to do from a user standpoint. I would prefer to handle that as part of the program architecture.
However, there is a way to set the default value of a control, but it is more complicated. First, you need to have scripting which has just recently been made publically available. See Here. I've just started playing with scripting in just the last two days, so I am not an expert on it. But it looks to be pretty cool and powerful. Installing that exposes a Default Value property node for a control. However, you can't set the default value of a control on a running VI. The VI has to be in Edit mode. So that means you would have to have a starter VI. Have it run and open a copy of your current VI without running it. Do the code you are doing now in but in the starter VI. Since the current VI would still be in edit mode, then you could edit the default values. As your starter VI finishes, it would invoke the Run method on your current VI and then end itself.
I don't have the time to try to work out an example on this, but hopefully my description, the link to scripting, and a good reading of LabVIEW help will get you through.
07-28-2009 09:16 PM
07-28-2009 11:07 PM
Sir,
Can you pls suggest me the steps in integrating the GUI in to my main vi.
-Lucky.
07-28-2009 11:45 PM
I'm not sure how the two VI's are supposed to interact.
Is the data you are getting in the main VI with the CAN bus a list of channels and values you need to pass to the GUI VI?
Is the GUI VI supposed to be a set of controls or indicators?
I would pass data between VI's using shared variables. Another good option would be a queue.
In the GUI VI, I'll assume you get a piece of data that is a channel name and a value. Search your main array to find the matching channel name to get the Group name. Once you know the group name, search the appropriate smaller array to get for the same channel name to get the index value. Now that you have the index value, use that on the array of references to get a specific reference. Write the value to that indicator.
I made some changes to your VI to show how a piece of data coming in as a channel name and a value can go into the appropriate control (Indicator?) using some array searching code. This is just a section of a flat sequence structure, but in reality would be a while loop that acts on each piece of data coming in.
If I was doing this, I would look at storing the control references and the lookup table of channels vs. controls in an action engine. It would hide a lot of this code in a subVI. The intial frame of the flat sequence would be a part of an initialization case of the action engine.
I think I would also do the array lookup a little differently. Instead of having 4 separate sub arrays for each control, I would just add another column to the original array for index number. It would get populated as each channel gets assigned to a particular control reference. This would make some of the array searching easier as you would only have to search the larger array for the channel name and extract out the group and its index, rather than extracting out the group, and search the group's array to get the index.
07-29-2009 08:02 PM
yes sir, the data Iam getting in the main Vi on the CAN Bus should be passed to this GUI VI.The GUI VI is supposed to be act as both Controls and Indicators.
-Lucky
07-30-2009 10:34 AM
Hello sir,
In the same we created the GUI taking each element. When I took a array of knobs and created a property node I could see the visibiltiy option, but I couldnt see the scale range options. Can you pls let me know how to set the scale for each array of knob. (Some time's I should transmit a frame of data so I need to use arrays at that point.)
-Lucky
07-30-2009 11:19 AM
There was a recent message thread on knobs within a 2-D array that should help you.
http://forums.ni.com/ni/board/message?board.id=170&view=by_date_ascending&message.id=428136#M428136
07-30-2009 05:32 PM
Sir,
Though it is too much too ask I dont have any other option sir. Pls help me for the last time in creating this GUI. Its really important for me.
Iam also trying to develope GUI to Transmit messages.
Each ID should be created with a numeric array control. We have a table of 4 columns in the spread sheet
1) ID
2) Name
3) Min value
4) Max value
If a ID is repeated with different channel names say suppose a ID 2566 has four names, then its column size under node property should be set to 4. If it has total 10 different ID's then we should create 10 different arrays with the column size equal to number of times the ID is repeated. And the scale adjusted to the Max and Min values mentioned in the Min and Max tabs in the table (offcourse The array elements has the same scale).
After creating this individual arrrays with its respective properties.All arrays should be built together to make it as a 2- D array.Then a property node should be created to it to and set to " change all to read" thus when ever a value is increased or decreased in any array's element that particular element value is being transmited. Iam trying from past 5-6 hr's to seperate the ID's based on its repetation and to set its properties but I couldnt find any luck. Pls for the last time help me.
- Lucky