LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Error handling and data flow basic

Solved!
Go to solution

hello,

 

I am trying to learn basic error handling and data flow. The attached is a simple VI to implement this. 

 

How do I implement this code to show an error.

 

Thank you.

Abhilash S Nair

Research Assistant @ Photonic Devices and Systems lab

[ LabView professional Development System - Version 11.0 - 32-bit ]

LabView Gear:
1. NI PXI-7951R & NI 5761
2. The Imaging Source USB 3.0 monochrome camera with trigger : DMK 23UM021

OPERATING SYSTEM - [ MS windows 7 Home Premium 64-bit SP-1 ]
CPU - [Intel Core i7-2600 CPU @ 3.40Ghz ]
MEMORY - [ 16.0 GB RAM ]
GPU - [ NVIDIA GeForce GT 530 ]
Download All
0 Kudos
Message 1 of 6
(3,009 Views)

You have not wired one of the outputs of ERROR side of the case structure - you can either wire it according to functionality that you want in case of an error, or right click and select "use default if unwired" (usually that means "0" unless if you have selected a specific default value).  See attached photo to see red circle where your problem is.

 

If you click on "broken play" button on LabVIEW menu, it will tell you all issues with the vi.  If you see a "play" button that means that vi has no issues.

 

-DP

 

BatchTest Corp.

NI Alliance Partner

 

 

--------------------------------------------------------

New Controls & Indicators made using vector graphics & animations? Click below for Pebbles UI


0 Kudos
Message 2 of 6
(3,002 Views)

Please see the attached VI. I have done this now. But I am trying to create an example which shows error out status. How can I change this code to show a Error status ?

Abhilash S Nair

Research Assistant @ Photonic Devices and Systems lab

[ LabView professional Development System - Version 11.0 - 32-bit ]

LabView Gear:
1. NI PXI-7951R & NI 5761
2. The Imaging Source USB 3.0 monochrome camera with trigger : DMK 23UM021

OPERATING SYSTEM - [ MS windows 7 Home Premium 64-bit SP-1 ]
CPU - [Intel Core i7-2600 CPU @ 3.40Ghz ]
MEMORY - [ 16.0 GB RAM ]
GPU - [ NVIDIA GeForce GT 530 ]
Download All
0 Kudos
Message 3 of 6
(2,997 Views)

Perhaps I'm misunderstanding your purpose.  You have already wired things so that  your functionality will get executed as long as INPUT error cluster has no error in it. (In case of any error in the input, that error will get passed to the error OUTPUT).  Now if you're meaning to implement something that you want to show as an error, then you'd have to use "bundle by name" element (under clusters) to inject a value+ optionally some text + a TRUE boolean in error cluster line.

 

For example in case of "Add and increment" case - if output is let's say negative, look at attached clippet in how to do that (I have only shown boolean geting a true value due to limited available area in there, but hopefully that will give you an idea in how to do it.)

 

If you want such error to "pop up a message", you'd have to tie an error handler to error cluster wire (right click on error cluster wire -> Dialog & User Interface Palette -> Simple Error Handler (or General Error Handler).)

 

-DP

 

BatchTest Corp.

NI Alliance Partner

--------------------------------------------------------

New Controls & Indicators made using vector graphics & animations? Click below for Pebbles UI


0 Kudos
Message 4 of 6
(2,990 Views)

Yes. This is what I want to learn. To the point and precise. 

 

So, right now

  1. I am practising to program all my VI to work based on data flow and avoid sequence structures and local variables. 
  2. Build Sub VI with error handling. So that the Main VI will be easy and less clustered.

One last question. So in any VI, if I want to display a (value+ optionally some text + a TRUE boolean in error cluster line) if at all any error occurs then I jiust have to use bundle by name element under cluster wire right? What about the Value ? How do I know what error value should be given ? I think LabView assigns thats Value right ?

 

 

 

Thank you.

 

 

Abhilash S Nair

Research Assistant @ Photonic Devices and Systems lab

[ LabView professional Development System - Version 11.0 - 32-bit ]

LabView Gear:
1. NI PXI-7951R & NI 5761
2. The Imaging Source USB 3.0 monochrome camera with trigger : DMK 23UM021

OPERATING SYSTEM - [ MS windows 7 Home Premium 64-bit SP-1 ]
CPU - [Intel Core i7-2600 CPU @ 3.40Ghz ]
MEMORY - [ 16.0 GB RAM ]
GPU - [ NVIDIA GeForce GT 530 ]
0 Kudos
Message 5 of 6
(2,979 Views)
Solution
Accepted by topic author abikutn

You'd have to assign a value of your choice to the error cluster - in errors generated by LabVIEW functions, error is already assigned/etc but for custom user errors, the user has to assign values.  Just make sure to not use same error values as what LabVIEW uses for predefined errors. If you do a search for error codes, you'll be able to find such error code ranges - so pick something that is not already use.

 

And yes - using an error handler would be a simple way to accomplish what you're trying to do. That Error handler will only popup a message in case of an error so your functionality will remain smooth.

 

-DP

 

BatchTest Corp.

NI Alliance Partner

--------------------------------------------------------

New Controls & Indicators made using vector graphics & animations? Click below for Pebbles UI


Message 6 of 6
(2,971 Views)