LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Can someone explain (simply) DAQmx IO mapping in LabVIEW

To do what you want to do, you need to learn several things:

  • Learn LabVIEW.  If you are new to LabVIEW, but have a good tutor/mentor, expect to spend a few months.
  • Learn DAQmx.  Once you "get" the idea of Data Flow (exemplified by LabVIEW), which allows parallel processing, programmed I/O using DAQmx (and not the Dreaded DAQ Assistant) will help you handle a multitude of Control and Measument tasks.  Do you know about "Learn 10 Functions in NI DAQmx and Handle 80% of Your Data Acquisition Applications" (or words similar to that)?
  • Learn how to communicate what you want to do, what hardware and requirements (timing, etc.). 
  • If you really want a LabVIEW task performed, and don't have the serious time and effort to learn how to do it yourself, hire a LabVIEW expert.

Bob Schor

 

P.S. -- Attaching some of your LabVIEW code (as .vi and .ctl files, not "pictures" of code) may get responses better suited to the (vague, unspecific) tasks you are trying to solve.

 

0 Kudos
Message 11 of 39
(712 Views)

Hardware is USB-6221. Basically, how can I put multiple digital outputs on a single task and control them each individually using DAQmx Write VIs? I think the fact that I have 25 tasks in my main loop is causing the lag.

 

I'm quite sure it's possible to answer this question without any more info.

0 Kudos
Message 12 of 39
(710 Views)

Oh no I forgot to preface this post with "please don't tell me to learn the basics as my employer is expecting a completed project in two weeks," and I got what I deserve. Didn't take long for someone to offer up that cliched response.

 

So yeah, I have a full program written, logic tested, thousands spent on hardware, months of time spend building & wiring the control system, and a delivery date before Christmas. The only obstacle is the program lagging due to the poor DAQmx management. Yes, I am aware I am a complete novice in LabVIEW. That doesn't matter. This problem has a solution other than "go study LabVIEW for 6 months," and I'm trying to find it. 

0 Kudos
Message 13 of 39
(705 Views)

Although you've only been a Forum member for a week, surely you've read that posting all of your code (usually by compressing the Project Folder using a right-click on the Folder, "Send to", "Compressed (zipped) files") will go a long way to get some of the "experts" here to make suggestions.  We know you have a "problem", and a "deadline", and need someone to help, but help with what?  You want to be spoon-fed with relevant code, right?

0 Kudos
Message 14 of 39
(674 Views)

My code is private as sharing code externally is a violation of my company's policy. If you're truly a LabVIEW expert, you should be able to deduce my overall need here without me supplying a copy of my spaghetti code for you to critique.

 

Please be helpful or don't respond again.

0 Kudos
Message 15 of 39
(663 Views)

Hi Nathan,

 


@nathan_t wrote:

Please be helpful or don't respond again.


We are helpful as best as we can from the information provided by you…

 


@nathan_t wrote:

My code is private as sharing code externally is a violation of my company's policy. If you're truly a LabVIEW expert, you should be able to deduce my overall need here without me supplying a copy of my spaghetti code for you to critique.


I deduce from your questions and the statements about your LabVIEW knowledge that you should start with some beginner courses and suggest to learn from the DAQmx example VIs found in the example finder.

 

There are example VIs that explain how to setup and use a DO channel with your DAQmx DAQ device!

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 16 of 39
(630 Views)

How can you say you've been as helpful as you can when all you two have done is patronize me without directly addressing one of my questions? 

 

Yes, I'm well aware that my LabVIEW skills - to put it bluntly - suck. But I don't care. They can suck all they want and I can still fix my issue and have a working application in a couple days. So I need someone in here to put their ego aside, have some compassion, and genuinely try to help me. If you aren't interested in doing that, please don't respond.

0 Kudos
Message 17 of 39
(597 Views)

Hi Nathan,

 


@nathan_t wrote:

Anyway, I am struggling to understand everything that's required to properly configure the IO.

 

Where do the Timing/Triggering VIs come into play? Do I need to use these with the counter IO or even all IO?

 

Obviously, I am a LabVIEW beginner and lack a technical understanding of how the DAQmx tasks work, so please keep that in mind in your answer.

 

One of the counter channels is for producing pulses to control a stepper motor. Another is reading pulses from that same stepper motor (the counter output on the DAQ controlling the stepper motor is hard wired to this counter input).

 

And for the strictly digital IO, can I just put these all on the same task (or two, one for inputs and one for outputs), or do they all need to be separate? All the digital IO needs to function like they would in a PLC program, which shouldn't be too hard given they are inside a while loop.


You got excellent answers before: 1, 2, 3, …

 


@nathan_t wrote:

I don't see how I add multiple IO ports to a task and then wire them to a write block individually. There's just no way. And none of the examples help because I open it and it has 100 SubVIs that I've never even seen before. Do the Labview developers understand the concept of encapsulation?


Yes, we know about encapsulation. All the DAQmx stuff is encapsulated in those DAQmx functions…

You did not specify which example you are complaining about. Those I know most oftem come without any subVI (apart from DAQmx functions)…

To answer your question: you can add multiple channels with just one CreateVirtualChannel call or by chaining several CreateVirtualChannel calls…

 


@nathan_t wrote:
I have no idea what I'm doing with the DAQ IO mapping.

"IO mapping" is something PLC specific. In LabVIEW/DAQmx you just add channels to your task(s)…

 


@nathan_t wrote:
Basically, how can I put multiple digital outputs on a single task and control them each individually using DAQmx Write VIs?

Yes.

 


@nathan_t wrote:

I think the fact that I have 25 tasks in my main loop is causing the lag.


You failed in attaching your code so we cannot comment on this assumption

 


@nathan_t wrote:
My code is private as sharing code externally is a violation of my company's policy.

Create a reduced example from your "private code" that explains your problems without showing company internals.

 

As long as you keep your code private you need to debug it on your own!

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 18 of 39
(586 Views)

You answered 'Yes' to a question that started with 'How.' I think I figured it out myself though. Isn't that cool, numerous 'experts' responded to me and I still had to figure out the answer to my question on my own. Unbelievable. 

 

Yes, maybe IO mapping as you are imagining it is someone specific to PLCs. However, the DAQ still has input/output ports on it that I need to setup to work with my hardware. That's obviously what I'm referring to (and you know that). 'Add more channels to a task' isn't really all that helpful. What even is the difference between a channel/line/port? Maybe you can explain that. The LabVIEW tutorials (which I have done some of by the way, but stopped due to time constraints) do not explain it very clearly. 

0 Kudos
Message 19 of 39
(577 Views)

Hi Nathan,

 


@nathan_t wrote:

You answered 'Yes' to a question that started with 'How.' I think I figured it out myself though.


I didn't notice that "how" and only read "can I put…?", so the answer is yes.

 


@nathan_t wrote:

 'Add more channels to a task' isn't really all that helpful.


What's wrong with "chaining several CreateVirtualChannels" to add several channels to a task…

Googling for "daqmx multiple channels" gives this search result!

 


@nathan_t wrote:

What even is the difference between a channel/line/port? Maybe you can explain that.


  • A "channel" is an entity inside the DAQmx task, comparable to an IO pin on your DAQ device. It can also reference to "internal pins" of your DAQ device.
  • A "line" is a term for DIO pins, each single DIO pin is a "line".
  • A "port" is a collection of "lines", most often collected as bits inside U8/U16/U32 ports…
  • WTF googling for "daqmx lines ports" gives this as first search result

I feel very much like "spoon feeding" when explaining how to use GoogleSearch with relevant search terms… 😄

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 20 of 39
(558 Views)