How do I read voltage on multiple channels using the 6255\SCB-6​8

Hi All
I was able to get the following code to compile, run and view the voltage data as expected. when reading the voltage (RSE) on Dev0/ai65
...National Instruments\NI-DAQ\Examples\DAQmx ANSI C\Analog In\Measure Voltage\Cont Acq-Int Clk\ContAcq-IntClk.c
* I think that I am using RSE but I have no clue since I do not see an argument to specify
I am trying to read two different data points:
1. View the voltage (RSE) on Dev0/ai65
2. View the voltage difference (Differential) between Dev0/ai17 and Dev0/ai25
Can someone point me to an example (or web link) where two different data points are being read.
*edit - I am trying to complete this task using C++
Thanks
Chad
Solved!
Go to Solution.

This was my last attempt that failed
#include <stdio.h>
#include <NIDAQmx.h>
#include <iostream>
using namespace std;
#define DAQmxErrChk(functionCall) if( DAQmxFailed(error=(functionCall)) ) goto Error; else
int32 CVICALLBACK EveryNCallback(TaskHandle taskHandle1, int32 everyNsamplesEventType, uInt32 nSamples, void *callbackData);
int32 CVICALLBACK EveryNCallback(TaskHandle taskHandle2, int32 everyNsamplesEventType, uInt32 nSamples, void *callbackData);
int32 CVICALLBACK DoneCallback(TaskHandle taskHandle1, int32 status, void *callbackData);
int32 CVICALLBACK DoneCallback(TaskHandle taskHandle2, int32 status, void *callbackData);
int main(void)
 cout << "\t***********************************************​****\n";
 cout << "\t         Starting the NI DAQmx data logger\n";
 cout << "\t***********************************************​****\n\n";
 int32       error = 0;
 TaskHandle  taskHandle1 = 0;
 TaskHandle  taskHandle2 = 0;
 char        errBuff[2048] = { '\0' };
 // DAQmx Configure Code
 DAQmxErrChk(DAQmxCreateTask("task1", &taskHandle1));
 DAQmxErrChk(DAQmxCreateTask("task2", &taskHandle2));
 DAQmxErrChk(DAQmxCreateAIVoltageChan(taskHandle1, "Dev1/ai65", "", DAQmx_Val_Cfg_Default, -10.0, 10.0, DAQmx_Val_Volts, NULL));
 DAQmxErrChk(DAQmxCreateAIVoltageChan(taskHandle2, "Dev1/ai17", "", DAQmx_Val_Cfg_Default, -10.0, 10.0, DAQmx_Val_Volts, NULL));
 DAQmxErrChk(DAQmxCfgSampClkTiming(taskHandle1, "", 10000.0, DAQmx_Val_Rising, DAQmx_Val_ContSamps, 1000));
 DAQmxErrChk(DAQmxCfgSampClkTiming(taskHandle2, "", 10000.0, DAQmx_Val_Rising, DAQmx_Val_ContSamps, 1000));
 DAQmxErrChk(DAQmxRegisterEveryNSamplesEvent(taskH​andle1, DAQmx_Val_Acquired_Into_Buffer, 1000, 0, EveryNCallback, NULL));
 DAQmxErrChk(DAQmxRegisterEveryNSamplesEvent(taskH​andle2, DAQmx_Val_Acquired_Into_Buffer, 1000, 0, EveryNCallback, NULL));
 DAQmxErrChk(DAQmxRegisterDoneEvent(taskHandle1, 0, DoneCallback, NULL));
 DAQmxErrChk(DAQmxRegisterDoneEvent(taskHandle2, 0, DoneCallback, NULL));
 // DAQmx Start Code
 DAQmxErrChk(DAQmxStartTask(taskHandle1));
 DAQmxErrChk(DAQmxStartTask(taskHandle2));
 printf("Acquiring samples continuously. Press Enter to interrupt\n");
 getchar();
