NI Home
Cart Cart | Help
Company Events Academic NI Developer Zone Support Solutions Products & Services Contact NI MyNI
You are here:
NI Home > NI Developer Zone > NI Discussion Forums


LabVIEW
Register  ·  Sign In  ·  Help
Jump to Page:   1 · 2 · 3 · 4  |  Next Page
  Reply   Reply  

Darren's Weekly Nugget 02/23/2009   [ Edited ]
Options    Options  
Proven Active Veteran Darren
Proven Active Veteran


Darren

Message 1 of 36

Viewed 2,766 times


This nugget is the first in a series of nuggets on Case structures.   Case structures have been around since LabVIEW 1.0.  They are by far the most commonly-used block diagram object...there are more than twice as many Case Structures as there are For Loops (the 2nd most common object) in all the VIs in the shipping LabVIEW codebase.  A Case structure can accept five different data types at its selector terminal:  Boolean, Numeric, String, Enum, and Error cluster.  Today's nugget will discuss the use of Boolean and Error selectors.

 

Boolean selector

The default data type of a Case Structure selector terminal (i.e. the type it has when you drop it on your diagram) is Boolean.  Thus, a standard Case Structure has a True case and a False case:

 

 

 

 Error selector

You can also wire an error cluster data type to the selector terminal.  In this case, you will have an Error and a No Error case:

 

 

 

 In this situation, the case structure is simply checking the value of the status boolean within the error cluster.  So the following code snippets are equivalent:

 

 

 

As a general rule, if you are writing VIs that have error in/error out terminals, you should wrap the diagram code with an error case so the subVI code can skip execution on an incoming error.  Most of the VIs that ship with LabVIEW use this technique.  There is also a VI Analyzer Toolkit test called "Error Style" that ensures your diagram is wrapped with an error case if there are error terminals on the connector pane.

 

-D

P.S. - Check out past nuggets here

Message Edited by Darren on 02-23-2009 04:29 PM

 

Darren Nattinger, CLA
LabVIEW Artisan and Nugget Penman

 

Attachment boolean_case.png (4 kb)
Attachment error_case.png (4 kb)
Attachment error_status_unbundle.png (5 kb)

4
Kudos!
02-23-2009 04:28 PM

All Users' Tags:

  Reply   Reply  

Re: Darren's Weekly Nugget 02/23/2009   [ Edited ]
Options    Options  
Proven Veteran LabBEAN
Proven Veteran


LabBEAN

Message 2 of 36

Viewed 2,755 times


The Stop and Select nodes also accept the error cluster following the same logic.

 


 They are by far the most commonly-used block diagram object...there are more than twice as many Case Structures as there are For Loops (the 2nd most common object) in all the VIs in the shipping LabVIEW codebase.


 

Very interesting... Would you come clean if there were a bunch of stacked sequences hiding behind those locked diagrams?  :smileyhappy:

 

Aside - I've noticed you've turned off "Show dots at wire junctions".  Any reason?  (Am I not in the "club" if I thought "dots" were a great addtion a few releases ago?)

Message Edited by LabBEAN on 02-23-2009 05:55 PM

 

Certified LabVIEW Architect
www.blueridgetest.com
Rapid Design, Development and Deployment of Automated Solutions
2
Kudos!
02-23-2009 04:53 PM
  Reply   Reply  

Re: Darren's Weekly Nugget 02/23/2009
Options    Options  
Proven Active Veteran Darren
Proven Active Veteran


Darren

Message 3 of 36

Viewed 2,727 times


There are definitely some Stacked Sequence structures lurking in the LabVIEW codebase, although certainly not in any of the VIs I write.  I just did a quick check of the LabVIEW 8.6 core codebase, and I'll just say that for every Stacked Sequence structure with 2 or more frames, there are roughly 150 Case structures.  Do with that ratio what you will.  :smileywink:

 

 As for dots at wire junctions, I think they're ugly.  But I also think I'm in the minority with that opinion, so I'm probably the one who's not in the "club".

 

-D


 

Darren Nattinger, CLA
LabVIEW Artisan and Nugget Penman
Kudos!
02-23-2009 06:16 PM
  Reply   Reply  

Re: Darren's Weekly Nugget 02/23/2009
Options    Options  
Proven Enthusiastic Veteran Ray Farmer
Proven Enthusiastic Veteran


Ray Farmer

Message 4 of 36

Viewed 2,697 times


I'm not keen on the Dots, but my real hate is those Iconize terminals on diagram. :smileymad: That's the first think I switch off along with making the labels transparent.

 

Regards

Ray Farmer

1
Kudos!
02-24-2009 12:46 AM
  Reply   Reply  

Re: Darren's Weekly Nugget 02/23/2009
Options    Options  
Proven Active Member Wiebe@CARYA
Proven Active Member


Wiebe@CARYA

Message 5 of 36

