USB-6008 DIO Lines...

I have a USB-6008 that I'm using to develop an application with. The development language used is C# (.NET 2003 with Measurement Studio 7.0). Right now, I have the device successfully reading from the counter input. Since this program reads rising edges from the counter input, I can get the frequency of the input signal and cause something to happen should the frequency rise above a certain threshold.
I'm trying to use the Digital port (port0) to set line 0 high if a condition has been met. I can do this when I select 'Dev1/port0' - I get Port 0 line 0 to go high or low. The problem is that I want to have control over lines 1, 2, 3, 4, 5, 6 and 7 - I only have access to line 0 right now on either Port 0 or Port 1.
Currently I'm using the following imported functions from the C samples included in the NI-DAQmxBase software:
int result = DAQmxBaseCreateTask("", out dioTaskHandle); // create the DIO task...
result = DAQmxBaseCreateDOChan(dioTaskHandle, "Dev1/port0", "", 1); // create DIO channel...
result = DAQmxBaseWriteDigitalScalarU32(dioTaskHandle, true, 1.0, 0, out reserved); // write a 0 to the channel selected
Just a note about the third line of code - the documentation states that parameter 2 of the 'DAQmxBaseWriteDigitalScalarU32()' function must be set to false. When I use false as the 2nd parameter, I end up getting a return value of -1073807346. I can't find what that error is in any documentation. So, I set this value to true - and it works (I get a return value of 0 meaning success).
In my development cycle, I've tested for ways to get access to a single line (other than line 0), and found that when I create a DO channel with the value "Dev1/port0", port 0 line 0 is active. When I create a DO channel with the value "Dev1/port1", port 1 line 0 is active. If I try to create a DO channel with a value of "Dev1/port2" through "Dev1/port7", I get a return value of -200170 (Physical Channel Does Not Exist). The documentation isn't very clear on the ports and single lines for digital output.
My question is - how can I gain access to ALL of the lines of a particular port?
Thanks,
tsc

I just figured out the lines of the port - of course this will happen once I've posted a question. If others run into the same type of problem, here's how to access each individual line of a selected digital port:
line 0 - 0x01 (binary: 0000 0001)
line 1 - 0x02 (binary: 0000 0010)
line 2 - 0x04 (binary: 0000 0100)
line 3 - 0x08 (binary: 0000 1000)
line 4 - 0x10 (binary: 0001 0000)
line 5 - 0x20 (binary: 0010 0000)
line 6 - 0x40 (binary: 0100 0000)
line 7 - 0x80 (binary: 1000 0000)
all lines off - 0x00 (binary: 0000 0000)
all lines on - 0xff (binary: 1111 1111)
// create a task...
result = DAQmxBaseCreateTask("DigitalPort0 Task", out dioTaskHandle);
// create a channel - I'm using Port 0 in this example)...
result = DAQmxBaseCreateDOChan(dioTaskHandle, "Dev1/port0", "", 1);
// turn off all digital lines to the port selected (I do this when starting up)...
result = DAQmxBaseWriteDigitalScalarU32(dioTaskHandle, true, 1.0, 0x00, out reserved);
// if I want to turn on the first line (P0.0) of port0, then I send 0x01 as the fourth parameter...
result = DAQmxBaseWriteDigitalScalarU32(dioTaskHandle, true, 1.0, 0x01, out reserved);
// if I want to turn on the fifth line (P0.5) of port0, then I send 0x20 as the fourth parameter...
result = DAQmxBaseWriteDigitalScalarU32(dioTaskHandle, true, 1.0, 0x20, out reserved);
I hope this will help someone else out using this device and Measurement Studio for .NET.

