09-26-2011 07:11 AM
Hi all,
I'm looking at this - NI-DAQmx: Retriggerable Analog Output -- LabVIEW
http://zone.ni.com/devzone/cda/epd/p/id/4787
It is exactly what I want. However, I am using my NI-DAQ on Matlab.
I own a PCI 6259.
Anyone know what are the flags I need to apply to enable this option?
I'm trying to make matlab output a ramp function when it receives a digital trigger in (In line PFI1).
So far, it works fine. However, I'd like it to output the same data loaded everytime I trigger it. Currently the only way I can do that is by loading the data on the card again, and again. (This is slow and very inefficient)
I've also posted this question to the Matlab answer boards, but no one there had any idea how to do it --most didnt even think it was possible to retrigger!
Thanks for your help,
ao_Ref = analogoutput('nidaq','Dev1');
addchannel(ao_Ref, 0);
set(ao_Ref,'SampleRate',10000);
set(ao_Ref,'TriggerType','HwDigital')
set(ao_Ref,'HwDigitalTriggerSource','PFI1');
putdata(ao_Ref, xt)
start(ao_Ref)
09-27-2011 02:01 PM
Mat,
The closest thing that I can think of that might help is the C text based examples that ship with Labview. I have attached the example to this post. You might be able to convet them to matlab One other option that you might consider is to use your matlab code within labview using a matlab script node and then doing all of your hardware setup natively in Labview.
Jacob K
10-25-2012 07:15 PM
Hi Jacob,
I stumbled across this post as I am trying to do the same thing with an NI USB6259.
Could you send me the example code that you are talking about (I did not see it attached the post).
Thanks,
Patrick
10-26-2012 09:03 AM
Hi Patrick and mcleung,
mcleung, it sounds like you want to use regeneration for your application. I don't know if the Matlab DAQ toolbox supports this funtionality, although your board does. You may need to compile some c-code into a dll and call that from matlab.
Patrick, all of the text based examples can be found by installing daqmx from ni.com/drivers and then looking at the National Instruments folder in the start menu.
10-26-2012 09:17 AM
Hi Jesse,
Thanks for the quick reply. I took a look at the ANSI C example file titled: MultVoltUpdates-IntClk-Retrig.c in the folder Mult Volt Updates-Int Clk-Retriggerable.
According to the comments, it appears that this is what I'm looking for, but I just don't see it in the code. It looks like it:
1) Creates a task
2) Creates a channel
3) Configures the sample rate
4) Fills the data buffer
5) Starts the output
6) Waits for it to finish.
While I haven't tried the example on my hardware, I don't see anywhere where they set the device to be retriggerable.
Based on some searching, I think the codes needs something along the lines of:
DAQmxSetTrigAttribute (task,DAQmx_StartTrig_Retriggerable, TRUE));
Can you confirm this?
Thanks,
Patrick
10-26-2012 10:11 AM
Hi Patrick,
That sounds right. Try running the program and see if you get an error. Not all devices support regeneration but 62xx and 63xx series should.