LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to assign a value for voltage output to a enum

Hi,

 

I am sure my question will be easy to answer for experts, but I couldn´t find any examples:

 

I want to create a simple "Drop down Menu" where the user can select between 3 Power Levels:

 

Power Level 1 (enum value = 0)

Power Level 2 (enum value = 1)

Power Level 3 (enum value = 2)

 

How is it possible to assign to the enum value a "double". (The target is to set a specific value for each Power Level which I can connect with a DAQ-Assistant and finally with the Analog output)

 

So I just want the DAQ to output for Example

2,5 Volt if (enum value = 0)

5,0 Volt if (enum value = 1)

7,5 Volt if (enum value = 2)

 

Do I have to create an array, or has anyone an example how to programm that? Thanx for your replies!!!!

0 Kudos
Message 1 of 8
(3,810 Views)

Why don't you just use a ring control set to be a dbl? Be sure to uncheck the 'Use sequential values'.

0 Kudos
Message 2 of 8
(3,799 Views)

Hi,

 

Enums can't be changed to doubles, they are their own data type.

 

My first blush would be to have a case structure that would give you the value you want ( double from inside the case) for a specific enum value ( 1,2,3 ....)

 

Than you can progmatically change the value returned by the case structure based on your code. 

 

The enum would always fire that corresponding case, but the value returned from the case could be doubles, any value, etc....

 

Hope this helps.

-------
Mark Ramsdale
-------
0 Kudos
Message 3 of 8
(3,797 Views)

I agree with Mark...

0 Kudos
Message 4 of 8
(3,777 Views)

Seems silly to me to go to all that work with creating a case statement just to output a dbl.

0 Kudos
Message 5 of 8
(3,773 Views)

another way....better than assigning each case statementSmiley Wink

0 Kudos
Message 6 of 8
(3,767 Views)

Sorry, that's just more Rube Golberg code.

 

 

 

 

0 Kudos
Message 7 of 8
(3,761 Views)

just call me RGSmiley Sad

0 Kudos
Message 8 of 8
(3,743 Views)