LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Error in-out in shift register: yes or no?

I have not understand if it's good or no to pass error in and error out in shift register when it's set a instrumentation in loop. For example in this figure there is this, but many persons tell me that it's dangerous. Why? What is the better way for an exeper LabVIEW programmer?

 

02 - Errors in shift registers.JPG

0 Kudos
Message 1 of 31
(5,561 Views)

Everyone has their own philosphy on this, but I do not typically use a shift register.  My personal style is that each cycle of the loop should start "clean".  If there is an error before the loop starts, I don't start the loop.  At the end of each cylcle of the loop I place my Error Handler.   This error handler decides if the error is fatal and should stop the VI, or in most cases just resets the instrument in question.  After handling (and logging) the error, I reset the error out to no error and start the next cycle.  Whether or not a shift register is used, the cycle starts with no error.

 

My error handler contains a feedback node and I usually consider two consecutive errors to be fatal (this often means time for a power cycle).

 

If you use a shift register and never handle or clear your errors you often wind up in an inifinite loop which spins as fast as the CPU allows.  In short, whether or not you use a shift register you need to decide (as early as possible) what you want to do in the case of an error and how you intend to handle it.

Message 2 of 31
(5,549 Views)
Can you show me a simple example in which there is ERROR HANDLER so I can implement on my VI?
0 Kudos
Message 3 of 31
(5,541 Views)

For me, using the shift register is often very important for error trapping.  Without the shift register, it is very easy to lose the error information.  When you do use the shift register though, you need to make sure that all your subvi have a case structure that case the subvi to not execute but only to feed through the error information.  By doing that, when an error occur, it is just going to feed through all the vi and loop iteration without being corrupted.  If you trap the error, you will be able to trace back to where your bug is in your code.

 

Yik

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

Kudos and Accepted as Solution are welcome!
0 Kudos
Message 4 of 31
(5,535 Views)

Yik,

 

Why would you want to have a while loop continue to run if you aren't going to do nothing in later iterations of the while loop?  You might as well just go ahead and stop the while loop as soon as you get the error.

 

What could be worse is that the while loop might never end because of the error which would happen if the while loop would normally end based on something that would occur in the loop in the No Error case of your while loop.

 

I'd say the only way a shift register on the error wire is a good idea is if you have the NoError/Error case structure inside your loop, and you explicitly do something with that Error in the Error case on the next iteration such as closing/reopening your resource, or logging the error to a file, or triggering off some other process, and the proceed to clear the error so that your while loop goes back to normal operation.

0 Kudos
Message 5 of 31
(5,507 Views)
Very Good, can you do a simple example in which you show me the way in which "you explicitly do something with that Error in the Error case on the next iteration such as closing/reopening your resource, or logging the error to a file, or triggering off some other process, and the proceed to clear the error so that your while loop goes back to normal operation"? Thanks.
0 Kudos
Message 6 of 31
(5,490 Views)
why dont you try it on your own and let all of us know as well 🙂
Regards
Guru (CLA)
0 Kudos
Message 7 of 31
(5,488 Views)
Because I think that this problem it's better that a person that have work with instrument solve. Because many times problems arrive when the VI runs. IF I do alone and after I prove it maybe I understood all alone, but if all person do this it's very stupid to have a forum. Forum it's important to have experience from other persons so we don't repeat the same error of other persons and so we can speak about problem before that problem arrive. I think that forum is good for this reason.
0 Kudos
Message 8 of 31
(5,483 Views)

Michelle...

 

Believe me "nobody gets paid here" for solving any problem...

 

Its their whole and soul interest whether to answer a question asked or to discard the same.Keeping this in mind if you can solve the problem on your own may be tomorrow you can help some one out and you wont end up repaeting the same mistake that you have done earlier.

 

Also it is up to you to take the suggestions given by other fellow  buddies or not to take it.

 

Guru

Message Edited by Guruthilak on 02-24-2010 12:55 PM
Regards
Guru (CLA)
Message 9 of 31
(5,474 Views)

Guruthilak wrote:

Michelle...

 

Believe me "nobody gets paid here" for solving any problem...

 

Its their whole and soul interest whether to answer a question asked or to discard the same.Keeping this in mind if you can solve the problem on your own may be tomorrow you can help some one out and you wont end up repaeting the same mistake that you have done earlier.

 

Also it is up to you to take the suggestions given by other fellow  buddies or not to take it.

 

Guru

Message Edited by Guruthilak on 02-24-2010 12:55 PM

Double dittos to that!

 

Years ago one of my old bosses caught me mubling something along the lines "well that's job security" when talking about something I knew but nobody else. So he say me down and explained what I had to do to succeed.

 


 Ross Beadle to myself:

 

"

 Ben, succesful people go through phases in the carrers.

 

They start not knowing what they should or could do and they need guidance from the more experienced.

Latter they learn to do the job with only occational asistance.

Then they move into phase where they can do it independently and can occationally help others.

If the keep working they can get to the point where they can do their job AND others depend on them to get things done.

 

Unfortunately many people stop at this point thinking they have job security. To truely be valuable they should take the next step and work to train all around them such that the peers can work without assistance thereby freeing themselves to move to the next level.

"


So just learning how to do something is just one step along the path. I have followed Ross's advise and it has served me well. I regularly remind my boss that I am trying to work myself into retirement such that my company will not miss me when I retire. My efforts here and elsewhere are for the same reason.

 

Sorry for the lecture. Sometimes I just have to get it out. Smiley Tongue

 

Ben

Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
Message 10 of 31
(5,459 Views)