Viewed 2,663 times


"Ray Farmer" <x@no.email> wrote in message
news:1235459419707-858847@exchange.ni.com...
> I'm not keen on the Dots, but my real hate is those Iconize terminals on
diagram. :smileymad:&nbsp;That's the first think I switch off along with
making the labels transparent.&nbsp;RegardsRay Farmer

Ray, we're on the same page with the terminals and dots. I'm not sure if
it's because it's new, or just ugly...I don't care much about those labels
tough...

Another thing I really don't get is that the maximum nuber of undo's is set
to 8 by default... I usually put it to 80 or something...

Regards,

Wiebe.


2
Kudos!
02-24-2009 04:10 AM
  Reply   Reply  

Re: Darren's Weekly Nugget 02/23/2009
Options    Options  
Proven Zealous Veteran tst
Proven Zealous Veteran


tst

Message 6 of 36

Viewed 2,648 times


I personally like the dots and think they help to make the diagram clearer, and I also got used to the transparent labels after switching to 8.6. I don't like the terminals as icons, but I feel that NI is probably correct to have that as the default. In both cases, though, it's just a matter of personal taste. Since the setting is global, debating it is irrelevant.

 

Of course, I can't say the same about the undo. Most people probably have more need to be able to undo a lot than problems with the extra RAM this feature requires. Now, if only we had someone who was in the LabVIEW R&D department and who could push to change this default to a large number...


 


___________________
Try to take over the world!
1
Kudos!
02-24-2009 05:11 AM
  Reply   Reply  

Re: Darren's Weekly Nugget 02/23/2009
Options    Options  
Proven Veteran VADave
Proven Veteran


VADave

Message 7 of 36

Viewed 2,633 times


I also like the Dots - a relic from my schematic capture days.  I also HATE the Iconized controls - they take up too much realestate  and detract from the otherwise clean code. Other items I turn off is Auto Tool, Auto Wire, Wire Route, Red X's on wires.  Before I start an uproar on the Auto Tool.  I tried it for six months (LabVIEW 8.5) and I can code faster without the tool on.  Most of my LabVIEW career has been without the Auto Tool
 

VADave
CLA

Using LabVIEW since 1.2, LabVIEW FPGA
Kudos!
02-24-2009 06:16 AM
  Reply   Reply  

Re: Darren's Weekly Nugget 02/23/2009
Options    Options  
Proven Active Member Wiebe@CARYA
Proven Active Member


Wiebe@CARYA

Message 8 of 36

Viewed 2,609 times


Well, I love the auto tool!

Let's just say it is great that all those features can be turned on and off!

Regards,

Wiebe.


1
Kudos!
02-24-2009 08:10 AM
  Reply   Reply  

Re: Darren's Weekly Nugget 02/23/2009
Options    Options  
Proven Active Veteran DFGray
Proven Active Veteran


DFGray

Message 9 of 36

Viewed 2,597 times


De gustibus non est disputandum!

 

I learned that phrase in high school Latin class, and it dates from the Romans.  Roughly translated, it means "there is no disputing tastes."  I think we have verified its veracity.

 

That said, I can chime in with my favorite changes:

  • Autowire - off
  • Labels - transparent
  • Structure autogrow - off
  • Autotool - on
  • Automatic error handling - off
  • Number of  undos - maximum
  • Wire dots -On (default now)
  • Coercion dots - orange (default now)
  • Block diagram grid - off
  • Front panel grid - on
  • Snap to front panel grid - off
  • View terminals as icons - off

 

Using LabVIEW 8.2.1, 8.5.1, 8.6.1, and 2009 on Windows XP and Windows Vista 64-bit
1
Kudos!
02-24-2009 08:29 AM
  Reply   Reply  

Re: Darren's Weekly Nugget 02/23/2009   [ Edited ]
Options    Options  
Proven Active Veteran Darren
Proven Active Veteran


Darren

Message 10 of 36

Viewed 2,561 times



tst wrote:
Now, if only we had someone who was in the LabVIEW R&D department and who could push to change this default to a large number...

It would not be unreasonable to expect the default value of max undo steps to increase in a future LabVIEW version.

 

-D

 

P.S. - All this talk of LabVIEW preference settings is motivation for me to write my blog entry on my Tools > Options settings.  Maybe I'll get it knocked out sometime this week.

Message Edited by Darren on 02-24-2009 10:13 AM

 

Darren Nattinger, CLA
LabVIEW Artisan and Nugget Penman
2
Kudos!
02-24-2009 10:08 AM
Jump to Page:   1 · 2 · 3 · 4  |  Next Page
By using this web site, you accept the Terms of Use for this web site. Please read these Terms of Use carefully before using any part of this site. Please go here for information on ni.comâ s copyright infringement policy.
My Profile | Privacy | Legal | Contact NI © 2010 National Instruments Corporation. All rights reserved.