Measurementproblems with NI USB-6008 in Visual C++ 6.0

Hi,
I'm trying to read some data from this device, but I'm sill in trouble
with it. With this code I get a few values, but then I get the
following error:
DAQmx Error: Attempted to read samples that are no longer available.
The requested sample was previously available, but has since been
overwritten.
Increasing the buffer size, reading the data more frequently, or
specifying a fixed number of samples to read instead of reading all
available samples might correct the problem.
Property: DAQmx_Read_RelativeTo
Corresponding Value: DAQmx_Val_CurrReadPos
Property: DAQmx_Read_Offset
Corresponding Value:
Task Name: _unnamedTask<0>
Status Code: -200279
Maybe someone could have a look in my sourcecode:
#define DAQmxErrChk(functionCall) if( DAQmxFailed(error=(functionCall)) ) goto Error; else
THardwareInterface::THardwareInterface(int dev)
    // Task parameters
    taskHandle = 0;
    char        chan[10];
    sprintf(chan,"Dev%d/ai0:7",dev);
    float64     min = -10.0;
    float64     max = 10.0;
    // Timing parameters
    char        clockSource[] = "OnboardClock";
    uInt64      samplesPerChan = 1;
    float64     sampleRate = 1000;
    DAQmxCreateTask("",&taskHandle);
    DAQmxCreateAIVoltageChan(taskHandle, chan, "", DAQmx_Val_RSE, min, max, DAQmx_Val_Volts, NULL);
    DAQmxCfgSampClkTiming(taskHandle, clockSource,
sampleRate, DAQmx_Val_Rising, DAQmx_Val_ContSamps, samplesPerChan);
    DAQmxCfgInputBuffer(taskHandle,7);
    DAQmxStartTask(taskHandle);
unsigned short THardwareInterface::readValue(int kNr)
    // Data read parameters
    short        data[KANALANZAHL + 1];
    int32       pointsToRead = 1;
    int32       pointsRead;
    float64     timeout = 10.0;
    int32       totalRead = 0;
    unsigned short value;
    int32       error = 0;
    char    errBuff[2048]={'\0'};
    DAQmxErrChk
(DAQmxReadBinaryU16(taskHandle,pointsToRead,timeout,DAQmx_Val_GroupByScanNumber,data,KANALANZAHL,&pointsRead,NULL));
    value=(data[kNr-1]);
    return value >> 5;
