LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

create digital output on mydaq

How can we creating 1/0 signal to the digital output pin 0~7 on myDAQ with using LabView?
As I want three of the pins outputing signal when I select option 1, another three pins outputing when I select option 2.
Which mean when I select different options, different pin(s) will provide signal.

0 Kudos
Message 1 of 9
(6,693 Views)
Have you gone through the tutorials? Have you looked at the examples that ship with LabVIEW? Have you written any code?

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 9
(6,677 Views)

Yes I did, but a DAQ assist can not complete this task. I have looked at using a DAQ write and a DAQ read, but it is not working.

0 Kudos
Message 3 of 9
(6,671 Views)

Two basic "rules" that will stand you in good stead.

  1. Before you write any LabVIEW Code, open MAX and use it to "play" with your device, specifically to make your device do the thing you want to do in your program.  Notice what things (ports, modes, constants, etc.) you need to specify, what you need to set, what "Start" and "Stop" do, etc.
  2. Never use the DAQ Assistant!  Instead, use the basic DAQ functions to replicate what you just did in MAX.  Read this basic Tutorial, it will explain how to do this.
0 Kudos
Message 4 of 9
(6,652 Views)
In addiition, if you can create a MAX task that does what you want, LabVIEW can turn that task into daqmx calls for you.

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 5 of 9
(6,647 Views)

Thanks for telling these, it really helps. So now I have run through the MAX and created one task which is to generate digital signal on pin 0,1,2.

Then what I should do is placing the task on labview and connect up with control to make it selecting which pin(s) are on. Am I right?
Should I create 3 different task with controlling each pin instead of one task controlling 3pins?

0 Kudos
Message 6 of 9
(6,637 Views)
Yes, now simply call this task from LabVIEW. I would say control all three pins with one task.

Post your code when you have something put together.

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 7 of 9
(6,626 Views)

The answer is -- whichever seems more sensible to you.  I don't know how the DIO is specified -- on one of my devices, it is grouped in 8-bit "ports", with the possibility of combining some ports into a 16-bit or 32-bit Port, as well.  I usually stick with 8-bit ports, all input or all output, and create a Task to address a Port.  Then when I start my DAQmx Task (using this saved Task Variable), I do a Bit or Byte-wide I/O as appropriate for what I need to do.

 

Bob Schor

 

P.S. -- doing port-wide Reads almost always makes sense, since if you only need to know about, say, bit 0, you can mask off the other bits (or convert a U8 to an array of Booleans and use Array Index 0).  On the other hand, if you want to output digital data, and are writing to an 8-bit Port, then you need to write all 8 bits.  This is also not a problem, but takes a little more work.  You need to keep a variable (I use either a Global Variable or a Functional Global Variable, also called an FGV or VIG, for VI (Version 2) Global) that has the current value of the 8-bit DO port.  To set bit 0, set bit 0 in the Variable, then write the Variable to the Port.  To clear bit 1, clear bit 1 in the Variable, then write the Variable to the Port.  Note that if the bits do not change, then you don't need to write to the Port, as it will "hold" the current bits.

0 Kudos
Message 8 of 9
(6,611 Views)

I have now sucessfully made the combo box selecting which digital pins are on. Which as the 1.vi I attached. Now I am going to connect each digital pin to 2 8-bits multiplexer, then different sensors are connect to these two mux. Therefore the combo box can controlling the multiplexer to drive different sensors.

 

So now those different sensors have there own vi, should I make them as a DAQmx write and put all the things on one vi? Also, on the 1.vi I attached, in the DAQmx write just got one task out pin, it means only one task can perform? Or it can make it to different tasks?

0 Kudos
Message 9 of 9
(6,515 Views)