ni.com is currently undergoing scheduled maintenance.

Some services may be unavailable at this time. Please contact us for help or try again later.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Analog output with program trigger based on analog input level

Hi,

 

I'm trying to generate a sine wave when the value of analog input reaches a certain threshold. I'm using USB6216 which does not support analog trigger so I'm wondering if it possible to do it by programming.

 

I worked on example VIs 'analog input continuous' and 'analog output on demand'.  It is doing what I want other than that I need to keep pressing start button in 'analog output on demand' program. In the code, I compare the input to the threshold and give the boolean result to a global variable. It is then connected to a case structure in the output VI.

 

I want to further automate it so I made the same modification to the example VI 'voltage analog output continuous', see attachment '0825part2_output_continous'. It does not work.

 

If I start the output VI after the threshold value is reached, it output wave but gives 'error 200479: specific operations cannot be performed while the task is running.'

When I start output program with input below threshold, it gives 'error 200802, possible reasons: write cannot be performed when the task is not started, the sample timing type is something other than on demand, and the output buffer size is zero.'

 

I checked the error code and I feel it is related to how I use case structure to turn on only certain part of the code. I tried various things and could not figure it out. Please let me know how to debug it or if there is a better way of doing this. Thanks in advance!

 

Jiarui

0 Kudos
Message 1 of 1
(1,392 Views)