Python USB control 6009

Hello

I'm trying to use python (with types) to control my USB-6009.  The goal is to write an analog voltage and then read the voltage across an entry with the possibility to change the number of points on average and the number of times that it is repeated (sweeps) averaged analog analog input Board.  The problem is that, as we increase the number of times the voltage ramp is repeated (scans), we get a time-out error (call nidaq failed with the error-200284: ' some or all of the requested samples are not yet acquired).  This value confuse us because the scans are in a larger loop and the function of data acquisition should be the same if there is 10 scans (work) or 1000 scans (crashes).  Any ideas would be greatly appreciated.  I have included the code below for reference.

import types

Import numpy

the import of time *.

import of the operator adds

NIDAQ = ctypes.windll.nicaiu # load the DLL

##############################

# Configuration of the typedefs and constants

# to match the values of

# C:\Program NIUninstaller Instruments\NI-DAQ\DAQmx ANSI C Dev\include\NIDAQmx.h

# Settings for scanning

aoDevice = "Dev2/ao0".

aiDevice = "Dev2/ai0.

NumAvgPts = 10

NumSweeps = 50

NumSpecPts = 100

filename = "12Feb15_CO2 Test_12.txt".

Readrate = 40000.0

Sample rate = 1000

StartVolt = 0.01

FinalVolt = 1.01

voltInc = (FinalVolt - StartVolt) / NumSpecPts

# Typedefs

Int32 = ctypes.c_long

uInt32 ctypes.c_ulong =

uInt64 = ctypes.c_ulonglong

float64 = ctypes.c_double

TaskHandle = uInt32

# constants

DAQmx_Val_Cfg_Default = int32(-1)

DAQmx_Val_Volts = 10348

DAQmx_Val_Rising = 10280

DAQmx_Val_FiniteSamps = 10178

DAQmx_Val_GroupByChannel = 0

##############################

def CHK_ao (err):

«"«a simple routine check error»»»

If err<>

BUF_SIZE = 100

buf = ctypes.create_string_buffer ('\000' * buf_size)

NIDAQ. DAQmxGetErrorString (err, ctypes.byref (buf), buf_size)

raise RuntimeError (' nidaq call failed with error % d: %s'%(err,repr(buf.value))))

If err > 0:

BUF_SIZE = 100

buf = ctypes.create_string_buffer ('\000' * buf_size)

NIDAQ. DAQmxGetErrorString (err, ctypes.byref (buf), buf_size)

raise RuntimeError ('nidaq generated WARNING % d: %s'%(err,repr(buf.value))))

def CHK_ai (err):

«"«a simple routine check error»»»

If err<>

BUF_SIZE = NumAvgPts * 10

buf = ctypes.create_string_buffer ('\000' * buf_size)

NIDAQ. DAQmxGetErrorString (err, ctypes.byref (buf), buf_size)

raise RuntimeError (' nidaq call failed with error % d: %s'%(err,repr(buf.value))))

def Analog_Output():

taskHandle = TaskHandle (0)

