08-25-2020 03:11 PM - edited 08-25-2020 03:17 PM
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 third 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
08-26-2020 09:03 AM
I found that I mixed up the attachments but cannot edit the post any more. So I posted again with updated attachments:
Analog output with program trigger based on analog input level
Thanks