05-16-2022 09:56 AM
Hi Guys,
I am using the producer/consumer architecture that is currently acquiring an analog input (producer) and then performing some signal filtering and peak detection (consumer), then finally saving the data. The data is from a photodiode measuring laser intensity and is attached as photodiode_thickness.vi.
I have another separate vi that is controlling a motor in another part of my process attached as Spin-coater.vi. This allows me to supply a rpm profile and run the vi to supply an analog output to my servo to spin the motor. In addition to the analog signal my motor also takes a digital enable, which is true when the rpm profile is not equal to zero, and false when it is. (This is necessary as otherwise due to the motors control you end up with back and fourth oscillation when supplying an rpm of 0).
Both of these vi's work as I need them to separately, however, ideally I would like to be able to run the Spin-coater.vi and have my other producer/consumer photodiode_thickness.vi start/stop the data acquisition according to the digital enable of the motor. So that when my motor's rpm > 0 it is acquiring data and when its rpm = 0 it is not. I have tried two approaches so far:
Essentially my question is how to I get my producer loop to 'listen' to a boolean value to decide when it starts and stops my data acquisition.
NOTE: A typical rpm profile will look like 0s 0rpm, 5s 0rpm, 6.5s 1500rpm, 12.5s 1500rpm, 14s 0rpm and so I'd like my producer active between 5s and 14s.
05-16-2022 11:16 AM
You need to keep reading from the DAQ or you will get buffer overrun errors. But that does not mean you have to process the data. So add a case structure around the Enqueue Element calls so you don't pass the data on to the consumer. You will need to add a little more to make sure you stop all of your loops properly when you need to regardless of the rpm value.