LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Channel Expansion - Error - "Create one task for each channel type."

I have a tech support ticket started but they seem to answer my responses about once a week. My tech person is telling me to use Channel Expansion to define digital and voltage signals together in one task. I have a simple VI to test this:

 

flycast_0-1624298242445.png

I am getting the following error on the node DAQmx Read. I get this error no matter what the settings are:


    Possible reason(s):



    Task cannot contain a channel with the specified channel type, because the task already contains channels with a different channel type.

    Create one task for each channel type.



    Virtual Channel Name: DI/port0/line1...

    I/O Type Required for Virtual Channel: Digital Input

    Physical Channel Name: Voltage/ai1:2

    I/O Type Required for Virtual Channel: Analog Input


    Task Name: _unnamedTask<27>

I tried defining digital and voltage channels originally but when I saw the error message I thought that I had to do in fact what it was telling me to do - define two different tasks.

 

So, can I define Digital and Analog channels with the same task? If so what is wrong with my code?

0 Kudos
Message 1 of 9
(5,007 Views)

Nothing in that says you can mix/match analog and digital channels.  Channel expansion is about combining channels across multiple modules and chassis.

0 Kudos
Message 2 of 9
(5,001 Views)

Sorry, I am combining channels over multiple modules on one chassis. I meant to put my equipment spec in my question. I have a cDAQ-9185 with:

  • NI 9205 Voltage
  • NI 9425 Digital

I need to combine signals over the two modules.

0 Kudos
Message 3 of 9
(4,963 Views)

@flycast wrote:

Sorry, I am combining channels over multiple modules on one chassis. I meant to put my equipment spec in my question. I have a cDAQ-9185 with:

  • NI 9205 Voltage
  • NI 9425 Digital

I need to combine signals over the two modules.


Why do they need to be in one task? Can't you create two tasks and just combine the outputs?

Imagine the DAQmx Read node with a hypothetical digital+analog task - what would the output wire type be? (I guess actually, you could use something like U32/I32 and return raw analog ADC counts + 0/1 for the digital, but that would be a pain to process)

 

If the problem relates to simultaneous sampling, you can probably find a good way to share a clock between the two tasks using DAQmx Timing and a shared clock.

I'm not sure what's available on the 9185/9205/9425, but perhaps connecting Mod{whatever the AI module is}/AI_SampleClock, or whatever it's called, to the DAQmx Timing source on the Digital task is possible?

Otherwise, you might be able to use the cDAQ-9185 to generate a sample clock using a counter and then connect that to the sources for the other tasks (that's less convenient, but I don't know, it might be required for your hardware).

 

 

 


GCentral
0 Kudos
Message 4 of 9
(4,945 Views)

Channel Expansion does not always work for every combination of cards and tasks, when it does it is simple to synchronize tasks. For your case it looks like you will have to manually by programming synchronize the tasks. The example for synchronization have some good starting points.

 

mcduff

0 Kudos
Message 5 of 9
(4,939 Views)

The example you linked to always combines together Analog-In Signals. It never mixes Analog-In with Digital-In.

 

Since the DAQmx API offers different read VIs for AI and DI it is not surprising that you cannot combine this into one task.

 

However it should be possible to synchronize the DAQ-rate of this two tasks and even make them start at the same time as other already suggested.


Regards, Jens

Kudos are welcome...
0 Kudos
Message 6 of 9
(4,891 Views)

@cbutcher wrote:

@flycast wrote:

Sorry, I am combining channels over multiple modules on one chassis. I meant to put my equipment spec in my question. I have a cDAQ-9185 with:

  • NI 9205 Voltage
  • NI 9425 Digital

I need to combine signals over the two modules.


Why do they need to be in one task? Can't you create two tasks and just combine the outputs?

Thanks to you and the others that have replied.

 

As you ask "Why do they need to be in one task?". The tech support person at NI seems to be not wanting to enter a bug report. I keep getting responses from them that say they can't evaluate the issue until I change my programming to certain NI recommended best practices. Channel Expansion is one of those bullet points. I sent them a super simplified example that shows my bug but it seems to be taking about a week to hear back on communications. I think in this case the support person is just plain wrong about using Channel Expansion to combine digital and analog into one task.

 

Not all lost though. I am learning about channel expansion!

0 Kudos
Message 7 of 9
(4,883 Views)

But I still don't know what you claim the bug is for them to file a report.

 

The error is telling you that you can't combine a digital channel with an analog channel.  That is not a bug in NI programming.  It is a bug in your code.

0 Kudos
Message 8 of 9
(4,866 Views)

You are correct, I did not discuss the bug here.

 

The bug was that I cannot index a digital waveform from a 1D array of digital waveform by channel name. That is what started the tech support request. If you look at the "DWDT Index Channel by Name.vi" that ships with LabView it uses "Channel Name" instead of "NI_ChannelName" to retrieve the attribute Channel Name.

flycast_0-1624456380437.png

 

 

Should be:

flycast_1-1624456412222.png

 

0 Kudos
Message 9 of 9
(4,813 Views)