From 04:00 PM CDT – 08:00 PM CDT (09:00 PM UTC – 01:00 AM UTC) Tuesday, April 16, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

usb-6501 help

so i made this code with the help of daq assistant, my goal is to set 5 pins as a Dig Output and 5 as a Dig Input to read a status change on a button. this code tho doesnt do what i wanted and when i try to change the pin status with max it doesnt detect it and just keeps the array indicators on true all the time

0 Kudos
Message 1 of 2
(647 Views)

Your first mistake was to use the Dreaded DAQ Assistant, the bane of anyone wanting to learn DAQmx, the Easy Way to do Data Acquisition and Data Control in LabVIEW.  You really need to know a (small) handful of DAQmx functions (this project needs 4) and to understand the concept of a DAQmx Task.

 

There's a very good starting point (but with a little too much detail), a White Paper NI wrote years ago called "Learn 10 Functions in NI DAQmx and Handle 80 Percent of your Data Acquisition Applications" (or words very close to that -- you can find it by starting that title in a Web search).  Skip the first section, which talks about the Dreaded DAQ Assistant.

 

You want to create a Task, which summarizes most of the features of your DAQ device (including its identity, channels, ports, sampling rate, Digital or Analog, etc.)  To learn about Tasks, MAX is your best starting point.  Plug in your 6501 to your PC, run MAX, find the 6501, and create a Test Panel.  Here you "define a task", say, Digital Output.  You define your channels (say Port 1, Lines 0..4).  Try running your task -- MAX will actually put out pulses on your lines (check with an Oscilloscope).

 

More important, you can create Tasks in your Project.  Right-click "My Computer", choose NI-DAQmx Task, and create your Task.  It starts by asking if you want to Acquire or Generate Signals.  It then checks the list of Devices seen by MAX (how clever, and a good reason to connect your device to MAX first), lets you choose the 6501, and decide which lines you want to use.  If you had an A/D converter, it would let you set the A/D properties, as well.  Find your Device, and the Ports/Lines you want to use.  The last step is to save it in the Project under a Task Name.

 

So the "Learn 10 Functions" paper will show you that you can do most of what you need for Data Acquisition and Control with four functions:  DAQmx Create Task, DAQmx Read, DAQmx Write, and DAQmx Clear Task.  Sometimes you also need "DAQmx Start Task", but not here (I think).

 

Here is a picture (you can't "run" a Picture, but you can try to duplicate it, which will require that you (a) Create a suitable pair of Tasks in your Project for Digital Input and Digital Output for your 6501, (b) physically wire (with actual copper wire!) the 5 output Lines to the 5 input Lines (you'll see the revised Program uses DUT Out to drive DUT In, so as you turn the switches on and off, the LEDs should also go on and off), then run the code and ensure yourself that it works.

 

For extra credit, explain the purpose of the little metronome function in the upper left of the Block Diagram.  Also, what's with the Error Lines on the right side of the Block Diagram?

6501 Simple Demo.pngBob Schor

Message 2 of 2
(620 Views)