How to do a single channel DAQ using NI-DAQ driver software with a PCI-MIO-16XE-10 card

Hi,
I would like to find out how I could do a simple one channel Data Acquisition from a signal generator using the NI-DAQ driver software with a PCI-MIO-16XE-10 card.
I have written some test problem but even when the signal generator is turned on/off I get back some weird values.
Here is my code.
CString sFunctionName("");
double volt[OUTPUT_POINTS*2];
double out[OUTPUT_POINTS*2];
short timebase, ready, code, stopped;
unsigned short sampleInterval;
int i, status, count=0;
unsigned long update, points;
short* ai_buffer;
short output_ch_vector[16];
int local_ITERATIONS = 2;
SAFEARRAYBOUND bound[1];
double dataItem = 9.9;
long j;
long k;
double* pTheValues;
LPTSTR lpsz_ErrMsg;
// Initialise device
status = Init_DA_Brds (deviceNumber, deviceNumberCode)
Initializes the hardware and software states of a National Instruments
DAQ device to its default state and returns a numeric device code that
corresponds to the type of device initialized
Init_DA_Brds(DEVICE, &code);
// Check return code from Init_DA_Brds
Code return should be 204: PCI-MIO-16XE-10.
if (code < 0)
CString sError;
sError.Format("Code error: %d", code);
if (code == -1)
sError = sError + ": No device found";
LPTSTR lpsz = new TCHAR[sError.GetLength()+1];
_tcscpy(lpsz, sError);
AfxMessageBox(lpsz);
delete lpsz;
return S_FALSE;
// Allocate memory for analog output and input arrays
//ao_buffer = new short[OUTPUT_POINTS*2];
ai_buffer = new short[OUTPUT_POINTS];
// Set double-buffering
status = DAQ_DB_Config (deviceNumber, DBmode)
Enables or disables double-buffered DAQ operations.
status = DAQ_DB_Config(DEVICE, 1);
if (status < 0 )
sFunctionName = "DAQ_DB_Config";
goto TidyUp;
// Get the rate parameters
status = DAQ_Rate (rate, units, timebase, sampleInterval)
Converts a DAQ rate into the timebase and sample-interval
values needed to produce the rate you want.
status = DAQ_Rate(RATE, 0, &timebase, &sampleInterval);
if (status < 0 )
sFunctionName = "DAQ_Rate";
goto TidyUp;
// Setup scan
status = SCAN_Setup (deviceNumber, numChans, chanVector, gainVector)
Initializes circuitry for a scanned data acquisition operation.
Initialization includes storing a table of the channel sequence
and gain setting for each channel to be digitized
status = SCAN_Setup(DEVICE, 1, ai_channels, gain);
if (status < 0 )
sFunctionName = "SCAN_Setup";
goto TidyUp;
status = SCAN_Start (deviceNumber, buffer, count, sampTimebase,
sampInterval, scanTimebase, scanInterval)
Initiates a multiple-channel scanned data acquisition operation,
with or without interval scanning, and stores its input in an array
status = SCAN_Start(DEVICE, ai_buffer, OUTPUT_POINTS, timebase, sampleInterval, timebase, 1000);
if (status < 0 )
sFunctionName = "SCAN_Start";
goto TidyUp;
while(count < local_ITERATIONS)
// Check whether we are ready to input another half-buffer
status = DAQ_DB_HalfReady(DEVICE, &ready, &stopped);
if (status < 0 )
sFunctionName = "DAQ_DB_HalfReady";
goto TidyUp;
if (ready == 1)
status = DAQ_DB_Transfer(DEVICE, ai_buffer, &points, &stopped);
if (status < 0 )
sFunctionName = "DAQ_DB_Transfer";
goto TidyUp;
count++;
// Clear the analog input
status = DAQ_Clear (deviceNumber)
Cancels the current DAQ operation
(both single-channel and multiple-channel scanned) and reinitializes the DAQ circuitry.
status = DAQ_Clear(DEVICE);
if (status < 0 )
sFunctionName = "DAQ_Clear";
goto TidyUp;
status = SCAN_Demux (buffer, count, numChans, numMuxBrds)
Rearranges, or demultiplexes, data acquired by a SCAN operation
into row-major order, that is, each row of the array holding the
data corresponds to a scanned channel
status = SCAN_Demux(ai_buffer, OUTPUT_POINTS * 2, 2, 0);
if (status < 0 )
sFunctionName = "SCAN_Demux";
goto TidyUp;
//Convert binary values to voltages (Doesn't actually take a reading from board)
status = DAQ_VScale (deviceNumber, chan, gain, gainAdjust, offset, count, binArray, voltArray)
Converts the values of an array of acquired binary data and the gain setting for that data
to actual input voltages measured.
status = DAQ_VScale (1, 0, 1, 1.0, 0.0, OUTPUT_POINTS , ai_buffer, volt);
if (status < 0 )
sFunctionName = "DAQ_VScale";
goto TidyUp;