Error:
    if( DAQmxFailed(error) ) {
        DAQmxGetExtendedErrorInfo(errBuff,2048);
        DAQmxClearTask(taskHandle);
    return -1;
Thanks, SWT

And here the sourcecode:
// cpp Datein zur Headerdatei THardwareInterface.h
#include "THardwareInterface.h"
#include <time.h>
#include <iostream>
#include <stdlib.h>
#include <string>
#include <NIDAQmx.h>
using namespace std;
THardwareInterface& THardwareInterface::exemplar(int dev)
    static THardwareInterface instanz(dev);
    return instanz;
THardwareInterface::THardwareInterface(int dev)
    // Task parameters
    taskHandle = 0;
    char        chan[10];
    sprintf(chan,"Dev%d/ai0:7",dev);
    float64     min = -10.0;
    float64     max = 10.0;
    // Timing parameters
    char        clockSource[] = "";
    uInt64      samplesPerChan = 2;
    float64     sampleRate = 1000;
    DAQmxCreateTask("",&taskHandle);
    DAQmxCreateAIVoltageChan(taskHandle,chan,"",DAQmx_Val_RSE,min,max,DAQmx_Val_Volts,NULL);
    DAQmxCfgSampClkTiming(taskHandle,NULL,sampleRate,DAQmx_Val_Rising,DAQmx_Val_FiniteSamps,samplesPerChan);
    fehlerZaehler = 0;
    ausdatei.open("error_log.txt");
THardwareInterface::~THardwareInterface()
    ausdatei.close();
bool THardwareInterface::liesWerte()
    // Data read parameters
    int32            pointsToRead = 1;
    int32            pointsRead;
    float64            timeout = 0.5;
    int32            error = 0;
    char            errBuff[2048]={'\0'};
    SYSTEMTIME*        sysTime = 0;
    fehlerZaehler++;
    DAQmxStartTask(taskHandle);
    DAQmxErrChk
(DAQmxReadBinaryU16(taskHandle,pointsToRead,timeout,DAQmx_Val_GroupByScanNumber,data,KANALANZAHL,&pointsRead,NULL));
    DAQmxStopTask(taskHandle);
    fehlerZaehler = 0;
    return true;
Error:
    if( DAQmxFailed(error) ) {
        DAQmxGetExtendedErrorInfo(errBuff,2048);
        sysTime = new SYSTEMTIME;
        GetLocalTime(sysTime);
        ausdatei <<
sysTime->wDay << "." << sysTime->wMonth << "."
<< sysTime->wYear << " "
     << sysTime->wHour << ":"
<< sysTime->wMinute << ":" << sysTime->wSecond
<< endl;
        delete sysTime;
        ausdatei << "DAQmx Error: "
<< errBuff << endl << endl << endl;
    if (fehlerZaehler <= 5)
        return liesWerte();
    else {
        fehlerZaehler = 0;
        return false;
unsigned short THardwareInterface::gibWert(int kNr)
    unsigned short    wert;
    wert=(data[kNr-1]);
    return wert >> 5;

Similar Messages

  • 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!

  • Drive higer load with the usb 6008

    Hi all,
    I need to drive a small motor with the analog output of the usb6008 device ... connecting it directly doesn't seem to work.
    Any suggestions how get it working??? what does the 6008 output?
    My motor works on a AAA battery dricetly.
    Thanks a lot

    On Apr 23, 12:40 am, lav21 <[email protected]> wrote:
    > Hi all,
    > &nbsp;
    > I need to drive a small motor with the analog output of the usb6008 device ... connecting it directly doesn't seem to work.
    > &nbsp;
    > Any suggestions how get it working??? what does the 6008 output?
    > &nbsp;
    > My motor works on a AAA battery dricetly.
    > &nbsp;
    > Thanks a lot
    The analog outputs of the USB-6008 are only rated at 5 Milliamps per
    channel. One suggestion for getting it to work is to use an emitter
    follower to get more current to drive your motor.
    Howard

  • Low sample rate with NI USB-6008

    Hello,
    We are working on a project collecting data from a hybrid rocket motor for
    University research. We are using a NI USB-6008, which has a sample rate of
    10kHz. We are using 3 channels and getting a sample rate of ~60 samples per
    second. I have attached the VI. Is this slowed by software, or physical
    computer computation speed? This sample rate needs to be much higher. Any help
    is greatly appreciated.
    - Theo
    Attachments:
    Hybrid DAQ_10.vi ‏73 KB

    Hi Rocket 154,
    You’ve already had some
    great responses, but I just wanted to add a little bit. A great starting point
    to writing good code would be the Getting Started with NI-DAQmx: Main Page,
    as well as the shipping examples (In LabVIEW, Help » Find Examples) already
    mentioned.
    If you navigate a bit
    through the links (Basic Programming with NI-DAQmx » Getting Started with NI-DAQmx
    Programming in LabVIEW) you’ll end up with some great resources. I recommend Learn
    10 Functions in NI-DAQmx and Handle 80% of your Data Acquisition Applications.
    It will detail many of the functions you can use and give you a feel for proper
    code style in LabVIEW.
    I hope that helps.
    Mark E.
    Precision DC Product Support Engineer
    National Instruments
    Digital Multimeters (DMMs) and LCR Meters
    Programmable Power Supplies and Source Measure Units

  • Laser operation with a USB 6008 DAQ

    I'm wondering how I go about using the USB 6008 DAQ in conjuction with labView to turn on and off ths laser: 
    http://www.maplin.co.uk/p/1mw-3v-red-laser-module-le07h
    The laser must be turned on using 3V which isn't possible with this DAQ. I was thinking of usinga BC 109 transistor, then have the laser connected to an external power supply which is supplying 3V to the laser. then have the laser connected to the collector of the transistor.
    I set this up and it didn't exactly work out as the laser was drawing to high a current and not working correctly.
    Can anyone help me?

    OK. The problem is that you need to supply about 30 mA to the laser to get it to work. The digital outputs of the USB-9008 are limited to 8.5 mA or less. Furthermore, a laser diode is a current operated device. If you apply a fixed voltage the current will vary depending on the exact doping used when the device was manufactured and on it instantaneous temperature. The curretn rises exponentially with voltage as in any diode. The link you posted does not have any real data about the electrical characteristics of that diode.
    Typically a current regulating circuit is used to drive laser diodes.  The simplest circuit is a resistor in series with the diode connected to a power supply with a voltage higher than 3 V. The value of the resistor depends on the power supply voltage, the voltage drop across thes witching transistor, and how much current you want to run through the diode. If you have applied 12 V to that laser from a source which can provide substantial current (>50 mA), you have probably destroyed it.
    Lynn

  • 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

  • Does USB-6008 student kit come with a LabVIEW 2009 textbook?

    Hello.
    I'm taking a LabVIEW class that requires the "LabVIEW 2009 Student Edition" textbook and software on DVD. I want to also get the USB-6008 Module, too.
    Browsing the NI Academic Starter Kits, I came across the USB-6008 Student Kit, which says comes with the USB-6008 Module, LabVIEW Student Edition software, and SignalExpress LE. This Kit seems like the best package for me to purchase, but the website is not clear as to whether the textbook is included. Does anyone know if the book is included with the USB-6008 Student Kit?
    Thanks,

    Hi YTrunner,
    Thank you for contacting National Instruments. I can confirmthat the 6008 starter kit does not come with the textbook. You would need to purchase these products separately.
    Many  thanks,
    Andrew McLennan
    Applications Engineer
    National Instruments

  • 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).

  • Will USB-6008 DAQ be able to power and record voltage for UMS T5 tensiometer at the same time?

    I would like to use my NI USB-6008 to provide power to my UMS T5 tensiometer  (http://www.ums-muc.de/en/products/tensiometer/t5.html) as well as take readings from it, but I don't know if this is possible to do properly. The supply voltage for the instrument can be as low as 5V, which I can easily get from the dedicated +5V channel. I am able to power the instrument and connect it to an analog input on the 6008 and measure a voltage in differential mode. However, while reading the support literature for the instrument, I find the following:
    "Potential data acquisition pitfalls: Because the pressure transducer is configured in a Wheatstone full bridge, the input voltage and signal mV output cannot be connected to the same reference (ground). Hence, the signal mV output can only be measured using a differential voltage measurement. Therefore, do not attempt to make a single-ended measurement of the pressure transducer mV output."  (http://www.decagon.com/assets/Uploads/MeasuringUMSTensiometerswithnon-UMSControlandDataAcquisitionSystems.pdf)
    My understanding is that the 6008 can take a differential measurement if I attach the signal "+" and signal "-" to the positive and negative analog input terminals. However, it seems that all of the Ground ports on the 6008 are grounded to the same reference, which would make my voltage measurement invalid according to the paragraph above. So my real questions is: if I attempt to record the voltage using one of the analog inputs on the 6008 in this way, is the measurement valid? Or do I need to find a separate power supply with a different reference ground to ensure that the measurement is accurate?

    The specification sheet for that device is very poor. The manual is not much better. Companies which want to sell scientific equipment should publish decent data sheets or get out of business.
    In section 3.4.3 General requirements the device is described as a "non-amplified bridge circuit."  This information along with the bridge impedance should be in the specifications because it is essential to applying the device under any circumstances other than the nominal behavior at 10.6 V.
    The answer to your question is this:
    You can use it with the USB-6008.  The 5 V power supply will result in output voltages slightly less than half (5/10.6) the voltages specified under nominal conditions. You can use the differential input mode on the USB-6008.  The absolute input voltages will be about 2.5 V with the 5 V supply. That voltage is within the working range of the device. The differences will probably be less than 100 mV. The resolution of the USB-6008 on the +/-1 V range is about 0.5 mV so your pressure resolution will be around 1 % of full scale. The input impedance and termination voltage of the USB-6008 will introduce some errors.  These may be on the order of 5-10%. I cannot predict much better without the missing bridge impedance specification.  Those errors should be systematic and relatively constant. A calibration of the whole system - sensor and DAQ device together should allow you to compensate for much of that error.
    Lynn

  • Usb 6008 daq spi lcd server client

    Hi.
    I'm new to the labview.ich have a project and comes to data acquisition and remote monitoring
    detaille:
    2 computer are labview installed on both and connected to wifi / internet.
    the server computer connected with ni usb 6008 and it pt100 temperature sensor
    it should also include the measurement data display on an LCD
    it should be the client computer also read out the measured values
    has anyone an idea how could you start?., I will be very grateful

    This sounds like a pretty big task for someone new to LabVIEW.
    First get the DAQ working on the server PC.  There are tons of examples that ship with LabVIEW for taking DAQ, go to Help >> Find Examples.
    Getting the information to your other PC can be done many different ways, but maybe the easiest is to just use a Web Server to control the front panel.
    http://zone.ni.com/reference/en-XX/help/371361H-01/lvconcepts/viewing_fp_remote/
    Also you could remote into this PC using remote contol software and remote desktop.
    As for displaying data on an LCD.  A relativly simple solution is to use an Arduino UNO, the LIFA toolkit and an LCD connected to it.  It is a little bit if a round about solution but the LIFA toolkit comes with code to output to LCDs connected and it is relatively easy to use.
    EDIT:  LIFA https://decibel.ni.com/content/groups/labview-interface-for-arduino
    Unofficial Forum Rules and Guidelines - Hooovahh - LabVIEW Overlord
    If 10 out of 10 experts in any field say something is bad, you should probably take their opinion seriously.

  • Acer pda n30 ni usb-6008

    Hi! I want to connect Pocket PC Acer PDA n30 with NI USB-6008 card and with accelerometer ADXL311. Did anyone do somything symilar to this? Could anyone send me a link to a paper that has something to do with my question? I am looking for someone who has already measured movements of some parts of a human body with the hardware I mantioned. I need links to some papers. I'll be greatfull if anyone can help me.

    PDAberlin:
    I hope all is well. With the LabVIEW PDA Module, you can most definitely develop applications that run on your Pocket PC. There are some examples that you can use to get an idea on how to develop data acquisition applications for your Pocket PC device. They are located at:
    C:\Program Files\National Instruments\"LabVIEW version"\examples\daqmxbase
    C:\Program Files\National Instruments\NI-DAQmx Base\Examples
    I hope this helps and feel free to post again if you need additional information.
    Best Regards,
    Rudi N.

  • I have LabView Student Edition, how can I make work a USB 6008?

    The Student edition it doesnot have many Vi's that there are necesary to work with a USB 6008, I would like to know how can I make work the Usb 6008 with LabView Student Edition

    Hello Jorge,
    When you say "NI-DAQmx configuration" do you mean the NI-DAQmx Base Configuration Utility?  Are you using NI-DAQmx or NI-DAQmx Base to communicate with the 6008?
    NI-DAQmx 7.5 added support for the USB-6008.  Therefore, you can use either NI-DAQmx or NI-DAQmx Base to control this device.  Make sure that you are setting the USB-6008 to NI-DAQmx before trying to use the NI-DAQmx VIs in LabVIEW.  To do this, Open Measurement and Automation Explorer (MAX) and select Tools >> NI-DAQmx Configuration >> NI-DAQmx USB Driver Selector.  Your USB-6008 should appear in this window, indicating which driver your device is configured for.  Make sure it is set to NI-DAQmx before trying to use the NI-DAQmx VIs.
    When your 6008 is set to NI-DAQmx, you cannot use NI-DAQmx Base or any of the DAQmx Base examples.  Likewise, when the 6008 is set to NI-DAQmx Base, you cannot use any NI-DAQmx VIs.
    If you would like to use NI-DAQmx with your USB-6008, please set the driver by following the steps above and verify that "USB-6008" is listed under "Devices and Interfaces >> NI-DAQmx Devices" in MAX.
    I hope this helps.  Please let me know if you continue having trouble with your USB-6008.
    Regards,
    Sean C.

  • USB-6008 How to move an executable to a different computer.

    Hello NI Forums!  Please bear with me as I am new to NI products as well as this forum.  Hope I'm posting in the correct board.  I am an electronic technician with over 30 years experience in a variety of hardware and software who is trying to move an executable from an older Windows XP computer to a new Win 8 machine.  
    First, I just moved the .exe file itself.   When executed, it produces an error dialog:  "Unable to locate the LabVIEW Run-Time engine"  "This executable requires a version 2011 (or compatible) LabVIEW Run-Time Engine."
    Next, I ran the driver installation disk that came with the USB-6008 module.  Now the executable will start but it doesn't appear to communicate with the USB-6008 because it doesn't operate the digital I/O.
    I can run NI MAX and see the USB module as well as test the analog and digital I/O so I know the hardware is working.
    I have been surfing the knowledge base and have found references to .dll & .vi type support files but have no idea which ones to look for and where they might be.
    Can this move be accomplished without having to recompile the exe?  I have no access to the source files.
    Thanks!
    Solved!
    Go to Solution.

    Again, thanks for all the advise, information ( and patience).  I  actually was referring to the module name as seen in MAX.  That wasn't made clear. I was at the end of a very long day.  But i have seen instances where the PC name is part of a network address, I just didn't know if that applied here.
    Regarding dated drivers, I downloaded the current offering of RTE 2011 (what ithe app asking for) which includes win 8 drivers.   That appears to have satisfied the initial failure of the app to run (no error message, app opens and does it's splash - then nothing else).  
    The device name for the USB-6008 module is dev1 on both PCs.  I will go back today to look for support files I may have missed.  
    Regarding tasks and such running in MAX, when I opened MAX it appears this was the first time it had been used as I had to agree to the limited evaluation license on start-up.  It starts up with an empty project and there are no projects available to load.
    I assume it's not possible to decompile an executable to make the adjustments for the new host computer?

  • K-Thermocouple, temperature range, usb 6008...

    Hi,
    I seem to have a problem with the temperature range with my USB 6008 board. When I connect a calibrator to it (to simulate a K-thermocouple), I can only measure temperatures between 0 and 100°C. What I would need to measure are temperatures around 500°C...
    Do you know how I could overcome this problem ?
    I understand the USB 6008 it is not the best board for thermocouple measuring, especially with a K type one, but it is the only one I've got...
    Thanks a lot !

    The voltage is 5V, and the thermocouple is already grounded.
    Enclosed is the VI I created. Now regarding the measurements, the values between 0 and 100°C are not correct, but I believe a "formula task" in the VI will take care of that. In fact, I have a range of approximately 7.5°C (ie 0°C on the
    calibrator give me 0°C on LabView, and 100°C on the calibrator give me
    7.5°C on LabView). When I reach 100°C, the values hit a ceiling and stay constant, whatever higher temperature I set with the calibrator.
    Concerning the CJC, I basically use the default value (25). I tried changing it, but the consequences were minimal.
    Is there a potentiometer on the board that could change this faulty range ? I didn't dare open the box yet...
    Cheers,
    K
    Attachments:
    VI Thermocouple.vi ‏257 KB

  • 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

Maybe you are looking for

  • My mac does not have airplay mirroring. How can I get it to work with my apple tv

    My Mac doesnt not have airplay and I have apple TV.

  • Change Name of iTunes Hard Drive?

    I store all of my iTunes content on an external hard drive. I want to change the name of the hard drive, but I'm worried that this will break iTunes for me. Does anyone know how I can make this change simply and easily without creating problems for i

  • Full PO output for any change in PO ( EDI output)

    Hi Gurus... Currently whenever there is a any change in PO only the relvant change is sent for EDI out put ( Standard SAP) Our client requirement is whenever there is a change in PO the full PO should be sent to EDI out put ( same as when purchase or

  • How can I revert back to my old version of FF after updating to 15.0?

    FF kept urging me to update to version 15.0, but I resisted because doing so would disable some key aps, the major one being my password and security ap, Abine where all my passwords are stored. When I started the computer this morning, FF version 15

  • Color Keying in Java

    Hi all, I was wondering, Is there a way, when loading an image (with the image io package), or drawing an image (with a Graphics object) to make a certain color from the image be ignored and not drawn onto the content pane? * I'm using Swing I am cre