BreakPoint

cancel
Showing results for 
Search instead for 
Did you mean: 

Rube Goldberg Code

Totally agree Altenbach.

Working on a project that is totally done that way.  The client wants a fixed cost on this project.  It's impossible.  There's no way of knowing what surprises will be uncovered.

Why do people HIDE bloody controls!!!!???????!!!!! 

You know what's worse??  When they hide Reference Controls!!!!! on the Front Panel.. And worse, it is hidden and located BELOW other Front Panel objects! Now if that wasn't bad enough, the terminal is also hidden BELOW objects on the block diagram!!!  The only way to know that it exists is because it was connected to the connector pane!

And the stop button doesn't work!@!!! 

Well on the bright side, the vi's do not run when opened.  😄

Now, somewhere else, we discussed some coding style coming from text based language and adapting LV to it.  But that does not explain these... At least I hope not.  I still program in C.. 😉  occasionally 😄

 

Altenbach, I think we both need a beer.. 😉 

Message 151 of 2,635
(13,743 Views)
Well hidden controls originate from LabVIEW 7.x (in 8.x), they replace constant case selectors.

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 152 of 2,635
(13,731 Views)


TonP wrote:
Well hidden controls originate from LabVIEW 7.x (in 8.x), they replace constant case selectors.


I can understand hiding them on the Front Panel (visible=false), but NEVER hide them below other objects.  Especially when they are hidden twice (on FP & BD).  😮
 
0 Kudos
Message 153 of 2,635
(13,713 Views)
There are at least two ways to do this, here's the scenic route 😄
  1. label the eight booleans according to the bit position (1..8).
  2. Convert each to a 0,1 integer.
  3. Use a formula express VI and (for fun!) label the parameters x1..x8, but make sure that there is no direct relation between the boolean label and the parameter name, e.g.  "4" <-> X1, "6"<-> X7, etc.
  4. Use formula (X1*8)+(X2*4)+(X3*2)+(X4*1)+(X5*128)+(X6*64)+(X7*32)+(X8*16)
  5. Display the I16 result in a DBL indicator
  6. Coerce the I16 scalar value to dynamic data
  7. convert it to a DBL array with one element.
  8. Coerce the DBL array to a U8 array with one element.
  9. Convert to a string using "byte array to string"

... Or we could just make it into a boolean array, convert to number and cast to a string. same difference! (see inset).

 
 


Message Edited by altenbach on 02-28-2008 10:00 PM
0 Kudos
Message 154 of 2,635
(13,675 Views)

Yeah but look at it...It looks like its doing something important and it takes up a lot of spaceSmiley Very Happy

 

Regards
Ray Farmer
0 Kudos
Message 155 of 2,635
(13,665 Views)
Here's another example from the above mentioned VI. This time we need to convert a hexadecimal formatted string back to 8 booleans.
 
Nothing could be simpler (top frame in image). To better utilize a multicore CPU, we should of course deal with each hex character in parallel, using duplicate instances of the same code. 🙂
 
So many coercion dots, it seems that VI has the measles. 🙂
 
 
For those weirdos who like their code simple, an alternative solution is shown at the bottom. 🙂
(Again, a boolean array indicator with 8 elements would be a better choice and would eliminate the index array and 7 terminals.)
 
 
 


Message Edited by altenbach on 02-28-2008 10:55 PM
Message 156 of 2,635
(13,666 Views)


altenbach wrote:

but make sure that there is no direct relation between the boolean label and the parameter name, e.g.  "4" <-> X1, "6"<-> X7, etc.

At first I was going to laugh and say that this is "nibble endianness", but then I had the sense to actually search for it.
 
Turns out there are devices which reverse the nibble order, so my guess is that this user wants to talk to such a device and this is how they build their string, so at least that point is reasonable.

___________________
Try to take over the world!
0 Kudos
Message 157 of 2,635
(13,659 Views)

If you look at the code, they are actually not really reversed, but nicely in order, at least the way they are numbered. My code, with the bits numbered the same (1-8), gives the same result.

They are only reversed for the express VI. If he really wanted to not cross wired with the terminals arrranged 43218765 (top-to-bottom), he could have labeled the express terminals B4-B3-B2-....-B5.

Who knows? 😄



Message Edited by altenbach on 02-29-2008 12:02 AM
Message 158 of 2,635
(13,657 Views)
If somebody steals all your FOR loops, don't despair. You don't need them anyway! 😄
 
 
 
 


Message Edited by altenbach on 03-04-2008 05:47 PM
Message 159 of 2,635
(13,568 Views)
"If somebody steals all your FOR loops, ...."
 
In LV 8.5 they have not stolen them but they are buried rather deep requiring about five clicks and flaot-overs to get a For Loop from the palettes.
 
Ben
Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
Message 160 of 2,635
(13,547 Views)