Multifunction DAQ

cancel
Showing results for 
Search instead for 
Did you mean: 

How do you do continuous analog output that is timely?

I have looked at all the examples both from NI and posted on the forums and they all seem to until I look at the output coming from the from the card and it can take several cycles before the output starts to reflect changes that I make to the output waveform. This is a particular problem for my current application because each cycle of the output waveform takes about 7 seconds to complete.

 

The analog out is being externally clocked and is triggered. The triggering is set to Start retriggerable because with each trigger I need to output exactly 141 datapoints and then stop until the next trigger occurs. That much is working like a champ.

 

I have the DAQmx Write set to Do Not Allow Regeneration and the hardware's (USB-6363) output buffer is set to the dataset size (141 samples). Once all the DAQ is setup I write the first cycle of the output signal (141 samples) and start the task. From there on I write another 141 samples every 7 seconds. All seemed to be working until I looked at the output with a scope. When I change the data being sent it started with a 2 cycle delay before the output data changed (which I can buy).  However, the longer I let the process run, the longer the delay gets. Right now after about 400 cycles output, the delay is about 9 cycles -- and the delay just keeps growing.

 

I can't post the code publicly, but if you PM me I will send it to you.  Any ideas/insights/castigation would be greatly appreciated. 

 

Mike...


Certified Professional Instructor
Certified LabVIEW Architect
LabVIEW Champion

"... after all, He's not a tame lion..."

For help with grief and grieving.
0 Kudos
Message 1 of 15
(5,247 Views)

If your software is writing data faster than it is being generated then the extra data will be accumulated in the 8191 sample hardware FIFO.  You need a way to ensure you write data at the same rate as it is being generated (e.g. you could write the next 141 samples when each trigger is received).

 

 

Best Regards,

John Passiak
0 Kudos
Message 2 of 15
(5,242 Views)
And how does one do that? How does LabVIEW know a DAQ trigger has occurred? My initial thought would be to create a DAQ Change Detection event that the trigger signal would fire in the LabVIEW world.

Mike...

Certified Professional Instructor
Certified LabVIEW Architect
LabVIEW Champion

"... after all, He's not a tame lion..."

For help with grief and grieving.
0 Kudos
Message 3 of 15
(5,236 Views)

I tried not to be too specific since I don't have a USB X Series to validate with...

 

Polling the DAQmx Write property TotalSampPerChanGenerated should work.  The algorithm could be something like"write whenever <Current Write Position> minus <Total Samples Per Channel Generated> is less than <Write Size>".

 

 

Best Regards,

John Passiak
0 Kudos
Message 4 of 15
(5,224 Views)

You could use the change detection event like you mentioned if you wanted to get away from polling, but it has a couple caveats:

 

1.  If the trigger occurs while the generation is still happening it won't actually generate any new samples but you'll still get the change detection event.

 

2.  It uses additional hardware resources (it would reserve the digital input subsystem).

 

 

Best Regards,

John Passiak
0 Kudos
Message 5 of 15
(5,220 Views)

Would Item 2 mean a conflict with counters?

 

Mike....


Certified Professional Instructor
Certified LabVIEW Architect
LabVIEW Champion

"... after all, He's not a tame lion..."

For help with grief and grieving.
0 Kudos
Message 6 of 15
(5,211 Views)

No, just hardware-timed digital input (i.e. sampling one or more lines on port 0 based on a clock).

 

 

Best Regards,

John Passiak
0 Kudos
Message 7 of 15
(5,208 Views)

The properties you suggested don't work, the samples written per channel is always 141, and never increases, so I am trying the change detection event, but I can't get it to work. If set the task for one sample HW timed, I get an error saying the device doesn't support it, and if I select continuous sampling, the event never fires -- but I double checked and the specs for this box clearly says it does support this event. I have looked but can't find an example demonstrating this event. Can you point me at one?

 

Mike...


Certified Professional Instructor
Certified LabVIEW Architect
LabVIEW Champion

"... after all, He's not a tame lion..."

For help with grief and grieving.
0 Kudos
Message 8 of 15
(5,185 Views)

@mikeporter wrote:

The properties you suggested don't work, the samples written per channel is always 141, and never increases


I'm not sure what "samples written per chanel" is referring to, do you mean the TotalSamplesPerChannelGenerated read propery is always 141 (before, during, and after the samples have actually been generated)?  That doesn't sound right... can you post a screenshot of what you tried?

 


@mikeporter wrote:

I am trying the change detection event, but I can't get it to work. If set the task for one sample HW timed, I get an error saying the device doesn't support it, and if I select continuous sampling, the event never fires -- but I double checked and the specs for this box clearly says it does support this event. I have looked but can't find an example demonstrating this event. Can you point me at one?


Here's an example I found (it specifically says "M Series" but it is just older--it applies to X Series as well).  The change detection has to be used with a digital input task.

 

 

Best Regards,

John Passiak
Message 9 of 15
(5,170 Views)

I had something in mind like this:

 

AO_Non_Regen.png

 

It works on my PCIe device.

 

 

 

Best Regards,

John Passiak
0 Kudos
Message 10 of 15
(5,164 Views)