From 04:00 PM CDT – 08:00 PM CDT (09:00 PM UTC – 01:00 AM UTC) Tuesday, April 16, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Why odd number of samples in DAQ is not allowed?

Hi there,

  I was using traditional DAQ to write N analog samples to 1 channel for long time, I can output any number of samples to the same channel in traditional DAQ. But after I switch to the DAQmx, and I am using a timing to control the output of AO samples, I observed that it only allows  the even number of samples.

 

For the first try, I setup the following program

 

S1.png

In this case, no matter if the number of samples is odd or even, the code runs without any problem. However, if I use the sampling clock as belows

S2.png

 

The code runs without error if the number of samples is even but it fails if I use odd number of samples. The error returned as

 

error: -200692

DAQmx Write (Analog 1D DBL 1Chan NSamp).vi:1780002<append>
<B>Property: </B>SampQuant.SampPerChan
<B>Corresponding Value: </B>1233

<B>Property: </B>NumChans
<B>Corresponding Value: </B>1

Does anyone has any idea what's going on here? Thanks

0 Kudos
Message 1 of 7
(4,209 Views)
So it looks like you are trying to do buffered output. I would suggest you start with one of the examples and let it demonstrate how do to it correctly.

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 2 of 7
(4,068 Views)

Wouldn't you want to use single sample instead of NSamp if you only want a single sample?

0 Kudos
Message 3 of 7
(3,992 Views)

@natasftw wrote:

Wouldn't you want to use single sample instead of NSamp if you only want a single sample?


Thanks for the reply. I need to send multiple samples instead, ranged from 1000 to 9605 depending on the an input parameters. The reason why I need to use the sample clock is I need to use an external clock to control the sample output in future but for testing, I am trying to use the interal onboard clock instead.

 

One application I am trying to develop is to output 1000 samples at the rate of 1000 per second so each sample will be outputed at the interval of 1ms, using onboard clock doesn't assure this very well. I need to control it with external clock.

0 Kudos
Message 4 of 7
(3,914 Views)

@mikeporter wrote:
So it looks like you are trying to do buffered output. I would suggest you start with one of the examples and let it demonstrate how do to it correctly.

Mike...

I try those examples one by one and when I use the time clock, i got the error when the number of sample is odd. The error shown in previous thread is actually what I got from labview while the code fail to run. I don't have how to fix that issue from the hint of those error message. Someone suggests to use even number of samples instead, yes, it works but it doesn't fix my problem since in my case, I have to control the number of sample to be precise.

0 Kudos
Message 5 of 7
(3,666 Views)

Have you told us what device you are using?

 

The error message clearly states  "Number of samples per channel to write multiplied by the number of channels in the task cannot be an odd number for this device.

Adjust the number of samples per channel to write or the number of channels in the task so that their product is an integer multiple of two."

 

Whatever reason, the device can't be set for an odd number of samples.  So trying to force it to do that is not going to work

 

Since is says the number of cahhnels times the number of samples multipled together can't be odd, what if you create a second dummy output channel that outputs the same waveform even though you never use it.  Now 2x odd will always by even.

0 Kudos
Message 6 of 7
(3,657 Views)

@RavensFan wrote:

Have you told us what device you are using?

 

The error message clearly states  "Number of samples per channel to write multiplied by the number of channels in the task cannot be an odd number for this device.

Adjust the number of samples per channel to write or the number of channels in the task so that their product is an integer multiple of two."

 

Whatever reason, the device can't be set for an odd number of samples.  So trying to force it to do that is not going to work

 

Since is says the number of cahhnels times the number of samples multipled together can't be odd, what if you create a second dummy output channel that outputs the same waveform even though you never use it.  Now 2x odd will always by even.


Thanks. I am using (PCI)6713. I just curious why it does not require the multplication to be 2x in my first example (not using time clock) but ti doesn have that requirement for the second example on the same device.  I think I misunderstand something but I want to know what's the difference between first and second example regarding the number of samples used.

0 Kudos
Message 7 of 7
(3,641 Views)