10-27-2011 05:13 PM
I am making a state machine and my case titles are named through an enum. I have realized that I had multiple states doing the same thing so I condensed them and now I have about 8 states with code and 8 states that never get referenced. I also want to rename the ones Ive condensed. The problem is that when I try to change the name, the titles turn red. If I try to change the initial enum, it makes all the state titles into their number (1-16). Ive read something about typedefs and I know mine arent. Is that the issue or is it something else? Any way to easily fix this? Its labview 8. I dont have my program available, but if it would help that much, I can add it in tomorrow. ~Matt
Solved! Go to Solution.
10-27-2011 05:25 PM
Every enum must match, otherwise it is coerced ot a U16. Since you have not used typedefs, you have to modify every since enum you have used to match. This is why you should use the typedef, as you would change everything in one place.
Make a typedef and go through and replace every enum now. The problem will come up again.
10-27-2011 05:43 PM
Ive looked for typedefs in tutorials but they dont seem to show up at that spot in labview when I look. Am I missing something or just not looking in the right spot? (Under edit)
10-27-2011 05:53 PM
To create a typedef from scratch you can go to File->New and select custom control. Change the control type from control to typedef or strict typedef.
If you are using LV2011, you can right-click on your enum constant and choose Make Typedef. If not, then change one of your constants (an old one you haven't modified the items for) to a control or indicator (right-click menu). Go to the control or indicator on the front panel, right-click and choose Advanced->Customize. The enum will open in a new window. Change the type from control to typedef or strict typedef. Save it, and replace the control or indicator. Go back to the block diagram and change it back to a constant. On every other constant, right-click and choose replace with and select your new typedef. Make sure the values don't change.
After replaced all the enums, edit the typedef to have to values you want.
10-28-2011 02:52 PM
Thank you!! That worked. I have a similar issue now though. I changed them all to type defs and replaced them all with that type def and it worked. Then I went through and condensed my states and now they are back to just being numbers. I rechecked all of my enums now typedefs and they are all the right type def. Is there a quick way to make them show up as their word counterpart?
10-28-2011 02:57 PM
Nevermind on that last question, I found my error. Too many variables swirling around and got my lines crossed.