07-29-2015 05:38 AM
Hi Clint,
you need to work with this enum "in the whole wire". Right now you use a numeric (or ring) in the loop and so the shift register keeps this numeric. The enum to the left is coerced to your numeric value at the coercion dot.
Enums usually are used as typedef as it really helps to keep all instances of that enum in sync!
07-29-2015 05:45 AM
I know. Type defs are great. So I guess if I make the "current state" and the "next state" enums I won't need the type cast?
Thanks.
07-29-2015 05:49 AM
07-29-2015 06:49 AM
@Clint1000 wrote:
I know. Type defs are great. So I guess if I make the "current state" and the "next state" enums I won't need the type cast?
If you use the type def enum for all of your states, then the type cast is not needed. But here is the problem: if you do this, that subVI will not become truely generic. It will be bound to this state machine. You can use it freely in all states of your state machine, but it will not work in another state machine.
08-03-2015 09:17 AM
I thought I had this "licked". is there a way to to "convert " the enums from text to a number?? What I'm trying to do is allow the user to select from a menu of 20 particular tests. Example: Power supply test (#1)..LP transduer test(#2)..HP transducer test(#3)..etc. The user can select one or any combo. I was using boolean array to number to see which boolean menu item the user selected. The the test would then proceed running only selected test. crossrulz I had seen some of your posts suggeting maybe combo boxes..I can't find combo boxes to even read up on!! Where are those??? In my earlier post I got a coersion dot because I was going from enum to integers and you said bad things can happen if I don't correct it. How would I do that or should I even use that approach??Any suggestiosn for my current problem??
Thanks..
08-03-2015 09:23 AM
What's wrong with just working straight off of the enum? You can make an array of these enums and the enum can go straight into the case selector of a case structure.
08-03-2015 01:33 PM
that could be the answer. I'll give it a try. Right now I have the enum in a dowhile w a shift register. My last case is stop or end. i do nothing but pass the STOP a true. if I do the array I'll have to index it some how but that looks like the best solution yet. Don't know if this is the right place for this post but is there a way to tell what is missing in a type def?? I'm getting the coersion dot on an enum ctl when i do a bundle unbudle by name going into a subvi. I've opened the ctl control and the ctl indicator ( both type defs ) and can't find why the dot...something maybe missing but it doesn't jump out at me.
thansk..
08-03-2015 05:37 PM
@Clint1000 wrote:
that could be the answer. I'll give it a try. Right now I have the enum in a dowhile w a shift register. My last case is stop or end. i do nothing but pass the STOP a true. if I do the array I'll have to index it some how but that looks like the best solution yet. Don't know if this is the right place for this post but is there a way to tell what is missing in a type def?? I'm getting the coersion dot on an enum ctl when i do a bundle unbudle by name going into a subvi. I've opened the ctl control and the ctl indicator ( both type defs ) and can't find why the dot...something maybe missing but it doesn't jump out at me.
The indexing is simple. You can either just use a FOR loop and autoindexing (by far the simplest) or use a shift register to keep track of your index and use Index Array.
For the coercion dot, make sure they are the SAME type def enum. If they are different ctl files, even if everything is exactly the same, you will get the coercion dot (they are technically different types after all).
08-04-2015 05:08 AM
thanks!!