03-26-2008 12:58 PM - edited 03-26-2008 01:00 PM
03-26-2008 02:46 PM
create a custom array control, input your various data points, and right click->data operations->make current value default
make sure you click on the outer border instead of one of the elements, or else the elements inside will default to the one you clicked
03-26-2008 05:47 PM
I usually simulate the CONST by using a vi that returns the constant. An example is pi (YES I KNOW THIS IS ALREADY PROVIDED BY LV) place the double constant 3.14.....on the block diagram, and wire it to an indicator, select one terminal and wire it out. Change the icon and your done. This is different from the saved value typedef in one important way, the data can not be changed without opening the vi, which can be protected. this can be used in conjunction with a typdef for complex data types. An example of this is a version cluster, having a major, minor and revision integer inside of a cluster, typedef this and then make a vi called application version use the typdef for the constant on the diagram and the indicator out of the CONST Vi. This is my prefered method to simulate a CONST in labview. This is not as elegant as a preprocessor directive in C but it works nicely.
Paul
03-27-2008 07:13 AM
That's the way I do it, too. This method, combined with blanking the B&W icon of the VI and drawing an icon that doesn't use all the space of the 256 color slot lets you create something effectively similar to the primitive constants NI has.
falkpl wrote:
I usually simulate the CONST by using a vi that returns the constant. An example is pi (YES I KNOW THIS IS ALREADY PROVIDED BY LV) place the double constant 3.14.....on the block diagram, and wire it to an indicator, select one terminal and wire it out. Change the icon and your done. This is different from the saved value typedef in one important way, the data can not be changed without opening the vi, which can be protected. this can be used in conjunction with a typdef for complex data types. An example of this is a version cluster, having a major, minor and revision integer inside of a cluster, typedef this and then make a vi called application version use the typdef for the constant on the diagram and the indicator out of the CONST Vi. This is my prefered method to simulate a CONST in labview. This is not as elegant as a preprocessor directive in C but it works nicely.
Paul
03-27-2008 07:19 AM
And if that does not meet your needs you can assemble a translator that accepts the enum value and use a look-up table to find the appropriate value. The "translator" approach bring with it the ability to redefine the translations "on the fly".
Ben
03-27-2008 07:52 AM
03-27-2008 12:52 PM
Thank you Paul! That is what I was looking for. The idea of pre-defined constants is where I get hung up... I am with you thinking there should be a better way but we have to make do with what we have available.
Thanx again.