Similar Messages

  • DIO for USB 6008

    Hello there folks,
    I just need suggestions from everyone.  have 5 digital signals and am using USB 6008 to measure using DAQ assistant express VI ( not DAQmx ), and use the digital binary values from the 5 channels to select a case statements. Attached is the word document .
     Kindly confirm:
    1)  if the PIN numbers are correct
    2) the labview part will work with DAQ assistant express VI
    3) any other example installed in labview which you can suggest to read more about , so that i can program in labview ?? 
    Attachments:
    DIO.doc ‏49 KB
    NI6008.pdf ‏855 KB

    Hi Miaa,
    The best examples for programming your application without the DAQ Assistant are "Read Dig Chan.vi" and "Read Dig Port.vi" (located under Hardware Input and Output » DAQmx » Digital Measurements in the Example Finder).
    The "Chan" VI reads each line as a true/false value and returns an array of booleans, and the "Port" VI reads the entire port and returns an integer. You can use both of these data types to drive your case structure, but I think the integer format will make the programming easier.
    Joe Friedchicken
    NI VirtualBench Application Software
    Get with your fellow hardware users :: [ NI's VirtualBench User Group ]
    Get with your fellow OS users :: [ NI's Linux User Group ] [ NI's OS X User Group ]
    Get with your fellow developers :: [ NI's DAQmx Base User Group ] [ NI's DDK User Group ]
    Senior Software Engineer :: Multifunction Instruments Applications Group
    Software Engineer :: Measurements RLP Group (until Mar 2014)
    Applications Engineer :: High Speed Product Group (until Sep 2008)

  • Controlling direction of DIO ports of USB-6008

    How does a person control the direction of the DIO ports in the USB-6008?  And how does one then receive a signal (if dir = in) and send a signal (if dir = out)?  Sorry, I'm new to Signal Express.

    Hi Tim, 
    In general, the direction (input or output) depends on the type of step you define in Signal Express. As you can see, when you see the Add Step options, you have the option to both Acquire Signals (dir = in) and Generate Signals (dir = out).
    Hope this helps! 
    ~kgarrett
    Applications Engineer
    National Instruments

  • Making another counter VI for usb-6008 using Labview 8.5

    I want to create another counter for usb-6008 using Labview 8.5 as it is needed to calculate two speeds simultaneously.
    Solved!
    Go to Solution.

    The best way to do this is to use the counter.  The counter counts
    signals without having to interrupt the system or use the USB bus. 
    When you request the number of ticks that the counter has seen, a
    request is thrown from the CPU to the USB line to the 6008, which then
    asks the counter "How many ticks have you seen?"  That number is
    returned over the USB bus, goes to the CPU, and then displays on your
    screen.  Since the DIO lines on the 6008 are software timed, there is
    no way to guarantee that the data returning to the CPU is
    deterministic.  The conceptual difference between software-controlled
    DIO (which nondeterministically returns an entire data stream) and a
    software-tick-request-controlled counter (which returns a single number
    with the number of ticks) prevents us from using the DIO lines on the
    6008.  The cheapest way to count more edges is to purchase more 6008s. 
    Another possibility would be to purchase a PCI counter board such as
    the PCI-6602, which has 8 counters. The most counters we offer in the
    USB form factor is 2 per device.
    -John Sullivan
    Analog Engineer

  • USB 6008 power up inconsistent

    Hi,
    Now that I have read enough about the DAQ 6008 and know that the DIOs power up to 5V when it is connected to the USB. And, knowing that , I have worked around it. But, here is my problem. very random behavior occurs in that few channels dont power up and I disconnect the DAQ and connect it back; they do. This random behavior is affecting my system. Should I trust the internal pull up or should I myself pull the voltage up to 5V using an external 4.7k resistor?
    Thanks!
    V
    I may not be perfect, but I'm all I got!

    Hi VeeJay,
    I just looked through the USB-6008 user manual and specifications (found here) on page 23 it states:
    At system startup and reset, the hardware sets all DIO lines to
    high-impedance inputs. The DAQ device does not drive the signal high
    or low. Each line has a weak pull-up resistor connected to it. 
    This means that the default power up start would have each of the digital lines set for input and pulled up to 5V internally.  You shouldn't need an external pull up, though you can see on page 22 you can definitely add one.
    My question is what ports are not at 5V when you plug the 6008 in the first time? Also, is it possible that some of the lines you have connected to the digital ports are driving the lines low?  Do you notice this behavior when you don't have anything connected to the 6008?
    Eric S.
    AE Specialist | Global Support
    National Instruments

  • How can i connect 24VDC to digital input (usb 6008)

    hello,
    how can i connect 24VDC to digital input (usb 6008), is it possible with some optocoupler?
    thanks

    The 6008 is a static DIO, so speed shouldn't be an issue.  Therefore an optocoupler should work.  Just make sure you get one the meets your specs.
    There are only two ways to tell somebody thanks: Kudos and Marked Solutions
    Unofficial Forum Rules and Guidelines

  • NI USB 6008: expected constant expression

    I am using NI USB 6008 device. Looking at NI-DAQ\Examples\DAQmx ANSI C\Analog In\Measure Voltage\Acq-Int Clk\
    So I want to modify the line that has
    DAQmxErrChk (DAQmxReadAnalogF64(taskHandle,1000,10.0,DAQmx_Val_GroupByChannel,data,1000,&read,NULL));
    as
        DAQmxErrChk (DAQmxReadAnalogF64(taskHandle,numsamps,TimeouT,DAQmx_Val_GroupByChannel,data,numsamps,&read,NULL));
    where the corresponding variables have been defined before like:
      Int_t xx=2;
      const Int_t numsamps = const_cast<Int_t&>(xx);
        int32       error=0;
        TaskHandle  taskHandle=0;
        int32       read;
        float64     data[numsamps];
        float64 RatE = float64(raTE);
        float64 TimeouT = float64(numsamps)/RatE;
    But when I try to compile I get this error message:
    $ nmake -f makefile.mak
    Microsoft (R) Program Maintenance Utility Version 8.00.50727.42
    Copyright (C) Microsoft Corporation.  All rights reserved.
            cl  -D_MT -D_DLL -MDd -EHsc  -nologo -G5 -GR -MD -DWIN32  -DVISUAL_CPLUS
    PLUS -D_WINDOWS -IC:\ROOT/include -O2 -c SNatInDAQ.cpp
    cl : Command line warning D9025 : overriding '/MDd' with '/MD'
    cl : Command line warning D9002 : ignoring unknown option '-G5'
    SNatInDAQ.cpp
    SNatInDAQ.cpp(261) : error C2057: expected constant expression
    SNatInDAQ.cpp(261) : error C2466: cannot allocate an array of constant size 0
    SNatInDAQ.cpp(261) : error C2133: 'data' : unknown size
    NMAKE : fatal error U1077: '"c:\Program Files\Microsoft Visual Studio 8\VC\BIN\c
    l.EXE"' : return code '0x2'
    Stop.
    What does it mean 'expected constant expression'? How can I get around this?
    What I want to do is pass the size of that data array from another function.

    Hi novaiscool,
    I think the issue is that you are declaring numsamps as a constant and the DAQmxReadAnalogF64 function wnats a non constant parameter.  Have you tried calling the function with a regular int or a value?  Give that a try and see if you get the same error. 
    You will also need to initialize numsamps to something since you are allocating an array using that variable. 
    Give those things a try and let me know how it works.
    Thank You,
    Nick F.
    Applications Engineer

  • Reading an encoder with a USB 6008

    Hello DAQmx users,
    I have a USB 6008 and it doesn't work the way I want it to.  I have done no troubleshooting or research and I refuse to give you any more information.  You have 30 seconds to answer my question.   i kid, i kid...
    So here is my real question:
    I have a USB 6008 that we use to do simple analog output.  I'm looking for a way to use the USB 6008 to also get encoder information.  I know that the USB 6008 cannot read an encoder directly, but I was wondering if anyone knew of or had any ideas of external hardware that could be used inbetween the 6008 and the encoder.  I think it would be something like 1) the encoder generates pulses 2) external hardware takes encoder pulses, translates them into a digital value representing the angle and outputs this digital value 3) use the digital lines on the 6008 to read in the digital angle value from the external hardware 4) I don't lose my job.
    I realize that this isn't an easy, optimal, or preferred solution, but I want to look into it before being forced to replace the USB 6008 with another piece of hardware.
    Eric
    DE For Life!

    Oops..  Just realized that this got posted in the Motion Control Forums... Meant for it to go in the MIO forums.  Sorry!
    New thread is here, feel free to respond!
    Message Edited by e-Cash-Money on 03-17-2006 04:30 PM
    Eric
    DE For Life!

  • How to connect lvdt and loadcell to usb 6008

    please help me iam dont know  how to choose a daq card. searched a lt but iam lost.
    i want to measure force and displacement simultaneously of a suspension test rig and i wanted to use ni usb6008 because of my project budget.
    can i use this daq card to measure these parameters ??
    please reply.. thanks in advance.
    Solved!
    Go to Solution.

    Hi touheed,
    To be able to determine whether or not using a NI USB-6008 would be suitable for your application it would be useful to get a little more information about the measurements you want to take. If possible would you be able to provide the voltage range you intend to measure with your instruments, and the sampling rate you require? 
    Also I noticed in the subject line that you're going to be using an LVDT, will you also be generating the voltage for this with the 6008, or will this be done seperately?
    To give you some context, the NI USB-6008 does not take truly simultaneous readings at each instant, but will rapdily alternate between channels, giving effectively simultaneous samples. As this device has a sampling rate of 10 Ks/s, and you will be using 2 channels, the effective sampling rate for each input would be 5 Ks/s.
    Matt H
    Applications Engineer
    National Instruments UK

  • Has anyone any experience with a USB-6008 and reading a thermistor value

    Labview 8.0 connected to a USB-6008
    I am using 'BC Components' NTC Thermistor. I used the express VI to create a Vex input and entered the A,B,& C values from the datasheet. The thermistor is the 10K version and I placed a 10K resistor in series with it. I wired it as is shown in the connection diagram, and applied 2.5 volts to it.
    I get completly the wrong temperature readings out of it! I called the NI help line in the UK and the engineer confirmed that I had done everything correctly but couldn't understand why it didn't work.
    Any thoughts?
    Steve Lawson

    I had a similar problem, had it working at one point then screwed it up.
    try this:
    Attachments:
    Temp Pressure EXpress.vi ‏92 KB

  • How can I generate tones with usb 6008 using analog out?... tia sal2

    Greetings All
    I've been looking at the example Sim Phone.vi that comes with labview and would like to generate similar tones out of our usb 6008 device. I can get a very faint sound out of our usb 6008 using the example Gen Multi Volt Updates-SW Timed.vi Does anyone know the best way to alter Sim Phone.vi to have the sound come out of the Analog output of our usb 6008 device. ( I have a small speaker connected to the Analog out on our USB 6008)
    PS: we are using labview 7.1
    Does anyone know the Analog output frequency range of the usb-6008? Is this possible?
    TIA
    Attachments:
    Gen Mult Volt Updates-SW Timed.vi ‏78 KB

    Hi sal2,
    As stated earlier you could most certainly use the USB device to generate sound, but that would be at a max update rate of 150 Hz. While according to Nyquist theorem you could get frequency information for signals below 75 Hz, you may notice that the quality of the data in that spectrum to be very low due to having so few samples.
    While technically possible to produce you really should look for a device with a faster Analog Output update rate. I would look for a device that supports Analog Output at least 10x the maximum frequency that you want the user to hear. Some great, yet lower cost products, would be the M-Series line of products. They would give you the performance that is really needed in the type of application that you are talking about.
    If you still want to use the USB Device, then you would need to use code similar to that found in the example Gen Mult Volt Updates-SW Timed (Found here: C:\Program Files\National Instruments\LabVIEW 7.1\examples\daqmxbase\Dynamic\ao).
    Best of luck getting your system together,
    Otis
    Training and Certification
    Product Support Engineer
    National Instruments

  • DAQmxCfgSampClkTiming on USB 6008

    I've been doing some experimentation with my USB 6008 device.
    Apparently DAQmxCfgSampClkTiming only works with analog channels, not digital ones. Is that a correct observation?
    Claus Tondering

    Hi Claus-
    Also, to be clear- the analog input lines do feature hardware-timed operation, but the analog output lines do not.
    Hopefully this helps-
    Tom W
    National Instruments

  • PWM on USB 6008

    I want to generate 50 Hz PWM wave on USB 6008.
    How can i do it?
    Elad

    To create a pulse train output with the USB-6008/9, you will have to write a series of high and low values to one of the digital lines.  The digital lines on the USB-6008/9 are all software timed, so you will have to control the timing in software (LabVIEW presumably) in a loop with a wait function.  Take a look at the digital output examples in LabVIEW.  Go to Help>>Find Examples, then navigate to Hardware Input and Output>>DAQmx>>Digital Generation, then perhaps an example like "Write Dig Chan.vi".
    Hope this helps.
    -Alan A.

  • Error -10401 occurred at AI Group Config - in relation to USB-6008

    I'm attempting to run a simple vi that uses AI Aquire Waveforms.vi to input voltage data that I have coming in from the USB-6008 DAQ.  However, when I try running the program, I receive the error:
    Error -10401 occurred at AI Group Config
    Possible reason(s):
    NI-DAQ LV:  The specified device is not a National Instruments product, the driver does not support the device (for example, the driver was released before the device was supported), or the device has not been configured using the Measurement & Automation Explorer.
    And I'm not sure how to fix it.  In MAX, the device seems to be working properly and everyhting seems to work fine in the test panel, so I'm slightly at a loss.  I'm running Labview 7.1, and installed NI-DAQmx 7.5 which came with the USB-6008.

    Never mind.  I'm new to Labview, and didn't realize that I could not use the traditonal Data Aquisition components with the USB-5008 (I didn't even realize that NI-Daqmx was different).

  • Can I use more than one USB 6008 in the same program?

    I am working on a project that may require up to six USB-6008 modules.  Before I purchase more I need to know if I can use all six at a time in the same Lab View program.  Can anyone help?
    Solved!
    Go to Solution.

    Hello Nick,
    LabVIEW is able to handel that number of DAQ tasks quite easily, however you must remember that USB has a maximum bandwidth. Therefore you would have to ensure that you have enough USB hubs on your PC. Typically there are between two to four USB slots per hub and each of these will have a maximum throughput rate which will divided between all devices attached to that hub. Therefore although you may have four USB DAQ devices attached to four USB ports if they are on the same hub you may notice greatly reduced rates of data transfer. What I would suggest rather than purchasing six or more USB 6008, why not purchase one PCI card which is able to handel many more inputs with a larger bandwidth.
    Regards
    Andrew George @ NI UK

Maybe you are looking for

  • Double-clicking on Sender name to view full contact card

    Just upgraded to Outlook 2013 with Lync 2013, and so far I hate it.  In Outlook 2007, when I opened an email I could double-click on the sender's name and pull up its full contact card with all of the information that I had entered before, including

  • How to buy adobe media encoder ?

    hi, I can't locate how to go about buying adobe media encoder ? simon

  • Is it ok to query tables/views that are not in the reporting database?

    I have a requirement to show when a resource submitted/modified each of the items in their time sheet I found that we can get in this information by going directly to the publishing table MSP_Assignment_Transactions but it is well documented that acc

  • Default File Selection while Running Data Manager Package

    Hi BPC Experts, What i wanted to know is that is possible to make a file selection as "Default" for running a data manager package.Say for example i wanted to run a simple DMP "Load Transaction data from from BW InfoProvider UI" and the file that i a

  • Having trouble downloading Sky Sports App

    I have a Blackberry Pearl 9105 and I am trying to download the following app (Sky Sports Live Football Score Centre) however, everytime I try to download this app it keep saying "Unavailable for this device". I have friends who have it on their Black