02-09-2009 06:17 AM - edited 02-09-2009 06:20 AM
Hi together,
I'm facing a problem when using an enum in my state machine.
From time to time, the value (which represents the next state) which comes from the
shiftregister, is not stored correctly into my enumvariable.When I probe point "1",
a different value is shown than the variable "states" contains.
Does anybody has an idea? Thanks.
02-09-2009 06:26 AM
It's difficult to tell from just that code snippet. Where does the error cluster wired to the property node come from? The update of the states indicator depends on that error cluster.
02-09-2009 06:45 AM
attached more code:
by the way, I can see the state indicator on the front panel and it is not updated. And this happend only from time to time.
Thx.
02-09-2009 06:48 AM
There are other ways to get the string-value of an enum (format into string with a %s formatter for instance).
But I have no idea what you are seeing.
However I would not use the enum to string technique chose you have, just add the enum to the 'file' VI as an input.
And the =0 comparison you have is useless, add the enum to the case structure as the selector.
Ton
02-09-2009 07:05 AM
but the problem is not how to get the text from the enum, the problem is, that the enum
does not contain the correct data. Example:
I write a "5" into the state enum but on the front panel I can see that the state enum still contains the old value "4".
That is my problem.
Thx.
02-09-2009 07:38 AM
Is your enum a "Type Definition"?
By maikg it a type def and replacing all non-type-def'd versin with the type def, you should be able to define the type def once and all instances will updates togeter.
Ben
PS See my Nugget on Type Definitions here.
02-10-2009 03:21 AM
Hi again,
yes, my enum is a type def and all constants are also based on a type def.
So, I removed the enum variable "states" from the project and inserted a new one with another name
based on the same type def. The result is: the problem seems to be gone.
I dont know how this happended, but for me it's strange. I wanted to reproduced again the problem
by deleting the complete project and using an old version, where the old variable is still used.
But here, the same thing: I'm nomore able to reproduce the problem.
What's going on there?
02-10-2009 05:43 AM
we are in speculation teritory now.
I suspect one or more of those constants wre not type-def'd. Your work fixed it and all is as expected.
Ben