04-08-2010 10:11 AM
It's not working!!!
Is it something to do with the fact the enum is U16?
Have I found a horrible bug in 8.6?
04-08-2010 10:18 AM
James W wrote:It's not working!!!
Is it something to do with the fact the enum is U16?
Have I found a horrible bug in 8.6?
No, you've found a horrible bug in your coding.
You're never concatenating the string inside your loop. The Format Into String has a "initial string". Wire this to the left part of the shift register. The "resulting string" output goes to the right part of the shift register. You will need to change the format string to "%d;". This will give you an extra colon at the end, which you can chop off.
04-08-2010 10:28 AM
Ok,
Not to be rude to an Knight of NI, but I have that mess as a result of debug.
I'm trying to get at least 1 array of strings on the output with a meaningful array of message strings in it.
e.g. if the input is 0E80, I don't want an array that says 7, 9, 10 & 11. I want to know which ports are connected - i.e. DGPS, Sensor 1, Sensor 2 & Sensor3.
Unfortunately I can only seem to see the numeric value of the enum being converted to text.
This is downright annoying.
I've checked my other code and this seems to work with other enums, so I can't see what the problem is here.
Anyone else seeing numerics only in the string arrays, of do I have a code corruption on my PC?
James
04-08-2010 10:32 AM
The output of your subVI is an array of U16, not an array of enums. You will never get strings like "DGPS" etc. directly from that.
Please upload the typedef.
04-08-2010 10:36 AM
Here is the Type Def. I don't understand why it isn't connected.
(Thanks for the quick response and not taking [obvious] offense):smileyhappy:
James
04-08-2010 11:04 AM - edited 04-08-2010 11:05 AM
Hi James,
you really could have made this a lot easier: your "enum" isn't one! Your typedef is a ring! From rings you only get the number. You have to create the string array by using a property node and an additional IndexArray node...
04-08-2010 11:19 AM
GerdW wrote:Hi James,
you really could have made this a lot easier: your "enum" isn't one! Your typedef is a ring!
Indeed, that's the fundamental problem - you have a ring, not an enum, so no about of jumping through hoops will change that.
James: Why did you think you had an enum?
04-08-2010 11:25 AM - edited 04-08-2010 11:26 AM
Hi James,
I have to add: my example only works because you used "sequential values" for your ring values. When using arbitrary numbers you have to use the "StringAndValues" property with an additional array search node to find the string's index...
04-08-2010 12:12 PM
ARGGHHHHHH!!!!
not a ring - DOH
smercurio_fc wrote:
GerdW wrote:Hi James,
you really could have made this a lot easier: your "enum" isn't one! Your typedef is a ring!
Indeed, that's the fundamental problem - you have a ring, not an enum, so no about of jumping through hoops will change that.
James: Why did you think you had an enum?
Why do I think it's an enum? - because I hardly ever use rings, the numbers are sequential and I had no reason to use a ring for this control. I (almost - it seems) always revert to enums for my strict typr def controls.
Poor. Poor. Poor Code.
Sooooooooooo Ashamed (hanging head)
Thank you.
- When no one reviews your code on a project this big it's the little mistakes that jump up and bite you in the ar** and give you splinters from scratching your head.
04-08-2010 12:25 PM
D*mn and D*mn again. I've just worked out why it's a ring not an enum.
When I have a long list of consecutive values to turn into a Type Def Enum, I don't type them into the enum.
I:
1) create a ring control and pass an empty strings and values array to a property node of it
2) create an array of strings with the strings in the order I want them.
3) pass the array through a FOR loop and bundle the string with the iteration count.
4) pass the indexed bundle out of the FOR loop into the strings and values of a Ring property node
5) right click on the FP and replace the ring control with an Enum which retains all my values I have just programmed in.
6) customise it.
I must have missed out step 5. (I only do this beacuse the dialogue entry is sooo slow ans enums can't be populated at run time.)
Sorry.
James