LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

What does enum constant do?

Hi

 

I have a program that I need to understand. There are enum constants at many places and I do not know what they do. When I find all instances it shows me many with other different named enum constants. Like enum "Read Queue" and "Initialize" are two enums and both are of the same instances. Can someone tell me what exactly an Enum is.

 

Thanks

0 Kudos
Message 1 of 8
(4,904 Views)

Enum is an "enumerated" datatype.

 

You have values of 0, 1, 2, ....   But those values are meaningless.  (Is "read queue" value #1?  Intialize value 0?)  So meaningful names are given to each of the values.  So if you want to initialize, you just have to pick that item in the enum rather than remembering an arcane number.

 

A constant is a specific value.  Note: when working with enums, it is HIGHLY recommended that they be typedef's so that if you ever need to add an item to an enum, that all instances of the constans get that new item added to it automatically.

 

I would recommend looking at the online LabVIEW tutorials
LabVIEW Introduction Course - Three Hours
LabVIEW Introduction Course - Six Hours

Message 2 of 8
(4,902 Views)

I have attached my VI. This Wizard is used to acquire data from the user. Can you explain me the enums in this context?

 

Thanks

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

Also when I display format, it says Initialize ( Digital Display - 1 ), and so on. What is this Digital Display?

0 Kudos
Message 4 of 8
(4,892 Views)

You have a state machine.  Instead of having a set of cases where they are meaningless numbers, the state machine is defined with meaningful names.  The enum datatype allows you to do that.  That way on the diagram you can visually see has a person the next state is Read Queue rather than a meaningless #2.  ("What does number 2 mean again?  Oh I don't know now I have to look at my cross reference to figure it out.")  That is a lot of work for a programmer.

 

The enum constant is defining what is the next value to put on that wire going into the shift register.  If you show digital display, it is showing you what the underlying value is for that particular named item.  There is really no reason to show the digital display.

 

Again, please take the tutorials.  I am quite sure the discussion of enums are covered there.

0 Kudos
Message 5 of 8
(4,882 Views)

In the VI that I uploaded, can you tell me what exactly the standalone enum does ( file attached with this message ) ? Like when is it activated/ called/ etc.

0 Kudos
Message 6 of 8
(4,862 Views)

It puts the value "Standalone Mode Options" into the queue.  Somewhere else there is a dequeue element that takes that value out and does something with it such as determine which case of the case structure to execute.

0 Kudos
Message 7 of 8
(4,859 Views)

@Soham wrote:

Can someone tell me what exactly an Enum is.


If the LabVIEW help on enum constants is not clear to you, please provide feedback on how it can be improved.

0 Kudos
Message 8 of 8
(4,850 Views)