01-21-2010 04:56 PM
I have a vi that is getting a number our of a string coming from a serial device.
The problem is if the device sends back bad data my vi errors in scan from string function where I convert the string to number.
Is there a way to check a string and make sure is a number before trying to convert it to a numeric?
Or a way to at least supress the popup error message so my progam does not just stop?
01-21-2010 07:25 PM
Do you have any special plan for determining what is a valid string for conversion to a number that would be better than what the conversion function is doing already?
Just use the conversion function and make sure you have proper error handling. If you leave a function like that where errors are possible without wiring the error out somewhere, than a dialog box will popup. (Although there is a setting in VI properties/Execution where you can disable automatic error handling (uncheck the Enable box). That will suppress the popups. But it is not a good substitute for doing your own error handling in your VI.
If you get a bad conversion, what do you want to do? Send the error to an onscreen error indicator? Light up an onscreen boolean LED? Log it to file? Retry the operation?