12-10-2024 08:15 PM
To do what you want to do, you need to learn several things:
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.
12-10-2024 08:16 PM
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.
12-10-2024 08:26 PM
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.
12-10-2024 09:37 PM
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?
12-10-2024 09:46 PM
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.
12-11-2024 02:18 AM
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!
12-11-2024 05:50 AM
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.
12-11-2024 06:23 AM - edited 12-11-2024 06:24 AM
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!
12-11-2024 06:32 AM
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.
12-11-2024 07:15 AM - edited 12-11-2024 07:19 AM
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.
I feel very much like "spoon feeding" when explaining how to use GoogleSearch with relevant search terms… 😄