Hello,
Please take a look at lots of examples available at :
1. www.ni.com >> NI Developer Zone >> Development Library >> Measurement Hardware
2. C:\program files\national instruments\ni-daq\examples\visualc
Sincerely,
Sastry V.
Applications Engineer
National Instruments

Similar Messages

  • How do I add a multiplexer accessory device to my PCI-MIO-16XE-10

    I've been told I have to add a multiplexer to my PCI-MIO-16XE-10 card (so I can read more than the 10 chanels it provides for at the same time).
    How do I do this in the Measurement&Automation Explorer?
    Thanks for any help!

    Brain&Body,
    The card can function as either 8 channels in differential mode or 16 channels (Referenced single ended or None referenced single ended - later uses system ground). The single ended mode(s) will allow you get access to all the channels, though it would mean that you would expect to see more noise on the signal than in differential mode.
    You can select these modes within MAX under the properties for the specific DAQ card. Look under analogue input (AI) there you will see a pull down for the modes please select the mode you want. I would recommend that you read the user manual regarding the benefits and limitations of the modes. If using a developement tool (LV,CVI, VB or VC++) please make sure that you are reading single ended signals.
    If you wish to expand the system further you might want to consider purchasing a multiplexer system such as an SCXI system (reference page 184 of the 2005 catalogue). I would recommend that you contact your local sales office and speak with one of our Internal Sales Engineers - UK general number of +44 1635 572400.
    Kind regards
    JoeW
    NI-UK

  • How to program labview to output continous voltage using NI PCI-MIO-16XE-50

    I am an undergraduate student working on a research project. I need to program a labview block diagram to output continous voltage using DAQ NI PCI-MIO-16XE-50. I am new to this and having problems with formulating.
    For example, if i need to output 4V, how to output 4V from the DAQ.
    I know that there are 2 channels for output. But having problems figuring out which pins to use as well.
    If there are any examples,tutorials or whatever hints i could get in order to solve this, that would be great. I am simply confused and wondering where to start.
    Thanks in advance.
    Confused undergraduate student

    Here is an example of how to do some basic analog and digital communication. Since you need a 4V signal you are going to want to use Analog Output.
    http://decibel.ni.com/content/docs/DOC-15408
    Product Support Engineer
    National Instruments

  • How to upload a file into server using j2ee jsp and servlet with bean?

    How to upload a file into server using j2ee jsp and servlet with bean? Please give me the reference or url about how to do that. If related to struts is more suitable.
    Anyone help me please!

    u don't need j2ee and struts to do file uploading. An example is as such
    in JSP. u use the <input> file tag like
    <input type="file"....>You need a bean to capture the file contents like
    class FileUploadObj {
        private FormFile srcFile;
        private byte[] fileContent;
        // all the getter and setter methods
    }Then in the servlet, you process the file for uploading
        * The following loads the uploaded binary data into a byte Array.
        FileUploadObj form = new FileUploadObj();
        byte[] byteArr = null;
        if (form.signFile != null) {
            int filesize = form.srcFile.getFileSize();
            byteArr = new byte[filesize];
            ByteArrayInputStream bytein = new ByteArrayInputStream (form.srcFile.getFileData());
            bytein.read(byteArr);
            bytein.close();
            form.setFileContent(byteArr);
        // Write file content using Writer class into the destination file in the server.
        ...

  • How to install Win 7 on Mac using USB flash drive....???

    How to install Win 7 on Mac using USB flash drive....???

    clintonfrombirmingham wrote:
    I thought that installation through Boot Camp required, without hacks, a physical optical disc to install Boot Camp? I don't use it any longer since I run XP under Parallels, but I would swear that you have to use a disc, and not a USB thumb drive, to install Windows?
    Maybe some real Boot Campers will visit this thread...
    Clinton
    If you have the Media you can use it to create a bootable USB key via boot camp assistant.
    It will create the usb and has the option of pre-downlading the drivers and bootcamp utilities for windows.
    It is pretty much all automated and quite simple.

  • Installing two PCI-MIO-16XE-10 DAQs

    I have two PCI-MIO-16XE-10 boards, which work fine independently. I now have put them into the SAME computer, and the Windows XP has successfully found them and installed drivers for them. But when troubleshooting using the NI Measurement&Automation program, neither card is working anymore. The self-test fails, and the error message does not explain why. How can I use both DAQs together in the same computer?
    thanks,
    SAK

    Hi SAK-
    There should be no problem with using both cards in your system.  A few things to check are:
    Make sure that NI-DAQmx and Traditional NI-DAQ are not trying to access the board at the same time.  If you use the board with Traditional NI-DAQ you will need to reset the Traditional NI-DAQ driver before using the board with NI-DAQmx again.
    Make sure that you have administrative rights on the PC you're using or the driver may not function properly.
    Make sure that no other applications are currently accessing the boards- the driver will lock out access when the board is currently in use by another application.
    You can further troubleshoot the issue by removing all other PCI cards from the system to try and identify the problem as a resource conflict between your DAQ boards and any other peripherals installed on the system.
    Hopefully this helps-
    Tom W
    National Instruments

  • Using external time base on PCI-MIO-16XE-50

    What is frequency of the internal time base of PCI-MIO-16XE-50? How can I replace it with my external timebase ( a pulse signal from an atom clock)?
    Also after replacing the internal timebase with external one, the scan rate and channel convert rate will be based on this external timebase automatically, right? For example, I define 1000 scan/s on AI0-AI8, it will be a scan rate based on the external timebase?

    The AI Clock Config.vi can be used to set the scan clock rate. If a person wishes to change the boards internal time base to an external one, the method described in http://digital.ni.com/public.nsf/3efedde4322fef19862567740067f3cc/5601c8268d625a3c86256cf50071199d?OpenDocument is the way to do this.
    The PCI-MIO-16XE-50 has a RTSI connector. Please look at the PCI Board JPEG on http://digital.ni.com/public.nsf/websearch/AD2D553F55A07BBF8625650D005F1F00?OpenDocument for the location of this connector. This site also contains a table of the RTSI Connector Pinouts.

  • How to calculate min/max scan rate of PCI-MIO-16XE-50

    My board: PCI-MIO-16XE-50 , 20MHz timebase
    The min/max scan rate is0.00596-20K scan/s and the channel rate is 1.53-20Kchannels/s
    How do they calculate these data?

    Hi May
    Check out the knowledge base locate at http://digital.ni.com/public.nsf/websearch/EA4E306828AF05B586256B8F00661A8B?OpenDocument . I think it answers your question.
    Serges Lemo
    Applications Engineer
    National Instruments

  • HI. ... Anyone know of any issues with using Logic Pro music software with Mountain lion OS.. I have heard rumours in the past is that all sorted now?

    HI. ...
    Anyone know of any issues with using Logic Pro music software with Mountain lion OS..
    I have heard rumours in the past is that all sorted now?

    At least Logic Pro 9 and Logic Pro X work correctly in Mountain Lion. Furthermore, Logic Pro X requires the latest OS X Mountain Lion version

  • I am using Aperture 3 now and I love it. But I would like to purchase or download perhaps some freeware, easy to use photo imaging/editing software with more filters, perhaps layering etc. My Apple mentor suggests Pixelmator or Gimp ?

    I am using Aperture 3 now and I love it. But I would like to purchase or download perhaps some freeware, easy to use photo imaging/editing software with more filters, perhaps layering etc. I don't want something with a very steep learning curve, getting to old for that. My Apple mentor suggests Pixelmator or Gimp ? Are there some others out there? When I was still in the Windows world, I used Photoshop Elements but that is now in my past. Any ideas?

    Pixelmator or Gimp are both nice tools for advanced image processing and compositing. I.e. Gimp can do pretty much the same as Phtoshop. You might also have a look at digikam  http://www.digikam.org/drupal/download/binary
    Digikam is not just an advanced image processing and compositing program, it is also content management system like Aperture or iPhoto.
    I also find GraphicConverter a nice tool, but it is not free.
    If you want your image editing tools to integrate well with Aperture, I would look first at the available plug-ins, start with the plug-ins offered in the Aperture pull-down menu
    Aperture -> Aperture Plug-ins...

  • How to control a digital output signal using the DAQ assistant?

    I am using a USB 6251 DAQ board and would like to control a switch. I am gathering airflow, pressure, and acoustic data on the same board (analog input) and would like the switch to trigger when the airflow value is within a pre-determined range. Finally, I would like to reverse the polarity of the switch (to off) about a second after the initial digital signal, all of which is during continuous data acquisition.
    I am able to actuate the switch only when pressing the "run" button in the DAQ assistant window. I am proficient with data acquisition but have never tried programming an output... Please help!
    Thanks!
    -a troubled researcher
    P.S. I am running LabVIEW 8.5 as well.

    blsmith4,
    You probably won't get the control of the digital port on your card by only using the DAQ Assistant. One of the following examples should provide you the functionality that you would like out of the box:
    Digital - SW - Timed Output (Simple)
    Digital - Continuous Output (More Complex)
    Continuous Write Digital Port - External Clock - Non Regeneration (Most Complex)
    Let me know if these work better for you.
    Best,
    Jason M.
    Applications Engineer
    National Instruments

  • Can I use multiple PCI-MIO-16E-1 cards under NT 4.0 SR3, LV 5.1, & NI-DAQ 6.5.1?

    We have not been able to run multiple AT-MIO-16E-3 cards with NT 4.0, because (partly) the cards & NT are not PNP. Will changing to the PCI-MIO-16E-1 &/or PCI-6071E (64 channel version) allow us to simultaneously run multiple (same type) MIO cards on the same computer? We want to use one card to interface to SCXI, & it appears that the PCI version uses the same cables/connectors as the AT series.

    Hello;
    The PCI version of the e-series boards have pretty much the same features of the ISA version, the only difference is the bus.
    So, you should be able to use the same acessories as you use with the AT boards.
    Anyway, you can still try to install the AT boards with NT. The following link is a good step by step installation guide with some troubleshooting hints also. You just need to select the board and OS you are working at.
    http://www.ni.com/support/daq/
    Hope this helps.
    Filipe

  • MBP Late 2010, How can I install Win7 Boot Camp using External Optical Driv

    Hello:
    I have a new MBP purchased in February. It's not the 2011 model. I replaced the Optical drive with an SSD drive and put the optical drive in an external enclosure. The Optical drive works great, reads, writes, etc. My Windows 7, Pro 64bit DVD works also, tested on a PC.
    I use the Boot Camp assistant to create a partition. It them reboots and never starts up from the optical drive. I get an Apple logo alternating with a stop sign.
    I have got back to OS X by starting with the Option key and choosing my OS X volume.
    I tried booting to the DVD by using the option key, that did not work. I then choose the EFI option which allowed me to hit any key and appeared to boot from the external optical drive. Windows setup screen came up and I hit enter to start the file loading process. It eventually stopped when the progress bar was all the way across the screen. Then nothing.
    Questions {Please give definitive answers, not guesses, thanks :)}
    1) Is it possible to setup a boot camp Windows installation without an internal optical drive? Yes/No.
    2) If yes, how?
    3) I see the rEFIt utility has helped some but I read mixed reports. Will this help me boot and run Windows setup from an external optical drive? I don't want to install it if it's not known to be a certain fix.
    4) Is my only options to reinstall the optical drive?
    I chatted to OWC the vendor that sells the bracket. They had no idea how to install a Windows BC partition without an internal drive.
    I am seriously discouraged by what seems to be Apple wanting to control everything. I had a Mac Pro and Air book in my future but now, it's on hold.
    Thanks in advance,
    Kevin

    I tried what you are doing with a 2007 MBP, and could not get any Windows CD s to boot from an external optical drive, firewire or USB.
    I think this is fundamental to Windows which won't boot from an external USB drive either even on a Windows machine (although I believe there may be complex ways of achieving this). I don't think this is Apple trying to control the world.
    I ended up taking the MCE Optibay out and putting the original optical drive back in.
    Just possible that something has changed between a 2007 MBP and 2010 MBP, but I doubt it.
    If you want the second internal HD, you have two options:-
    1. Put the Apple optical back in, install Windows, then take out the optical and refit the SSD. The external optical will still be able to install windows apps and data etc, just not boot any windows install CDs or utilities (like Paragon rescue disks). You will not be able to do a Windows repair install without refitting the optical.
    2. Parallels, which has come a long way in the last two years. I am 99% certain that Parallels will install from an external optical.
    Message was edited by: Mike Boreham
    Message was edited by: Mike Boreham
    Message was edited by: Mike Boreham

  • How do I use HP Photosmart 8150 software with Windows 7?

    I recently bought a new PC that uses Windows 7.  When I purchased my HP Photosmart 8150 several years ago (and used Windows XP), it came with software that could be used for importing pictures, editing, cropping, printing different sizes, etc.  That software is not compatible with Windows 7.  Is there a patch or upgrade out there that I can download to get this up and running again?

    Your printer can be used with Windows 7 as the basic driver is included in the operating system. Some older printers are not compatible with Windows 7 at all.
    If you want a printer with software that has all the bells and whistles you will, unfortunately, have to upgrade to a newer model.    
    ****Please click on Accept As Solution if a suggestion solves your problem. It helps others facing the same problem to find a solution easily****
    2015 Microsoft MVP - Windows Experience Consumer

  • How can I see KSC5602 character set using JDBC thin driver

    After I change character set from USASCII7 to KO16KSC5601, I
    cannot see korean from the clients
    using JDBC thin driver.
    But, I can see korean clearly using sqlplus at serer, or
    application using SQLNet.
    I use Oracle Enterprise Server 8.0.4.1.0, jdbc thin driver
    8.0.4.0.6 on Windows 98. I read that all bugs realated
    to multibyte language are fixed in Oracle8. What can I do to
    solve this problem?
    PS.server: Oracle 8.0.4.1 on Digital Unix 4.0b, client: jdk1.1.8
    on Windows98. I used the command.
    null

    The easiest thing to do is download it as an archive with your applet.
    Otherwise, you have to have the files on every client machine.
    For netscape, put the classes111.jar in the java classes folder typically:
    c:\ProgramFiles\Netscape\Communicator\Program\java\classes.
    I'd expect that IE would be setup in a similar way.

Maybe you are looking for