LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

problem when writing a value to an enum

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.

Message Edited by maximint on 02-09-2009 06:20 AM
0 Kudos
Message 1 of 8
(3,330 Views)

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.

 

0 Kudos
Message 2 of 8
(3,316 Views)

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.

0 Kudos
Message 3 of 8
(3,302 Views)

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

Free Code Capture Tool! Version 2.1.3 with comments, web-upload, back-save and snippets!
Nederlandse LabVIEW user groep www.lvug.nl
My LabVIEW Ideas

LabVIEW, programming like it should be!
0 Kudos
Message 4 of 8
(3,298 Views)

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.

0 Kudos
Message 5 of 8
(3,289 Views)

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.

Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
Message 6 of 8
(3,275 Views)

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?

 

 

0 Kudos
Message 7 of 8
(3,232 Views)

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

Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
Message 8 of 8
(3,214 Views)