(nidaq. DAQmxCreateTask ("", ctypes.byref (taskHandle) "))

(nidaq. DAQmxCreateAOVoltageChan (taskHandle,

aoDevice,

"",

float64 (0).

float64 (5).

DAQmx_Val_Volts,

None))

'''

(nidaq. DAQmxCfgSampClkTiming (taskHandle,"", float64 (Samplerate), ")

DAQmx_Val_Rising, DAQmx_Val_FiniteSamps,

uInt64 (NumAvgPts))); # means that we could turn into this growing streaming and playback

'''

(nidaq. DAQmxStartTask (taskHandle))

(nidaq. DAQmxWriteAnalogScalarF64 (taskHandle, True, float64 (10.0), float64 (CurrentVolt), None))

NIDAQ. DAQmxStopTask (taskHandle)

NIDAQ. DAQmxClearTask (taskHandle)

def Analog_Input():

global average

# initialize some variables

taskHandle = TaskHandle (0)

data = numpy.zeros ((NumAvgPts,), dtype = numpy.float64)

# now on the program

CHK_ai (nidaq. DAQmxCreateTask ("", ctypes.byref (taskHandle)))

CHK_ai (nidaq. DAQmxCreateAIVoltageChan ("taskHandle, aiDevice," ",)

DAQmx_Val_Cfg_Default,

float64(-10.0), float64 (10.0).

DAQmx_Val_Volts, None))

CHK_ai (nidaq. DAQmxCfgSampClkTiming (taskHandle,"", float64 (Readrate), ")

DAQmx_Val_Rising, DAQmx_Val_FiniteSamps,

uInt64 (NumAvgPts)));

CHK_ai (nidaq. DAQmxStartTask (taskHandle))

read = int32()

CHK_ai (nidaq. DAQmxReadAnalogF64 (taskHandle, NumAvgPts, float64 (10.0),)

DAQmx_Val_GroupByChannel, data.ctypes.data,

NumAvgPts, ctypes.byref (read), None))

#print "%d points"%(read.value Acquired).

If taskHandle.value! = 0 :

NIDAQ. DAQmxStopTask (taskHandle)

NIDAQ. DAQmxClearTask (taskHandle)

average = sum (data) data.size

Thank you

Erin

This forum is for questions of LabVIEW .

Tags: NI Software

Similar Questions

  • measurement of the current usb or 6009

    I'm trying to trace the evolution of a CCCV charger while it loads a 60V lithium-ion battery. I know that the charge rate is (1/6) C and the nominal capacity of the battery is 26Ahr resulting in a current of 4.33 has during this constant stage. I have the NI USB-6009 case and that e/s analog devices is estimated at 50 Ma, so I can't connect a thread of the charger directly on the device OR. I was thinking of buying a CT that connects directly to the material NOR and run the (+) lead from charger through the CT, as it charges the battery. What is the best way to go with the flow for a complete charge cycle? What are the other options to draw current developments?

    A CurrentTransformer will work with current alternative...

    A CT compensated with element Hall (research LEM) can measure AC / DC...

    I'd look for a Hall Allegro current sensor... has a galvanic isolation output, and the output is the input range 6009.

  • Input 24VDC USB NI 6009

    Hello!

    I develop a LabView program that I need to run a code every time + 24VDC signal from a digital sensor is detected. I intend to use my NI USB 6009, but as far as I know, the analog input is limited to + 20V in mode set (10V max in each pin). I was looking for in the data sheet and saw that data acquisition has a +-35V overvoltage protection, and then I thought: I just need to start my code when it comes the signal would be possible to connect my + 24VDC to the analog input of my DAQ withouth damage it?

    Thank you!

    You can use a voltage divider (resistances, one about 20 k sensor to HAVE and 10 k here forever, if your output of the sensor can handle this load), or in the simplest path one resistance 100 k (that will limit the current entry) and a 4.7V (for a digital input) or 9.6 Z-Diode (to HAVE) to limit the input voltage.

    More protection would be an opto-Coupler, the 24V with a player of resistance 10 k out of the hitch and the LED has 10 k (or 4.7 k) for 5V (6009) pullup.

  • 201003 - USB error 6009

    Hello

    IM using the USB-6009 to recover my data.

    After a 6 month break, when I ran my VI

    A dialogue box that says "loading lvlib" arose before the opening of the VI.

    When I run the VI I get an error '201003' (Image 3) (it was working perfectly well before)-the only change is the upgrade of windows 8.1 for windows 10. (My Labview Interface with adurino seems to work very well)

    I looked at the following links for more information-

    1. http://www.ni.com/white-paper/52818/en/

    2. http://www.ni.com/download/ni-daqmx-15.5.1/6100/en/

    3 http://search.ni.com/nisearch/app/main/p/bot/no/ap/tech/lang/en/pg/1/sn/catnav: of, n8:3.1637, ssnav:su...

    I've updated my drivers NI DAQmx, but not the same error.

    When I look at the devices and inetrfaces - the status shows "absent" (Image 1) - after updating the driver, "ASRL 10::INSTR LPT1" said as 'away' status (Image 2)

    When I test the single device - it removes.

    I'm a little confused as to what to do next? I should return to windows 8? Should I reinstall the USB-6009? Am I missing something?

    Any help would be great.

    Thank you

    Thank you attach your VI and providing additional information.  Here are some facts that might clarify things for you.

    • The only version of LabVIEW which is certified for Windows 10 is LabVIEW 2015.  LabVIEW 2012 came out 3 years before 10 Windows, and is not certified to run on this OS.
    • If the USB-6009 case works with LabVIEW, when you plug it in, MAX (measurement and Automation Explorer) should "wake up" and offer to set it up for you.
    • If you don't have MAX on your desktop, then you certainly won't be able to run your VI.  If you do have MAX, you should be able to open, see your USB-6009, open the test for her panels and manually set to acquire data on an analog channel.  Try a continuous sampling at 1 KHz, 1000 points - you should see a 'noisy' plot change once per second.

    Assuming that my assumption that you try to run your code on a PC running Windows 10 that is correct, I think you have two options:

    1. Start with a PC running Windows 7 x 64 (think Re-imaging your PC 10 Windows, if necessary), and then reinstall LabVIEW 2012 (32 bit).
    2. Continue with 10 Windows PC, but install LabVIEW 2015, DAQmx including (from device drivers).

    Looking forward to learn more about your system, including (a) if my assumptions are correct, (b) what path you chose to try to get this to work, and (c) what happened.

    Bob Schor

  • problem in usb or 6009

    Hello

    I m using or usb-6009 to generate outputs digital. The problem I deal with m, is that my output is going up when I connect my usb to usb-6009 for connector power it...? .. .but when I run my VI all put off going to normal and work correctly.

    means that before I run the outputs high VI...

    what I have to do to remedy the situation. ???

    Hi ok thanks it helps me a lot.

  • USB missing 6009

    Hello

    Way to there Tester - you it the United Nations United Nations vi Labview without having the USB-6009 plugged to the computer?

    Is - it a Simulator or other?

    CDLT.

    Hello

    Indeed, it is possible to simulate a DAQ card.

    I invite to watch the document below which explains step by step how to do:

    How to create a NO-DAQmx simulated device

    Nice day

  • can I use labview 8.01 whit usb device 6009 with vista home

    can I use 6009 with labview 8.0 and Windows Vista home OS usb device?

    LabVIEW 8.2.1 is the first version that is compatible with Vista. While 8.0 could operate, NOR offer any guarantee.

  • Measures of true bipolar voltage with USB 6008/6009

    The 6008 or 6009 to make true bipolar (positive and negative voltages referenced to GND) measurements?  If not, what is the solution to purchase cheaper data this feature?

    Thank you.

    The question of unipolar vs bipolar vs bipolar Pseudo-aleatoire also was mentioned in this thread.  The 6008 6009 use bipolar-only mode and load the setting differential input or CSR.  Please note that {unipolar / bipolar / Pseudo-bipolaire} is independent of {differential / CSR / Pseudo-differentiel}.

    The 6008/6009 don't use 'Pseudo-bipolaire', which means that each differential input should be positive with respect to the ground.

    Best regards

  • How the buffering is the USB-6008/6009 has?

    How many readings can be stored internally until the unit overflows.  Pointers to info that describes this would be appreciated.

    Thank you.

    512 bytes.  256 samples.  This is specified in the USB-6008 user manual.  See Specifications, input analog, AI FIFO (page 24).

    You can also always determine this programmatically.  Create a task of the desired type and query the size of the buffer in a property DAQmx buffer node.

  • BlackBerry micro usb - usb control ppt smartphones

    has anyone tried to connect to a ppt usb controller to switch the slides yet?

    I just ordered a micro usb to usb adapter, but will have to wait for it to be delivered to me.

    would be great if this would allow for the video connection and then the also using a computer usb pocket with mixer laser and slide controller!

    then... the answer is...

    No, it doesn't!

    I tried a mini adapter and nothing happens when you connect the usb of the ppt controller connector. :/

    bad luck. would be nice if she was able to load the drivers and support.

    logic of MB to connect to a ppt projecterand haveto carryaround the wired device in order to to use.

  • NEITHER USB-6008 connect to thermocuples and pressure sensors, control valve

    I am endevoring to build a gasification plant biomass for bench scale test process control plans. NEITHER USB-6008/6009 will be adapted for use as a data acquisition. I'll take RTDS, thermocouples and pressure sensors. I don't want to use industrial automation controllers.  It is also possible to use the channel of analog output for sending signals to a control valve position (using sufficient current/voltage between the two drivers).

    (1) OK.  I just wanted to be sure that you were aware of the potential dangers.

    (2) an RTD is a resistance that has small changes in resistance per degree of temperature change. To measure that you have need of a current source and a sufficient resolution in order to detect small changes.  At 25 degrees C a typical RTD is 109,73 ohms and resistance ohms 0.38 per degree changes.  If you had 1 my crossing this RTD voltage through it would be 109,7 mV and the voltage change of 0.38 mV by degree.

    The resolution of the 6008 on the most sensitive range is 0.49 mV > 1 degree.  The accuracy of the 6008 is 1.5 mV typical.

    For a Type K thermocouple, voltage at 25 degrees is 1.407 mV and change by degree is 39 µV.  Millivolt solving half of the 6008 translates into about 12 degrees.

    If you need a source of excitement for RTD and a kind of amplification for thermocouples and RTD before she would make any sense to try to use USB-6008.

    (3) I have not used anything except LabVIEW with DAQ devices and drivers.  I think DAQmx can be used with MATLAB and other languages.

    (4) the 6008 is the low range made by NOR. You will need to go to a more expensive camera or add signals conditioning circuits.  Talk to your representative OR assistance in the choice of a suitable device.

    Lynn

  • NI USB-6009 digital outputs are active when connected to a PC - I'm not that

    I have a small problem:

    All outputs digital NI USB-6009 module become active when the module is connected to a PC when no VI is running.

    As soon as I start my VI, which controls the module, all the outputs are disabled (now inactive).

    How can I achieve this, outputs are inactive if the module is connected to a PC with no program running?

    johanneshoer wrote:

    I have a small problem:

    All outputs digital NI USB-6009 module become active when the module is connected to a PC when no VI is running.

    As soon as I start my VI, which controls the module, all the outputs are disabled (now inactive).

    How can I achieve this, outputs are inactive if the module is connected to a PC with no program running?

    The USB-6008/6009 case has a pull-up internal (4.7 kOhm) resistance. This causes the outputs digital on the device to have a startup logic high State. t is not recommended to use some sort of resistance of menu drop-down. However, what you can do is add octal buffer like the 74HC541 stamp and a digital output to control the sorting of the 74hc541 state mode. Connect the OAS and CEO input signal. A Summit on the pins of the latter will be sorting the output of the buffer State. Therefore, no output signal will be present until you pull the stems of low control. The USB-6008/6009 case have a 5 volt output (200mA max), you can use the buffer.

  • precision of typical Voltimeter DAQ USB-6009

    Features: I wonder what are the features of the USB DAQ 6009 regarding:
    -Stability and accuracy, + /-(reading ppm + ppm of range) and the resolution of analog input

    Thank you

    And you never thought to go to the products page and find links to the manuals or even the Support page?

  • Control USB drivers

    Hey everybody,

    I have a HP Pavilion all-in-one desktop PC b101ea-20... after that I installed windows 7 32 bit os, I could find no driver USB control for this machine... I got the rest of them... that is to say the other drivers... ive only had a problem with this 2 drivers...

    can someone hepl sort me this matter... Please

    Hello:

    First install the amd chipset driver and restart.  You want the first file on the Web page.

    Who should install the drivers of 3 usb and smbus controller.

    http://support.AMD.com/en-us/download/chipset?OS=Windows 7-32

    If it does not install the drivers usb controller 3.0 then download and install both of these drivers and you should be good to go.

    http://h20565.www2.hp.com/portal/site/hpsc/template.PAGE/public/psi/swdDetails/?sp4ts.oid=5359417&spf_p.tpst=swdMain&spf_p.prp_swdMain=wsrp-navigationalState%3Didx%253D%257CswItem%253Dob_123787_1%257CswEnvOID%253D4052%257CitemLocale%253D%257CswLang%253D%257Cmode%253D%257Caction%253DdriverDocument&javax.portlet.begCacheTok=com.vignette.cachetoken&javax.portlet.endCacheTok=com.vignette.cachetoken

    http://h20565.www2.hp.com/portal/site/hpsc/template.PAGE/public/psi/swdDetails/?sp4ts.oid=5359417&spf_p.tpst=swdMain&spf_p.prp_swdMain=wsrp-navigationalState%3Didx%253D%257CswItem%253Dob_118744_1%257CswEnvOID%253D4052%257CitemLocale%253D%257CswLang%253D%257Cmode%253D%257Caction%253DdriverDocument&javax.portlet.begCacheTok=com.vignette.cachetoken&javax.portlet.endCacheTok=com.vignette.cachetoken

  • photodiode of reading with USB-6009

    I'm reading the voltage output of a photodiode using the analog inputs on a USB DAQ 6009 of Labview.  I am able to read the voltage of the batteries using data acquisition, but when the photodiode is connected with the acquisition of data, I get a noisy signal (see photo).  The photodiode works fine when I connect a voltmeter (voltage response IE with light).

    This could be a problem of air conditioning or impedace signals between DAQ and photodiode (attached sheet).

    Any suggestion would be appreciated.

    Thank you

    You can also consider your signal filtering if there are too many 60 Hz noise.  You can put a simple filtering on the input circuit or use one of the many digital filters applied to your data shipped with labview.  This could help depending on the nature of the desired signal (pulse of IE, DC, curves of decomposition...)

Maybe you are looking for