LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Using Trigger Signal to Trigger Write to File

I am attempting to use an external digital signal to trigger the start of a write to an excel file when the digital signal goes down to -1V. I've also written in an "or" function to allow me to manually start writing to the file. However, it automatically starts writing to the file when i start running the code whether or not the digital signal is lower than the threshold voltage.

Rotorcraft_Lab_0-1581715208780.png

 

0 Kudos
Message 1 of 3
(2,569 Views)

It could be the value is less than -0.5, or Write to Excel is true, or the False case of your case structure also writes to a file. Have you tried probing the wire values while the VI is running?

Message 2 of 3
(2,535 Views)

This is gonna sound harsh but there are some major problems here unless I just fundamentally misunderstood something from your picture, but here goes. It's fixable, but there are a lot of issues.

 

First, your entire digital read is wrong, and you have two independent DAQ devices. Does your Trigger Signal plot look OK? You're only reading a single digital pin, which can only have the value of T or F. I don't have a myDAQ, but I assume it's a 0 or 5V signal. It can't ever be -1 V unless you've got it configured some other way. Second, you're using "Digital to analog", then wiring the "full scale range" output to the Compare function. Even if the digital read could do -1 V, this function wouldn't change anything, because the default value of that function is 2, and it'll always return a 2, regardless of your input data. Also, you have no timing set up on the Digital Input task, so who knows how long your task is running or how fast. You're asking the digital channel to read 500 samples at some rate- you need a DAQmx Timing vi in there somewhere.

 

Additionally, you have at least two Read operations (looks like a third down below) in the same loop; unless they're perfectly synchronized (can't tell from just a picture) then one will be waiting on the other to finish all the time.

 

Thus, either the False section of code is writing to a file, or Write to Excel is True. You didn't post actual code (a .vi file) so we can't say for sure.

 

I would recommend reading up on the DAQmx examples to see how to do multi-channel reads. I would also suggest combining the two microphone channels into a single task with two channels- it'll be a lot easier.

 

I'd also recommend using an analog channel to detect your trigger, and comparing values on that. I'm not sure why you're trying to use a digital channel to measure a value of -1 V- that's an analog value, so you should use an analog channel.

Message 3 of 3
(2,529 Views)