Analoge input not constant/ NI 6221/ DAQmx

Dear Sir
I use DAQmx (labview7.1).
I would like to use NI6221 to read 32 analoge inputs by using 4 input channels (ai0-ai3). 
Each input will read 8 signals by using digital output to select.
I try to look my result by giving constant input voltage to A/D (ai0-ai3).I use input terminal RSE, and NRSE.
My problems are
(1) The reading voltage are changing (some channel is increased and some channel is decreased).
(2) The reading voltage differ from the given value.
How should I solve these problems?
Best regards,
Thongchai

Thongchai,
In reviewing your code, I noticed that you are setting up and clearing your DAQmx tasks with every iteration of the loop, this could be causing you some problems in a couple of ways.  First, setting up and clearing the tasks takes some time, so you could be introducing delay and getting the wrong measured values as a result of this.  Second, when you clear the digital output task in the loop, the lines will return to a default state, which will likely not be the actual values you want -- this could be causing you to measure the wrong channels.  The best practice for using DAQmx tasks inside loops is to perform the setup (DAQmx Create Channel, DAQmx Timing, and DAQmx Start) and the DAQmx Clear outside the loop -- the only functions that should be inside the loop are the DAQmx Read and DAQmx Write.  Along with this, you will need to make sure you set up the timing for continuous sampling instead of finite.  Refer to the LabVIEW example finder and look at the DAQmx examples for continuous acquisition to learn more about this.
Next, you will want to use the Measurement and Automation Explorer (MAX) to configure a task and run a test panel on the channels using a known voltage source to verify that your hardware is working properly.  If the values are measuring properly there, then the source of the error may be within the code.
As far as your measurements themselves, it looks like you are trying to do strain measurements of some sort, these typically can be measured more accurately using differential measurements instead of RSE or NRSE.  I will include a link to a page about the differences between the measurement types and noise considerations for analog measurements.  I will also attach some references to a few documents about strain measurement methods and principles for you review.
Finally, I would recommend looking into an alternative for this system -- either a multifunction DAQ board with more analog input capability (like a PCI-6229, 32 analog inputs), or if you are wanting more accurate strain measurements I would recommend something in our SCXI line for the best strain measurement results.
Field Wiring Considerations for Analog Measurements:
http://zone.ni.com/devzone/conceptd.nsf/webmain/01f147e156a1be15862568650057df15
Strain Measurement References:
http://zone.ni.com/devzone/conceptd.nsf/webmain/04bd243edda22dd386256d75007900d5
http://zone.ni.com/devzone/conceptd.nsf/webmain/C18F65CE920C115086256D720058325B
http://zone.ni.com/devzone/conceptd.nsf/webmain/2d5849b3108e416b86256da2007a8e7b
Regards,
Erik Fogleman
Applications Engineer

