Doon Posted December 13, 2006 Report Share Posted December 13, 2006 I only thought of this after a month of programming in Java (i.e., I'm out of the LV mindset): To my knowledge, LabVIEW case structures -- when wired to an Error data-type -- only allow two conditions: "Error" and "No Error". I need a way to handle "Error, code X" and "Error, code Y" and a default (unhandled) Error. Right now my only solution is to nest two case structures, one to catch the error, and one to catch the code. It bothers me that I have to send so many tunnels through nested cases. :headbang: Thanks, in advance, --H Quote Link to comment
cspowell Posted December 13, 2006 Report Share Posted December 13, 2006 Are you passing warning meesages? If not you could just use the error code case, and an error code of 0 is no error. Quote Link to comment
Ton Plomp Posted December 13, 2006 Report Share Posted December 13, 2006 Hi Doon, well two cases shouldn't be a big problem but here are my two cents: The error code is a I32, In LV 8 we got the I64. Now if you have an error shift the error code 32 bits up. with that method you could only use one case. The code looks quite complex, but if you want to seperately look for errors and codes (you could also skip the error boolean and look only at the code) Prior to eight you could do similar things. But I think if you only look at the error code you will get the information you want. Ton Quote Link to comment
crelf Posted December 13, 2006 Report Share Posted December 13, 2006 It bothers me that I have to send so many tunnels through nested cases. Whilst I think that you're being a wee be dramatic, I agree - a native case structure with error codes as selectors would save a bit of code, and (not being privvy to LabVIEW source code) I don't think that'd be too difficult to implement (?) Are you passing warning meesages? If not you could just use the error code case, and an error code of 0 is no error. You could even filter warnings with a -ve case selector. Quote Link to comment
Aristos Queue Posted December 14, 2006 Report Share Posted December 14, 2006 Are you passing warning meesages? If not you could just use the error code case, and an error code of 0 is no error. Actually, GPIB uses error code zero, so be careful with that idea. Error 0: Error connecting to driver or device. I have no idea what conditions make this error code be returned, but there you have it. One of those legacy things from years ago. Quote Link to comment
Ton Plomp Posted December 14, 2006 Report Share Posted December 14, 2006 You could even filter warnings with a -ve case selector. Sorry Chris, but I thought I had seen everything a lot in LV, but what is a '-ve case selector', I know the 8.x palettes messed with our heads but this? Ton Quote Link to comment
robijn Posted December 14, 2006 Report Share Posted December 14, 2006 Actually, GPIB uses error code zero, so be careful with that idea. Error 0: Error connecting to driver or device. Yes, which idiot introduced that I always use the attached VI called Suppress error codes.vi which removes given errors from the wire. The errors to remove/suppress are specified with an I32 array. When one of those errors has been found it is removed and a boolean indicator is set so you can respond to the error. You could then create your own error instead of the old one, or perform some action. It also removes warnings that match the given number so you can also remove for example the VISA warning for "More characters are waiting in the buffer" (of which I don't know the error code because it is specifically chosen to be impossible to remember). Joris Download File:post-1555-1166086583.vi Quote Link to comment
crelf Posted December 14, 2006 Report Share Posted December 14, 2006 Actually, GPIB uses error code zero, so be careful with that idea. Error 0: Error connecting to driver or device. :thumbup: You learn something new every day! but I thought I had seen everything a lot in LV, but what is a '-ve case selector', I know the 8.x palettes messed with our heads but this? Glad to hear I messed with your mind Ton! All I meant was: Quote Link to comment
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.