Jump to content

How to do 3-channel digital output triggering with DAQmx?


zorro

Recommended Posts

Thank you for those nice and experienced people who helped me here.

I am using LabVIEW8.2 and I want to use NI-DAQCard6036E to generate 3 channels digital outputs, which are in the time series. There are 8 digital channels on the NI-DAQCard6036E. What I want is: The numbers in Channel are 0 and 2(At first it is 0, after 2s, it becomes 2); The numbers in Channel2 are 0 and 1(At beginning it is 0, after 3s, it becomes 1) and the numbers in Channel3 are 1 and 0(Channel2 is reversed to Channel3)

Question1: How to choose physical channel? What do port and line mean? which one should I choose in the attached picture2?

Question2: The three lines in the attached picture1 are carrying the digital numbers. Can I do in this way?

Question3: In the attached picture1I am using create channel.vi start.vi, write.vi, stop.vi and clear.vi to generate the digital output. Is it right? Do I need timing.vi? I tried to use timing.vi, but it always gives error. Then I remove timing.vi, error doesn't show.

Question4: How to build a 2D array to connect with the data terminal of write.vi? Is my method right ot not?

I hope someone can help me with these problem. Thanks a lot.

Link to comment

QUOTE (zorro @ Aug 7 2008, 10:08 PM)

Thank you for those nice and experienced people who helped me here.

I am using LabVIEW8.2 and I want to use NI-DAQCard6036E to generate 3 channels digital outputs, which are in the time series. There are 8 digital channels on the NI-DAQCard6036E. What I want is: The numbers in Channel are 0 and 2(At first it is 0, after 2s, it becomes 2); The numbers in Channel2 are 0 and 1(At beginning it is 0, after 3s, it becomes 1) and the numbers in Channel3 are 1 and 0(Channel2 is reversed to Channel3)

Question1: How to choose physical channel? What do port and line mean? which one should I choose in the attached picture2?

Chose the first availble.

A port has port with 8 or 16 bits. A line is a single bit, true or false.

Easiest run daq assistant and open the express vi and there you have the pieces to build for init, write and stop stoppning the task.

Question2: The three lines in the attached picture1 are carrying the digital numbers. Can I do in this way?

I dont understand.

Question3: In the attached picture1I am using create channel.vi start.vi, write.vi, stop.vi and clear.vi to generate the digital output. Is it right? Do I need timing.vi? I tried to use timing.vi, but it always gives error. Then I remove timing.vi, error doesn't show.

I am not sure.

Question4: How to build a 2D array to connect with the data terminal of write.vi? Is my method right ot not?

I dont understand your problem.

I hope someone can help me with these problem. Thanks a lot.

My answers above.

Link to comment

QUOTE (Anders Björk @ Aug 8 2008, 03:02 AM)

My answers above.

Thank you.

But I still can not get the voltage at the output pins.

I think there might be 2 possible reason:

1. I didn't get the right data array which is the input of the DAQmx Write.VI. According to the help document, the data terminal of the DAQmx Write.VI should be "Each element in the first dimension of the array corresponds to a channel in the task. Each element in the second dimension of the array corresponds to a sample to write to each channel."

So hpw to get the right data array from the 3 lines in the attached picture?

2. I didn't use the right DAQmx VI. Besides create channel,vi, start.vi, write.vi, stop.vi and clear.vi, the Timing.VI is also neccisssary for the digital output generation. I used to try to add the timing.vi between the create.vi and the start.vi, but when I stop the main program VI, there is an error showing on the screen. I put the error in the attachment.

These two reason might cause me stuck. But I have no idea how to fix them.

Any help is aapreciated. Thank you very much.

Link to comment

QUOTE (zorro @ Aug 7 2008, 04:08 PM)

What do port and line mean?

Zorro,

I don't have much wisdom to pass on regarding DIO. I haven't made any new use of this since version 7. However, I understand that the naming of things is not clear and the documentation does not make learning easy. Perhaps others can point you toward good tutorials and example code for LabVIEW 8.2.

My own ability to use DIO came from finding basic example code and trying to use it. I made simple LED indicators for several digital output lines so I could see actual results of using the examples. You need to put a current limiting resistor in series with the resistor. Most LEDs drop 1.8 Volts and the DIO lines are 5.0 Volts. The output terminals can be either input (using digital read function) od output (digital write function). You need to find the diagrams that show what the terminals for the DAQ card and its interface are so you can wire up the LEDs.

You should also become familiar with the use of Measurement and Acquisition eXplorer (MAX). This allows to to setup and test input and output with your 6036E card, and to create Tasks that can be placed in your VIs. For DIO you will create digital output channels and tasks.

When I am hooking up new signals to my DAQ I always begin with MAX to be sure I can see or generate what is expected before complicating the process with LabVIEW code.

You should approach the creation of LabVIEW code in small bits at a time. Your complicated block diagram can be an impediment to learning the basice buiolding blocks you need to succeed. I always try to make the basic functions of my code owok alone befor bringing them into a larger application. For example, the analysis of some digitized data - I would create imaginary arrays of data that are similar to what I expect and then get the analysis and presentation to work right before introducint actual data in the context of a larger project. Similarly I would perfor only single channel analog inputs before expanding to multiple channels. I would get each channel right before proceeding. Soon it may not be necessary to take such small steps, but it will help a lot when you are still learningthe basics of LabVIEQ programming.

Mike

Link to comment

Hi zorro,

When you say you're trying to write 2 or 1 to the output signal, I think you mean you want a voltage of 2Volts or 1Volt, right? For this, you can't directly use the digital output terminals, since these will only output either a low value (0V) or a high value (+5V). So ideally you would want to use the analog output controls, since those will output a constant voltage of a wide range (e.g. -10 to 10V).

So assuming your DAQ card is hooked up properly and stuff, you can just put down a "DAQmx create channel.vi". Set it to Analog Output. Then right-click on the channel input on the icon and choose Create Constant. This should show all the possible analog output channels available. Choose any for now. Then you need to write a value to the channel, so use "DAQmx write.vi" and pass whatever voltage value you want.

The reason you are getting an error when using the timing vi is that your DAQ card doesn't support timing. You'll probably just have to use another way using the Time & Dialog functions. Attached is an idea of what I'm trying to say.

Anyway, you only have 2 Analog Ouputs, and you need to output three, so perhaps you can output a digital signal (+5V) and use a voltage divider to get the right voltage. Hope that helps,

SS

Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.