Multifunction DAQ

cancel
Showing results for 
Search instead for 
Did you mean: 

Analog input task with special sample sequence

Dear All,

we have a PCIE-6323 card and we want to make externaly trigered analog scan measurement on sixteen channels.

But we need to measure three samples on each AI before we switch to next analog input.

 

we use NiDAQmx functions


DAQmxCreateTask('',addr(AISCAN_TH));

DAQmxCreateAIVoltageChan( AISCAN_TH,'Dev1/ai0:15'','',DAQmx_Val_InputTermCfg_NRSE,-range,range,DAQmx_Val_VoltageUnits1_Volts ,nil );
DAQmxCfgSampClkTiming( AISCAN_TH,'Dev1/PFI0',200,DAQmx_Val_Rising,DAQmx_Val_AcquisitionType_ContSamps,5);

 

with this we will get on every rising edge on input PFI0  sixteens analog values from AI0-AI15. But I do not know how to setup this in case when we want to measure three samples from each input  before switching to next input?

 

Any idea?

 

Thank You

 

 

0 Kudos
Message 1 of 17
(1,055 Views)

Yes you can, but the channel list string will look pretty tedious.  

 

Generally, one *can* list the same channel more than once in a task's channel list and then the A/D conversions happen in the same order as defined in the channel list.  In your case, you'd need your channel list to go like:

"Dev1/ai0,Dev1/ai0,Dev1/ai0,Dev1/ai1,Dev1/ai1,Dev1/ai1,...".

 

LabVIEW has some handy utility functions I'd use to make this easier, but you won't have them natively available in a text language.  In your position, I'd probably use a doubly-nested loop to form the string, pseudo-code something like (and forgive me b/c I've barely coded text in 25 years)

 

chan_str = ""

for i=0 to 15

    for j=1 to 3

        if (chan_str != "")

            chan_str = chan_str + ","

        endif

        chan_str = chan_str + "Dev1/ai" + num2str(i)

    end

end

 

Offhand, I don't what limitations there may be (if any) to the length of this channel list, either in terms of the string itself or in terms of the total channels.  There will for sure be some max sample rate constraints caused by extra long channel lists -- you'll need to multiplex among all the channels within one sample period and devices have max limit on the multiplexing rate (a.k.a. the convert clock).

 

 

-Kevin P

CAUTION! New LabVIEW adopters -- it's too late for me, but you *can* save yourself. The new subscription policy for LabVIEW puts NI's hand in your wallet for the rest of your working life. Are you sure you're *that* dedicated to LabVIEW? (Summary of my reasons in this post, part of a voluminous thread of mostly complaints starting here).
0 Kudos
Message 2 of 17
(1,038 Views)

Hello,

I tried it but I have received error.

Error -200489: Specified channel cannot be added to the task, because a channel with the same name is already in the task.

 

Some other idea?

Thank You in advance

 

Vladimir

0 Kudos
Message 3 of 17
(1,002 Views)

Sorry, that little trick used to work as far back as I can remember, but I guess it's also been a lot of years since the last time I needed to do it.  I'm curious when that stopped being supported, but unfortunately I don't have any other good ideas for you.

 

 

-Kevin P

CAUTION! New LabVIEW adopters -- it's too late for me, but you *can* save yourself. The new subscription policy for LabVIEW puts NI's hand in your wallet for the rest of your working life. Are you sure you're *that* dedicated to LabVIEW? (Summary of my reasons in this post, part of a voluminous thread of mostly complaints starting here).
0 Kudos
Message 4 of 17
(994 Views)

Could you please explain why you need to measure each channel thrice before going to the next channel? perhaps re-evaluate the requirements?

Santhosh
Soliton Technologies

New to the forum? Please read community guidelines and how to ask smart questions

Only two ways to appreciate someone who spent their free time to reply/answer your question - give them Kudos or mark their reply as the answer/solution.

Finding it hard to source NI hardware? Try NI Trading Post
0 Kudos
Message 5 of 17
(991 Views)

Hello,

I want to have average value calculated from three samples on each AI.

Idealy measured in one row before switching to next input. To eliminate settling time a crosstalk.  Coversion of all samples (16x3 or at least 3x16) must be started by one rising edge on PFI0 (limited by external hardware).

 

Vladimir

0 Kudos
Message 6 of 17
(988 Views)

If ghosting or crosstalk is your only problem, perhaps increasing delay between channels might help

https://knowledge.ni.com/KnowledgeArticleDetails?id=kA00Z0000019NFQSA2&OpenDocument=&OpenDocument=&l...

 

Some more techniques - https://knowledge.ni.com/KnowledgeArticleDetails?id=kA03q000000YHy6CAG&l=en-US

 

Do you have a way to reduce the source impedance of the signal by using an external buffer?

Santhosh
Soliton Technologies

New to the forum? Please read community guidelines and how to ask smart questions

Only two ways to appreciate someone who spent their free time to reply/answer your question - give them Kudos or mark their reply as the answer/solution.

Finding it hard to source NI hardware? Try NI Trading Post
0 Kudos
Message 7 of 17
(986 Views)

It is exactly what I want to do as described in your link. Because I am not able to change hardware to low input impedance and I am not able change also trigering signal .

I suppose to add one dummy reading before two more readings on the same analog input. First sample I will throw away and from the last two readings I will make average value.

 

Idea is OK but I do know how to do it with DAQmx functions.  If I will add two identical channels into channel list then I will receive error.

0 Kudos
Message 8 of 17
(977 Views)

The Dummy channel technique is supported only on X or M series DAQ cards

santo_13_0-1645042072461.png

 

I am not sure what series your DAQ falls under, since you got an error I would assume it is not supported by our DAQ.

 

If slowing down sampling rate or increasing inter-channel delay does not help your case, the only other option may be to insert an external buffer in the signal chain.

 

Santhosh
Soliton Technologies

New to the forum? Please read community guidelines and how to ask smart questions

Only two ways to appreciate someone who spent their free time to reply/answer your question - give them Kudos or mark their reply as the answer/solution.

Finding it hard to source NI hardware? Try NI Trading Post
0 Kudos
Message 9 of 17
(973 Views)

We use Pcie-6323 card. I suppose it is a X serie.

0 Kudos
Message 10 of 17
(965 Views)