07-12-2011 11:22 AM
I am trying to write a program than can send digital signal to an external oscilloscope. I am using NI-USB-6008. The program runs but when I hit "STOP" button (while the On/Off signal's boolean switch is on) the oscilloscope still shows an ON signal.
The problem: How to switch the boolean to Off immediately when I press STOP?
I tried using "Clear Task" and "joining the STOP button with the boolean switch but nothing change. Please find attached my program.
Solved! Go to Solution.
07-12-2011 11:34 AM
ORing the stop button will obviously not work since you would be sending a True from the button.
Simply do another DAQmx Write before the clear task.
07-12-2011 12:37 PM - edited 07-12-2011 12:37 PM
07-12-2011 12:48 PM
since you are looking at error status in the loop conditional logic I would recommend putting a second write outside the loop to garantee the write happens when exiting on error. Additionally, add an error handler after the clear task .
07-12-2011 01:19 PM
@Jeff Bohrer wrote:
since you are looking at error status in the loop conditional logic I would recommend putting a second write outside the loop to garantee the write happens when exiting on error. Additionally, add an error handler after the clear task .
Depending on what the error was, the last write might fail inside or outside the loop, so there is no real difference to my suggestion.
You would also need to clear the error before the last write outside else it would not do much anyway..
07-12-2011 01:35 PM
@altenbach wrote:
@Jeff Bohrer wrote:
since you are looking at error status in the loop conditional logic I would recommend putting a second write outside the loop to garantee the write happens when exiting on error. Additionally, add an error handler after the clear task .
Depending on what the error was, the last write might fail inside or outside the loop, Exactly- and the most compelling reason to add an error handler
so there is no real difference to my suggestion. Except the user is notified of the error and that the hardware may not be in the expected stateYou would also need to clear the error before the last write outside else it would not do much anyway..Pssst it was or more correctly the write outside was not passed the error out from the loop and a merge errors is used to pass on the error information
07-12-2011 01:38 PM
Fortunately, automatic error handling is enabled by default... so the clear task will bark anyway. 😄
07-12-2011 01:50 PM - edited 07-12-2011 01:50 PM
@altenbach wrote:
Fortunately, automatic error handling is enabled by default... so the clear task will bark anyway. 😄
Oh- I've dissabled error handling in my LabVIEW.ini so long ago that I forgot. Didn't everyone?![]()
07-12-2011 01:53 PM
I don't really care to leave it enabled, because my code never produces any error anyway... :o:D
07-12-2011 02:42 PM
Thanks a lot. Actually, I am new to LabView, would you suggest me any book with enough tutorials and exercises that can help me?