Similar Messages

  • 6025e Analog Input not shown correctly

    I use a 6025e on the Analog input channel 0 are 7 volt connected. The Testpanel show this Voltage but if i read this channel via AI_VRead(DAQ_Devicenumber,DAQ_force,1,&force)
    i receive only 4.99 Voltage.
    why ?
    what should i do, to solve the problem

    SuperWolfi,
    If you look at the 6025E User Manual, in the Specifications Appendix A, you will see that for a gain setting of 1 you will have an input range of +/-5V. If you use a gain setting of 0.5 then your input range is expanded to +/- 10V.
    In your call to AI_VRead you are using a gain of 1, instead of 0.5. For information on how to set the gain for your board, please reference Appendix B:
    Analog Input Channel, Gain Settings, and Voltage Calculation of the NI-DAQ Function Reference Manual. You will find that -1 translates to a gain of 0.5.
    6023E/6024E/6025E User Manual
    http://digital.ni.com/manuals.nsf/websearch/0C88F40FFE7F28CD862569AE00574AC1?OpenDocument&node=1065_US
    NI-DAQ Function Reference Manual for PC Compatibles
    http://digi
    tal.ni.com/manuals.nsf/websearch/1630A0B68738B269862567C1007A2912?OpenDocument&node=132100_US
    Regards,
    Justin Britten
    Applications Engineer
    National Instruments

  • Programming Analog Input Registers for MSeries NI-6221

    I am trying to understand the Preliminary M Series Register Map in order to correctly setup and acquire data from the Analog Input channels of my PCX-6221 card. I have been able to figure out the DIO locations and use them but I am having trouble understanding what I have to do to configure and acquire data using the Analog Input registers of the card. I need to program at this level for an RTX application using Microsoft Visual Studio Net 2003 and have had great success doing so with other NI Cards. I have tried looking at the examples provided by the MDDK but I haven't been able to create a environment that allows me to compile them with Chipobjects and it appears like alot of the work is hidden by the subroutines.
    I wonder if someone had a high level algorithum using the Register Map it would help out alot.
    Questions:
    How would I create a multiple channel Scan List and load it into the card setting gain etc...
    How would I configure the card to acquire continously at a specified freq (ex 1000 samples a sec)
    How would I start/stop acquisition
    I would guess getting the status of the FIFO and accessing the FIFO is a matter of reading the AI_STATUS_1 and AI_FIFO_DATA locations
    Would looking at the Register Programming Manual for the "E" Series help me or just get me more confused?
    Thanks in advance for any light you can shed on the subject.
    Floyd

    Hi Floyd-
    Let me address your questions individually:
    How would I create a multiple channel Scan List and load it into the card setting gain etc...
    A multi-channel scanlist can be created as shown in the method aiConfigureChannel() from ai.cpp in the M Series MHDDK \Examples folder.  Note that the other operations leading up that point (notably, aiClearConfigurationMemory() must be performed in the order shown in the various AI examples.  aiex3.cpp is the most useful starting point for investigation, in my opinion.
    How would I configure the card to acquire continously at a specified freq (ex 1000 samples a sec)
    aiex3.cpp shows how to setup the device and its DMA controller (aka the "MITE") for DMA operation.  In order to configure for continuous operation you set the "continous" flag in that example to kTrue.  The effect of that setting is to program the STC-II to generate either a finite or continuous AI sample clock.  This programming is performed in the function aiNumberOfSamples() from ai.cpp and has the effect of setting the appropriate bitfield for continuous operation in the AI_Mode_1 register. 
    Earlier in your post you asked if the STC Technical Reference Manual ( http://digital.ni.com/manuals.nsf/websearch/E929838D7D0EE50986256728007FEADF ) would be a good reference.  In fact, it's a great reference from the perspective of understanding the bitfield/register names and understanding the basics of how the timing hardware works (for example BC, UC and other sample counters are all functionally equivalent in the STC and STC-II).  From the perspective of actual register writes and reads, the functionality is different between E Series and M Series.  The biggest difference, as another forum user alluded, is that we map and write directly to the registers on M Series so Windowed_Mode reads and writes are no longer necessary.
    Another difference between STC and STC-II is that the STC-II uses NI TIO-style counter/timers.  For that reason, the NI 660x RLP manual ( http://digital.ni.com/manuals.nsf/websearch/4CE1C778F442B01386256C870060F9F3  ) would be a good reference for M Series counter/timer operations.
    How would I start/stop acquisition
    Assuming you don't need an external start trigger, you only need to write to the strobe bit AI_Command_2->AI_START1_Pulse.  This will create a single start trigger pulse internally.  The differences between AI_START1 and AI_START are described in the STC Technical Reference Manual.
    A finite acquisition would be stopped automatically by the AI timing engine based on the number of samples you program via the method shown in aiNumberOfSamples().  Continuous AI would be stopped by first stopping the DMA operation and then calling aiReset().
     I would guess getting the status of the FIFO and accessing the FIFO is a matter of reading the AI_STATUS_1 and AI_FIFO_DATA locations
    Yes, this would work but I would strongly suggest using DMA as shown in aiex3.cpp.  If you want to use "programmed I/O" to read the FIFO data directly, that method is shown in aiex2.cpp
     Would looking at the Register Programming Manual for the "E" Series help me or just get me more confused?
    In many cases it would be very helpful.  See my comments, above.
    I have inherited code that works on 65xx cards which I am pretty sure uses windowed mode that I am using in this 6221 driver. I have found that I can set the PLL registers to act as DIO and I can read the Discrete inputs just fine. Makes me curious, if Windowed mode is not used doesn't that mean the addresses are relative to the BAR1 address? Why then am I able to read the DIO?
    I'm not sure why this would work- it's possible that some legacy functionality is still working due to the way you access the hardware in your code.  For full functionality with M Series you must use mapped memory I/O to write and read from the device's registers.
    Also starting with Clock_and_FOUT according to the example I set it for Slow_Internal_Timebase. But when I read back that Address it is always zero. According to the register map it is a "write". Does that mean I can't read it's contents? Or do I seem to have a problem because I am trying to use windowed mode with this card.
    Yes, the "write" registers are write-only and the "read" registers are read-only.  The effect of data read from or written to "write" or "read" registers, respectively, is undefined.
    Hopefully this helps-
    Tom W
    National Instruments

  • Displaying multiple analog input channels using DAQmx READ commands.

    I am using a NI USB-6009 module in a hydraulic load test stand.  I want to read multiple analog voltage inputs and display them on my front panel.  Using DAQmx commands or DAQ assistant, LabVIEW will only let you have one READ command for the analog inputs.  Can someone point me to an example or give me some ideas on being able to display at least 3 analog inputs?  Thanks.

    With the DAQ Assistant, when you get a list of 'Supported Physical Channels', look at the bottom of the window. It says "<Ctrl> or <Shift> click to select multiple channels. When you use the DAQmx Create Channel and have a physcial channel control/constant, click the little arrow on the right side of the control/constant, select browse and use the same <Ctrl> or <Shift> click technique. If you want to enter the channels manually, the format is Dev1/ai0:2 for consecutive or Dev1/ai0,Dev1ai3 non-consecutive channels.

  • Application exe not displaying analog input measurements

    i am using the compactDAQ cDAQ 9172, after building the exe all the other digital and analog output ports are working properly whereas the analog input section is displaying the value as Zero, if i read read this channel from the max, it reads the values without any  errors.what might be the issues.

    Hi Kodeeswar:
    I have a couple suggestions first try to create your analog input application with no digital or analog output task just "analog input" and then build the executable and try it again; second if it is possible for you please try updating to the new drivers of (NI DAQmx), and third reinstalling the last version of the “labview run time engine”. Also the 9172 is the chassis so which module are you using to handle the Analog Input application? To synchronize multiple modules or chassis if this is your case these links might be able to help you so please take a look at:  NI CompactDAQ Module Synchronization,  Synchronized Continuous Analog Input Across. I hope I was able to help you.
    Jaime Hoffiz
    National Instruments
    Product Expert
    Digital Multimeters and LCR Meters

  • The device PCI 6036E: Analog Input error:"the device is not responding to the base address",Output :No signal

    I am using PCI 6036E DAQ card, DAQ 6.9.2. , I have not connected to any external device.
    When I tested card(in Test Panel of MAX2.2,DAQ 6.9.2) an error appearing �the device is not responding to the base address� � then I pressed Yes, Then TestPanel window appearing�
    In analog Input Tag, there is an error �-10805�. This error also appearing when I run the standard analog input samples (use Delphi 6.0).
    I tested analog output functions in TestPanel, Delphi Examples, LabView 6.1. There are not error appearing but there is not output signal (using Oscilloscope to see).
    Output, Input digital functions are working correctly.
    Next I try to foll
    ow all the instruntions as recommended:
    -Changing TO another slots PCI
    -Reinstall Os WinXP,98SE�
    -Use another Computer�
    But all of the cases are still not working.(the above error still appeared, no output signal)

    Nvd,
    I'm sorry to hear about the problems that you are running into with your DAQCard. I can understand your frustration with the errors that you are seeing. You mention that you have tried to do some troubleshooting, I was wondering if you have tried all the troubleshooting techniques listed in this KnowledgeBase:
    http://digital.ni.com/public.nsf/websearch/DCFCDB240788F8D486256D6A00834D80?OpenDocument
    If you have tried all of those things, I would suggest one additional thing to try. I would suggest updating your NI-DAQ drivers to version 7.0. These drivers are the newest versions of our Data Acquisition Drivers, and can be downloaded from our website here:
    http://digital.ni.com/softlib.nsf/webcategories/85256410006C055586256BBB002C128D?OpenDocument&
    node=132060_US
    If you have tried all of the above troubleshooting options, please post a detailed description of what you have tried. This may help to clarify what is going wrong.
    Jed R.
    Applications Engineer
    National Instruments

  • I'm not able to set Analog Input voltages, etc

    ok,
    so i have an NI DAQ I/O card (NI PCI 6723, or something to that effect) and i'm trying to configure the channels for Analog Input signals.
    when i try to choose any kind of setting for Anolog signal by:
    >>drop DAQ Assistant vi onto the block diagram
    >>>>choose Analog Input
    >>>>>>>Voltage
    i get this message "No supported devices found"
    i thought since I have the I/O card, i should be able to configure channels for both input/output.
    i also have ADAC card (from IOTECH) installed but when i look at MAX, i only see the DAQ card.
    i'm really confused at this point. can anyone break things down for me ... what i'm doing wrong?
    -r

    stuartG,
    you were right. so what i'm using for the input is a ADAC 5501MF from IOTECH
    following their manual (http://www.iotech.com/productmanuals/adac_lvi.pdf) it says that the ADAC-LVi libraries can be located at "Functions->User Libraries" palette of labview.
    does this mean that i have to install the ADAC-LVi driver in LabView->User Libraries directory?
    if that's not the case then i don't see why the ADAC-LVi is not showing up in the LabView User Libraries since i've installed the driver correctly (in C\Program File\ADAC )
    do you have any idea why?
    thanks
    -r

  • NI DAQmx Digital Output Trigger To Start Analog Input Task

    Hi everyone.  I am using the NI DAQmx VIs to set a digital output line low (boolean '0').  I want to begin reading an Analog Input voltage (Start Analog Input Voltage reading task) right after the digital output line is set low.  I am using the DAQmx Start Trigger (Digital Edge).vi to try and do this.  I have the digital edge to trigger off a falling edge since the digital output line is being set low.  I am using "do/SampleClock" as the source into the DAQmx Start Trigger (Digital Edge).vi.  
    I don't have the DAQ card (PXI 6229) since someone else is using it but I wanted to write up the SW so that when it becomes available I can have SW to try out.
    I have attached the VI.  Am I setting up this VI correctly?
    Thanks!
    Attachments:
    Trigger AI Task Off DO Edge.vi ‏32 KB

    I think you are going to have to wire that Digital Output to a PFI line on the card with the Analog Input(s).  You then trigger on that PFI line.
    There are only two ways to tell somebody thanks: Kudos and Marked Solutions
    Unofficial Forum Rules and Guidelines

  • PCI 6023E Analog Input with DAQmx

    Hello everybody,
    I have some problems with a PCI 6023E Card. I`m using Lab View 7.1 on Windows 2000.
    When i start the MAX (Devices and.../NI-DAQmx - Devices.../PCI-6023E) and try to open the "Testpanel"
    i get the following message:
    Lab View: An exeption occurred within the external code
    called by a Call Library Node. This might have corrupted
    Lab Views memory. Save any work to a new location and
    restart Lab View.
    VI "BlockatContainerState2.vi" was stopped at node
    0xA10 of Sub VI "DAQmx

    sorry i had a problem thats the rest of the message
    Sub VI "DAQmx Assistant_DAQmx Create AI Channel (sub).vi"
    i get the same message when i try to use the DAQmx Assistant for
    analog Input measurements in Lab View.
    I hope you can help me
    best regards
    Chris

  • I can not read Analog input (a square wave)

    I am programming with Labview 7.1 on FPGA. The hardware is PCI7831. With CB-68LP connector, I connect analog input (a square wave generator) to AI0+(68) and AIGND0(67). I try to read it with waveform chart. But I can't get a square wave on the screen. I did check the square wave generator's output. It is correct. The connector CB-68LP connected with PCI7831 on analog port.
    I am runing the program on emulation, not on real FPGA.
    Thanks

    Signal generator I used is 3010 function generator for BK precision. It is an old instrument. I probed output signal from this generator on oscilloscope with signal generator output conected to oscilloscope probe (+) and signal generator ground to probe (groud). It is a square wave.
    I suspect the teminal I used for I/O port to PCI7831. Because my coworkers installed the hardware for me, he is absent recently. The terminal is CB-68LP  from NI with numbers ( 1 to 68) to specify each connector on it. And I got a SCB-68 Quick Reference Label sheet on my desk to specify numbers correspanding I/O port (for example, 68 -- AI0+). I suspect if this SCB-68 Quick Reference Label sheet matches the terminal CB-68LP?
    I will talk to my coworkers next week.
    jason

  • Error -200279 with simultaneous analog input (different devices) and digital output.

    Hi guys,
    I am a beginner in Labview and have been dealing with this problem for a couple of weeks now and just can't seem to get it completely right, I have a feeling there are a few small bugs in my code/hardware setup.
    I am running an scxi-1000 chassis with a 1600 module and 1302C along with a 1303 accesory for temperature measurements, this is connected to four thermoucouples. Unfortunately I have a limited number of modules available so I am also using a PCI-6221 DAQ card with an scb-68 breakout box used for a digital output and analog input voltage channel. Attached is my labview program. When I run the code at a 50 Hz sampling rate it runs with no errors but the data file comes out extremely wrong, this is also attached. When I run the code at 100 Hz I get error-200279 after a few loops. I used to have 2 daqmx timing VIs (one for each input), but the same error would eventually happen, I have also tried increasing the buffer size on said timing VI. I am also using an old computer (Pentium IV) could this effect the program?
    I have learned a lot going through forms for similar problems to mine but I just can't get it to for an extended period of time, I have posted my simplest code.
    Thanks in advance,
    Luca
    Attachments:
    tc_2.txt ‏1102 KB
    FinalCombined_2.vi ‏128 KB

    Ok this makes sense. I have made the suggested modifications but still getting the same error with sampling rates of 100 Hz or higher. Could you check that I have implemented the queue VIs properly (new file attached)? Also when running at 50 Hz in debug mode it does not look like the second while loop (with the dequeue element) comes into play until I hit the stop button, once I hit the stop button I get the following error:
    Error 1 occurred at Dequeue Element in FinalCombined_2.vi
    Possible reason(s):
    LabVIEW: An input parameter is invalid. For example if the input is a path, the path might contain a character not allowed by the OS such as ? or @.
    =========================
    NI-488: Command requires GPIB Controller to be Controller-In-Charge.
    This leads me to believe I have programmed the queue elements incorrectly.
    Thanks for your help, any suggestions are greatly appreciated.
    Luca
    Attachments:
    FinalCombined_2.vi ‏102 KB

  • How do I use the analog input (ADC) to drive a motion profile in MAX

    We are trying to use an anolog input signal from a DAQ card to control the motion contol axis.  For now, we want the motor speed to follow a sinusoidal voltage waveform, and later on, we will be using a more complex velocity profile. 
    In order to accomplish this task, we have searched the user forum, and found information suggesting to operate the servo motor in 'slave' mode under the 'gearing' option.  Therefore, we have set the Gear Master to 'ADC Channel-1', Mode set to 'absolute', Gear ratio 1:1, and provided the sinusoidal voltage (+/- 5V, 3 Hz) to the AIN1 connector on the MID-7654 controller.  When using the 1-D Interacitve 'single axis' control panel, the motor runs at constant speed in one direction only.  It does not react to the sinusoidal speed profile request as we expected. 
    How do we 'turn on' the 'slave' mode in MAX?  Please talk us through the necessary steps and settings?  Thanks.
    Staffan

    Staffan,
    you can configure and enablethe Gearing mode in MAX and it should be activated after saving the settings and initializing the board. In 1D-Interactive you can't use Gearing. For better flexibility I recommend not using MAX for configuring and enbling Gearing. You better should do this in your application.
    In fact there is a perfect LabVIEW-example that ships with the NI-Motion driver (Master Analog Input - Slave Axis Gearing.vi)
    I hope this helps,
    Jochen Klier
    National Instruments
    Message Edited by Jochen on 10-02-2007 08:37 AM
    Attachments:
    gearing.jpg ‏162 KB

  • How do I acquire multiple signals in the NI cDAQ 9172 using 2 analog input modules?

    Hi everyone,
    Is anyone familiar with using the NI cDAQ 9172?  This is my first time using it and I am not sure what exactly I am doing wrong... Alone with a NI 9233 analog input module, it works great.  I can grab my 4 signals from each channel and go.  However, when I add another analog input module to the mix, it gets an error.  It looks like it is reading only one and not the other.  It bombs at one of the DAQ start task and read task.
    Basically, the block diagram is just a double of the one 9233 working alone.  Is there something needed for input to make the 9172 working?  Any ideas?
    Any help is much appreciated.  Thanks!!

    Hi Jud,
    Both threads are correct.  The cDAQ-9172 has a single analog input timing engine, so both of your analog input modules will need to be in a single task.  The other VI you referenced shows one analog input task (with channels added from two modules) as well as an analog output task.  Analog output has a separate timing engine from analog input, so both of those can run in parallel independent tasks.
    The beginning of this thread is a good example; a single DAQmx Create Task followed by a DAQmx Create Virtual Channel for channels from each module.  Also, Getting Started with NI-DAQmx will give you the fundamentals for data acquisition, though I don't know how many of their examples use CompactDAQ.
    Regards,
    Kyle

  • Synchroniz​ing two counter frequency inputs with multiple analog inputs

    Hello all,
    I'm fairly new to LabVIEW and I'm trying to collec​t data from multiple sources with synchronized tim​ing on the acquisition but I'm having trouble figu​ring it out. My problem is that I've got two count​er frequency inputs, one optical tachometer readin​g one pulse per revolution, and a max machinery fl​ow meter with a k factor of 12000. I can't seem to​ figure out how to sync the timing with my multiple analog inputs. I've be​en attempting to get the tachometer  to sync with ​the analog inputs first by following the example l​inked here. (https://decibel.ni.com/content/docs/DOC-10785) So far each time I run it I either get a timeout e​rror on the DAQmx read or a "Multiple sample clock​ pulses were detected" error (see attached image).  It seems if I slow the sampling rate way down to ​say 10 hz and ensure that the tachometer signal is​ over 800-1000 RPM (13-17 Hz) before starting the VI then the program will run without errors until ​the RPM drops below that threshold then the "Multi​ple sample clock pulses" error occurs.  The code is attached below.
    Does anyone know of a more effective way of syncin​g counter frequency inputs with analog inputs?  I'd like to have a VI that can show 0 RPM (and ev​entually 0 flow as well, but I think I need to fig​ure out the timing of one counter before I add ano​ther as it seems I can't have two counters in the ​same task). Any help on this would be greatly appr​eciated.
    LabVIEW version 13.0
    cDAQ-9178 Chassis with NI 9401 for the two counter inputs and NI 9205 for the analog inputs.
    Thanks!
    Richard
    Solved!
    Go to Solution.
    Attachments:
    SimpleDAQ.vi ‏44 KB
    LV_Error.JPG ‏31 KB

    Maybe third times the charm? 
    So I've finally got a good handle on why the VI is having problems at low RPM though I'm somewhat embarassed how long it took me to do that
    Because I have the counter time synced to my Analog input task if it doesn't see at least two pulses between the two clock pulses set by the analog input task I get the -201314 "Multiple sample clock pulses" error. This seems fine at first as it just sets a minimum RPM that I can measure and it's well below the area I'm interested in so no problems there.  I tried a simple error handler that would clear the error when it happend assuming the loop would keep iterating until the RPM went above that minimum at which point I would get a signal again. This is not the case, the read function just continues to spit out the -201314 error even after the RPM is back in the readable range. So then I tried adding two case structures so that when the error occured it would stop the task, clear the error, and then start the task again on the next loop iteration (Code Attached). This also doesn't work as the error shows up again on the stop task and then AGAIN on the start task on the next loop iteration. It seems this error is not actually being cleared and once it happens it stays with the task regardless of what the error cluster is carrying. 
    Anyone have any ideas?  The only solution I can think of is to just clear all tasks and recreate them each loop iteration until the RPM is readable again but that strikes me as a horribly clunky solution.
    Richard 
    Attachments:
    SimpleDAQ_1_Start Stop.vi ‏48 KB

  • How to get signal from analog input and send it to analog output (real-time​)

    Hi everyone,
    I am doing simple task in Visual C++ and I am using PCI-6221(37 pin).
    Basically, I want to send same signal from 'analog input' to 'analog output'
    at the same time (almost), to make it real-time application.
    Can someone please provide me sample program. 
    I would appreciate if you could provide me with the good tutorial which explains
    step by step everything about programing NI-DAQmx for C/C++.
    Best Regards,
    Khassan
    Solved!
    Go to Solution.

    This is my code in C++, you can optimize it if it looks too messy. This code reads signal from analog input and outputs it through analog output. 
    To make this code work additional  include directories and library directories must be added from NI.
    I hope it helps someone.
    #include <stdio.h>
    #include <conio.h>
    #include "NIDAQmx.h"
    #include <math.h>
    #define DAQmxErrChk(functionCall) { if( DAQmxFailed(error=(functionCall)) ) { goto Error; } }
    int main(int argc, char *argv[])
    int32 error=0;
    TaskHandle taskHandleRead=0,taskHandleWrite=0;
    int32 read=0;
    float64 dataRead[1000];
    char errBuffRead[2048]={'\0'};
    char errBuffWrite[2048]={'\0'};
    bool32 done=0;
    int32 written;
    DAQmxErrChk (DAQmxCreateTask("",&taskHandleRead));
    DAQmxErrChk (DAQmxCreateAIVoltageChan(taskHandleRead,"Dev1/ai0​","",DAQmx_Val_Cfg_Default,-10.0,10.0,DAQmx_Val_Vo​lts,NULL));
    DAQmxErrChk (DAQmxCfgSampClkTiming(taskHandleRead,"",100.0,DAQ​mx_Val_Rising,DAQmx_Val_ContSamps,0));
    DAQmxErrChk (DAQmxCreateTask("",&taskHandleWrite));
    DAQmxErrChk (DAQmxCreateAOVoltageChan(taskHandleWrite,"Dev1/ao​0","",-10.0,10.0,DAQmx_Val_Volts,NULL));
    DAQmxErrChk (DAQmxCfgSampClkTiming(taskHandleWrite,"ai/SampleC​lock",100.0,DAQmx_Val_Rising,DAQmx_Val_ContSamps,1​000));
    DAQmxErrChk (DAQmxStartTask(taskHandleRead));
    DAQmxErrChk (DAQmxStartTask(taskHandleWrite));
    while( !done && !_kbhit() )
    DAQmxErrChk (DAQmxReadAnalogF64(taskHandleRead,1,10,DAQmx_Val_​GroupByScanNumber,dataRead,1000,&read,NULL));
    DAQmxErrChk (DAQmxWriteAnalogF64(taskHandleWrite,read,0,10.0,D​AQmx_Val_GroupByChannel,dataRead,&written,NULL));
    _getch();
    Error:
    if( DAQmxFailed(error) )
    DAQmxGetExtendedErrorInfo(errBuffRead,2048);
    DAQmxGetExtendedErrorInfo(errBuffWrite,2048);
    if( taskHandleRead!=0 )
    DAQmxStopTask(taskHandleRead);
    DAQmxClearTask(taskHandleRead);
    if( taskHandleWrite!=0 )
    DAQmxStopTask(taskHandleWrite);
    DAQmxClearTask(taskHandleWrite);
    if( DAQmxFailed(error) ){
    printf("DAQmx Error: %s\n",errBuffRead);
    printf("DAQmx Error: %s\n",errBuffWrite);
    printf("End of program, press Enter key to quit\n");
    getchar();
    return 0;

Maybe you are looking for

  • How to add a flex marker on the right edge?

    When I place the pointer over or beside a left edge I can change left edge. The audio material is time compressed up to the preceding flex marker when I move the left marker to the right. If I place the pointer over or beside a right edge and move to

  • SSRS Matrix Issue. Expression calculating in row with no data.

    I have a matrix with multiple column groups for different sales channels. With in each group there are several columns and some with expressions for calculations. The rows are based on sales reps. Now not every sales rep sells in every channel, so th

  • Subject:-Tax reduction in invoice is not possible at the time of LIV when c

    Dear SAP expert Subject:-Tax reduction in invoice is not possible at the time of LIV when corresponding order is closed. While carrying out the LIV of vendor invoice against service entry sheet , ERROR message of Order xxxxxxx created in PM module is

  • What are the different type of Granularity

    what are the different type of Granularity a.     Transaction b.     Periodic Snapshot c.     Accumulating Snapshot d.     None of the above

  • Adobe AIR 2.0.3.13070 Does Not Update

    I am running Adobe AIR 2.0.2.12610 on openSUSE Linux 11.0. I am using it mostly to run TweetDeck. Lately, when I run TweetDeck, after a bit Adobe AIR says there is an update to 2.0.3.13070 available. It tells me I have to close TweetDeck to install i