02-07-2007 10:12 PM
Hi everybody, I've been stuck with this problem for two days straight and don't seem any nearer to a solution. I would thoroughly appreciate any help any of you could give me.
As part of the test system I'm trying to set up, I have an analog input signal (50Hz sine, +/-8V, differential inputs) and several digital output signals. By setting one of these digital signals high, a relay (in hardware) is switched on, something goes open circuit, which means the analog input signal goes to zero. So, as long as the digital signal is low, I can read in this sine wave, but when set the digital signal high, the sine wave disappears.
I'd like to set up a way of setting this digital signal high when the sine wave reaches it's peak (or really, any value above 7.5 is fine) - to achieve, in essence, a cut-off sine wave. Later, the digital signal will be set low again, the sine wave will appear again, and I'll repeat the test later.
I am having a nightmare trying to get this working. I've experimented with peak detection and threshold detection VI's - the problem is: You can't really 'react' to the peaks because you don't get any information about peaks until the detection VI has finished it's execution. I've tried setting up a while loop with a simple "1 channel, 1 sample" read system (based on the DAQmx Create Channel, Start Task, Read, Clear Task VI's) , and then comparing the single sampled value to a threshold - the problem is, each iteration of the loop seems to take 8ms, which is far too long.
Since max sampling rates according to specs of the NI-6224 card are 250kS/s, is there no way that there can be a simultaneous 'read-in'/'read-out' system, where I could sample at 1kHz, but keep doing a compare on the value being read in, in real-ish time?
02-07-2007 11:50 PM
Hi Chris,
I'm sure this can be done easily, I just don't know the best way. One way (not necessarily the best) would be to use an analog edge to trigger a "counter" (TTL) OUTput. Start with the "Gen Dig Pulse-Dig Start" Example and modify it to trigger on an analog edge. If the analog-trigger needs a 0-5V value, just use a couple of identical resistors to divide your voltage-in. You'll have to learn some details in order to control the Counter's OUT state (high or low) post-trigger.
But don't do that! Better (simpler) would be to use an analog-edge to trigger a digital-output (not a Counter) - I'm just not familier enough with the NI-6224 to know this is possible - still, try to make THIS work first!
Cheers!
02-08-2007 05:56 PM
02-09-2007 08:27 AM
02-10-2007 02:36 AM
Hi David,
Thanks for straightening me out on this. I've used the level-triggering - for an analog task - and thought that all trigger-events were routable - so could be used by the counter too. Do you know where this subject is documented? (not that I don't trust you. - )
Cheers.
02-12-2007 08:01 PM - edited 02-12-2007 08:01 PM
"When you configure an Arm Start Trigger, a counter task does not respond to any Start Triggers until after the Arm Start Trigger occurs. You can configure this trigger to occur on a digital edge. The Arm Start Trigger is separate from a Start Trigger and is typically used in advanced counter/timer applications. You might use an Arm Start Trigger to synchronize multiple tasks, such as counting edges and pulse generation. The Start Trigger then would be used to start the acquisition or generation."
As mentioned above the trigger can be configured only for digital edges.
As far as using the Analog Comparison Event to know when the device receives and analog trigger, here is an article that talks about that.
Where is ATCOUT in NI-DAQmx? How Do I Know When My DAQ Device Receives an Analog Trigger?
Regards,
Raajit L
Message Edited by Raajit L on 02-12-2007 08:01 PM
02-12-2007 10:27 PM - edited 02-12-2007 10:27 PM
Hi David, Raajit,
Raajit, this: "When you configure an Arm Start Trigger, a counter" applies to triggering multiple counters simultaneously - we don't need to do that here.
This link suggests it is possible to use an analog start-trigger together with a counter.
Specifically: "If your board supports analog hardware triggering, there is an internal signal that is high whenever the signal on the trigger channel meets the trigger conditions. This signal can be routed to the counter to control it.
As I said, I haven't done it, but this states it's possible!
Cheers.
Message Edited by tbd on 02-12-2007 10:28 PM
Message Edited by tbd on 02-12-2007 10:30 PM