LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

how to create enum type

Can you explaim me how to create
an enum constant like in c with Labview 6
for instance start=10, stop=25 ,a=12,inc=50 ...
thanks
0 Kudos
Message 1 of 7
(3,929 Views)
This is not possible in labview yet.
Enums in labview behave like those in pascal and modula2 they are an ordered set of names with values from 0 up to the last value. They are not used to be mixed with constant representation.
If you want to couple constant values to an enum type you can use a constant array that is indexed by the enum.
greetings from the Netherlands
Message 2 of 7
(3,929 Views)
You can create your enumerated type, give names and after that go to the diagram and create a case structure, wire the enum to it and create a case for each option. Then you can give a value to each case.
Hope this helps
0 Kudos
Message 3 of 7
(3,929 Views)
You can't. Not usefully anyway. What you can do is create an enum where
start=0, stop=1, a=2, inc=3....

i.e. you can create an enumeration where the numbering is sequential rather
than arbitrary, which is generally adequate. Look in the "Numeric" palette
and you should see it. When you create it it's empty, and can be populated
by typing values into it and using the pop-up menu to add elements.

ravary wrote in message
news:5065000000080000003E2C0000-1000509150000@exchange.ni.com...
> Can you explaim me how to create
> an enum constant like in c with Labview 6
> for instance start=10, stop=25 ,a=12,inc=50 ...
> thanks
0 Kudos
Message 4 of 7
(3,929 Views)
I don't know the details, but it is possible to create sparse enums in
LabWindows CVI and import them in LabVIEW.

I have implemented a workaround in LabVIEW. It is a VI that takes on input a
C sparse enum statement (e.g. enum {start=10,stop=25,a=12,inc=50}})and will
automatically create from templates:
- a typedef G enum {start,stop,a,inc}
- a VI that inputs the typedef enum to index an array of sparse
values[10,25,12,50].

It is available on my LabVIEW pages
http://cybertechs.qc.ca/~jpdrolet/labview

Jean-Pierre Drolet


LabVIEW, C'est LabVIEW

Message 5 of 7
(3,929 Views)
I don't know the details, but it is possible to create sparse enums in
LabWindows CVI and import them in LabVIEW.

However, I have implemented a workaround in LabVIEW. It is a VI that takes
on input a
C sparse enum statement (e.g. enum {start=10,stop=25,a=12,inc=50}})and will
automatically create from templates:
- a typedef G enum {start,stop,a,inc}
- a VI that inputs the typedef enum to index an array of sparse
values[10,25,12,50].

It is available on my LabVIEW pages
http://cybertechs.qc.ca/~jpdrolet/labview

Jean-Pierre Drolet


LabVIEW, C'est LabVIEW

Message 6 of 7
(3,929 Views)
LabVIEW enums start at 0 and count by 1. The trick here is to scale it mathematically. For example: enum * increment + start. This will give you an "enum" that starts at a specific number and counts by a set increment.

Rob
0 Kudos
Message 7 of 7
(3,929 Views)