Error:
 if (DAQmxFailed(error))
  DAQmxGetExtendedErrorInfo(errBuff, 2048);
 if (taskHandle1 != 0) {
  // DAQmx Stop Code
  DAQmxStopTask(taskHandle1);
  DAQmxStopTask(taskHandle2);
  DAQmxClearTask(taskHandle1);
  DAQmxClearTask(taskHandle2);
 if (taskHandle2 != 0) {
  // DAQmx Stop Code
  DAQmxStopTask(taskHandle1);
  DAQmxStopTask(taskHandle2);
  DAQmxClearTask(taskHandle1);
  DAQmxClearTask(taskHandle2);
 if (DAQmxFailed(error))
  printf("DAQmx Error: %s\n", errBuff);
 printf("End of program, press Enter key to quit\n");
 getchar();
return 0;
int32 CVICALLBACK EveryNCallback(TaskHandle taskHandle, int32 everyNsamplesEventType, uInt32 nSamples, void *callbackData)
 //cout << "\nStarting EveryNCallback" << "\n";
 //cout << "line 59" << "\n";
 TaskHandle  taskHandle1 = 0;
 TaskHandle  taskHandle2 = 0;
 int32       error = 0;
 char        errBuff[2048] = { '\0' };
 static int  totalRead1 = 0;
 static int  totalRead2 = 0;
 int32       read1 = 0;
 int32       read2 = 0;
 float64     data1[1000];
 float64     data2[1000];
 // DAQmx Read Code
 cout << "Start DAQmx Read Code Loop \n";
 DAQmxErrChk(DAQmxReadAnalogF64(taskHandle1, 1000, 10.0, DAQmx_Val_GroupByChannel, data1, 1000, &read1, NULL));
 DAQmxErrChk(DAQmxReadAnalogF64(taskHandle2, 1000, 10.0, DAQmx_Val_GroupByChannel, data2, 1000, &read2, NULL));
// for (int i = 0; i <= 10; i++)
//  cout << data[i] << "\n";
 //cout << "Here is data = " << data << "\n";
 //cout << "Here is data[2] = " << data[2] << "\n"; // write the data to a file
 if (read1>0) {
  cout << "Acquired " << read1 << " samples \n";
  totalRead1 += read1;
  cout << "Acquired " << totalRead1 << " Total samples \r\n\n";
  cout << data1 << "," << data2 << "\n";
  fflush(stdout);
 // cout << "the next line is stdout \n";
 // cout << stdout << "\n";
Error:
 if (DAQmxFailed(error)) {
  DAQmxGetExtendedErrorInfo(errBuff, 2048);
  // DAQmx Stop Code
  DAQmxStopTask(taskHandle1);
  DAQmxStopTask(taskHandle2);
  DAQmxClearTask(taskHandle1);
  DAQmxClearTask(taskHandle2);
  printf("DAQmx Error: %s\n", errBuff);
 return 0;
int32 CVICALLBACK DoneCallback(TaskHandle taskHandle, int32 status, void *callbackData)
 cout << "\nStarting DoneCallback" << "\n";
 cout << "line 99" << "\n";
 int32   error = 0;
 char    errBuff[2048] = { '\0' };
 // Check to see if an error stopped the task.
 DAQmxErrChk(status);
Error:
 if (DAQmxFailed(error))
  TaskHandle  taskHandle1 = 0;
  TaskHandle  taskHandle2 = 0;
  cout << "line 109" << "\n";
  DAQmxGetExtendedErrorInfo(errBuff, 2048);
  DAQmxClearTask(taskHandle1);
  DAQmxClearTask(taskHandle2);
  printf("DAQmx Error: %s\n", errBuff);
 return 0;

Similar Messages

  • How would I go about adding multiple rectangles using the same lines of code?

    How would I go about adding multiple rectangles using the same lines of code? I would prefer to just run through a set of code every time I need a polygon. If I just have to create multiple polygon adding statements that's fine but I'd prefer just 1.

    >>How would I go about adding multiple rectangles using the same lines of code?
    You could create a method that creates and returns x number of Rectangle elements:
    public IEnumerable<Rectangle> CreateRectangles(int numberOfRectsToCreate)
    for (int i = 0; i < numberOfRectsToCreate; ++i)
    Rectangle rect = new Rectangle();
    rect.Fill = Brushes.Blue;
    rect.Width = 100;
    rect.Height = 100;
    yield return rect;
    ..and then call this method from anywhere in your code:
    IEnumerable<Rectangle> rects = CreateRectangles(5);
    foreach (Rectangle rect in rects)
    //add to StackPanel or do whatever with the Rectangle elements:
    yourStackPanel.Children.Add(rect);
    >>If I just have to create multiple polygon adding statements that's fine but I'd prefer just 1.
    When adding Point objects to a Polygon you can only add one per call to the Add method but you could call the Add method inside a loop, e.g:
    for(int i = 0; i < 10; ++i)
    //add to StackPanel or do whatever with the Rectangle elements:
    Polygon p = new Polygon();
    p.Points.Add(new Point());
    Please remember to close your threads by marking helpful posts as answer and then start a new thread if you have a new question. Please don't post several questions in the same thread.

  • How can i read more then one channel with the amux64

    Im using AI one scan.
    I tryed the string AM1 ! 0,1 and also AM1 !0:1 but it didnt worked.

    Barak,
    Check the following link, it must solve your issue:
    http://digital.ni.com/public.nsf/3efedde4322fef198​62567740067f3cc/ef832cdaf87e9bf8862568a5007b2f47?O​penDocument
    Hope this information is helpful
    L Aguila
    Applications Engineer
    National Instruments

  • How can I download eBooks to multiple iPads using same apple ID?

    How can I download eBooks to multiple iPads using the same apple ID?

    Those are called iBooks. On the devices go to iTunes app and then to the Purchased section in bottom row and find the media and tap install

  • How do you take off reseiving messages on multiple devices using the same apple account

    How do you take off reseiving messages on multiple devices using the same apple account?

    Go to Settings>Messages>Send and Receive on all but one device and add a unique email address on each device and delete the commone Apple ID email device
    If there is also an iPhone with iOS 6 associated with the Apple ID, uncheck the phone number on all but the phone.

  • How can I get rid of multiple pictures at the same time?

    how can I get rid of multiple pictures at the same time?

    Adobe Bridge, lightroom and your file browser (windows explorer or Mac Finder) can select multiple pictures at once and then delete. If you are looking for more than that for information, you will need to be more specific at what your doing, what OS you have, and version of software your using. If necessary post screen shots so we can see what your doing. The more information we have the more detailed of an explaination can can give back to you.

  • How can I convert .pdf file to .doc using the free adobe reader app? when I try to convert the .pdf file it asks me to sign in. when I click on "sign in", I am taken to a service subscription page. So, no free conversions using free adobe reader app?

    how can I convert .pdf file to .doc using the free adobe reader app? when I try to convert the .pdf file it asks me to sign in. when I click on "sign in", I am taken to a service subscription page. So, no free conversions using free adobe reader app?

    As has been mentioned Adobe Reader cannot export PDF page content. Nor can it create PDF or manipulate PDF page content.
    What you can do is use one of Adobe's online subscription services. Two provide for PDF  to Word export.
    There's ExportPDF and PDF Pack.
    Be well...

  • How Do i add an inverted left channel to the right channel?

    How Do i add an inverted left channel to the right channel?

    http://www.thehangtime.com/gb/gbfaq2.html#audioeditors

  • How do I read inches instead of pixels, in the develop module

    How do I read inches instead of pixels, in the develop module. I am not discussing resolution. When I crop, I need to see the numbers in inches, not pixels.
    I am not exporting to anything. From the develop module I go on to the print module. However I want to see inches, not pixels, in the develop module.
    I am not cropping to an aspect ratio. I am cropping to a given size, in inches, just as if I was in PS CS 3.
    LR 2.0
    Mac OS 10.4.11, G5, dual 2.3; MBP OS 10.5.4,; Epson Pro9600 c ultrachrome matte black.
    Thanks in advance.
    Nancy

    >Instead of the image in pixels, why can't I read it in inches? Physical size in pixels is staring at me, why can't inches be there instead?
    Because it is not there. The size in inches ONLY becomes real at print or at export time and can and will change depending on what you do there. Before that you are looking at a number of pixels in a computer.
    >I need to set these values in the develop module, just as if I was setting them in PS CS 3.
    That does not make any sense. There is no need to set this in develop at all. Lightroom will scale to your final size at export/Print/web/slideshow. Not in develop. There you are working with the RAW data at its native size.

  • How do i share music with 2 iphones using the same apple id?

    how do i share music with 2 iphones using the same apple id?

    Sync them both to the same iTunes music library.  You can also automatically download purchased music to both by going to Settings>iTunes & App Stores and turning Music to On under Automatic Downloads.  If you music is in multiple computers, you can enable Home sharing to share your music library across multiple devices (see http://support.apple.com/kb/HT3819).

  • How do I enlarge my web page to use the whole screen?

    How do I enlarge my web page to use the whole computer screen?

    Reduce dock size or hide same.
    Also depends on what browser you're using  all have full screen modes.
    Safari :
    http://support.apple.com/kb/PH11941
    To enlarge an entire webpage so it uses the screen, click the arrows in the top-right corner of an app window:

  • HT204053 Can multiple people use the same Apple ID for their own devices?

    Can multiple people use the same Apple ID for their own devices? I just set up my IPhone 4S (first time user) using the same Apple ID as my daughters and now we receive each others texts, do I need to set up my own Apple ID account?

    Yes, you can.  In fact it's recommended that you use different IDs for iMessage, FaceTime and iCloud.  You can still share the same ID for iTunes without any issues.
    You are getting each other's text messages because you're using the same ID for iMessage.  To fix this, one of you should go to Settings>Messages>Send & Receive, tap the ID, sign out, then sign in with a different ID.  To avoid getting each other's FaceTime calls, do the same thing in Settings>FaceTime.

  • I lost my Iphone 3GS. My brother has given me his Iphone 4 now. We both use the same notebook to update and sync our phones. I would like to know how can i reconnect back to my account using the Iphone which was previous used by my brother.

    I lost my Iphone 3GS. My brother has given me his Iphone 4 now. We both use the same notebook to update and sync our phones. I would like to know how can i reconnect back to my account using the Iphone which was previous used by my brother.

    If you are saying that you both have iCloud accounts and use the same icloud ID, then yes, the contacts will be deleted.  The idea is that all devices using the same icloud ID are kept in sync.  You need to use different IDs.  You can keep the same iTunes ID so you can share the songs and apps.  But use different icloud IDs.

  • How Can You Track Your Ipod If Lost Using The Serial Number

    How Can You Track Your Ipod If Lost Using The Serial Number?

    The find my iphone app has nothong to do with it.
    That app simply allow you to find other devices using your ipod.  It has nothing to do with fining the device on which it is installed.
    If you set up the find my ipod feature that is built into your ipod and the ipod is on and it is connected to wi-fi and it has not been restored, then you may be able to get an approximate street address using icloud.
    Othrewise, it cannot be tracked.

  • I have changed my Apple ID on my iPad, but my iPhone keeps popping up with the old ID.....how do I get all my devices to use the same ID?

    How can I get all my devices to use the same Apple ID?

    Different services on your iOS device (iMessage, Facetime, iCloud, iTunes and App Store) can be signed into with an Apple ID of your choice. Make sure you verify the settings for each device and that you are signed in to each service with the correct Apple ID.
    I'll do an example for iMessage:
    1) Go to settings on your iOS device
    2) Select "Messages"
    3) Select "Send & Receive"
    4) At the very top you will see "Apple ID", by selecting your Apple ID, you will now have the option to sign out of messages with the current Apple ID, and sign in with the new one.
    The steps for changing your Apple ID for other services will be very similar.
    tHIS SHOULD BE VERY HELPFUL TOO YOU.

Maybe you are looking for

  • Time Machine not freeing up space with manual delete of old backups

    I have time machine backing up an external RAID to a Drobo with 7.2TB of total space.  The total backup size as estimated by TM is 4.6TB.  This setup was running fine for me for a while, until I added some internal drives full of data to my Mac Pro,

  • Unable to start the plain J2SE Adapter Engine

    Hi All,       Eariler i was able to start the Adapter Engine. But i dont know what went wrong, i am not able to start the adapter engine.Is there any way to find out what went wrong? Regards Sathya Message was edited by: Sathya Priya

  • How to insert records into the Table?

    Dear Sir, I'm new to JDeveloper. Now I managed to create a Frame in JDeveloper with many Text fields and a button. In the back end, I have a procedure to insert records to a table, to which I pass the values of the fields as parameters. Now I'm not g

  • J2ee -verbose error

    Hi, I have download the j2se and j2ee versions for petstore and created the required env variables. When the start the Cloudscape, it is fine. But when I executed J2EE - Verbose from the cmd prompt, I get the following error and the execution stops.

  • Since i installed iCloud my excel documents don't allow me to type in them and they don't show the cells anymore! help!

    Help! since I recently installed icloud on my mac pc,now my excell docements are not able to be type into and no cells show up! I need my excell documentback to the way it was so I can finish working on a spreadsheet! help!