Trigger with NOR-DAQmx in Ansi C/C++ and OR USB-6210

Hello

We need to read an analog signal each time a trigger signal it is does not know how to get the trigger to work. Here is the code that we have found so far:

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

...
DAQmxErrChk (DAQmxCreateAIVoltageChan (analogInputTaskHandle, "Dev1/ai0", "AI0', DAQmx_Val_Diff,-10, 10, DAQmx_Val_Volts, NULL));

Int32 numSampsPerChan = 20;
uInt64 sampsPerChan = numSampsPerChan;
float64 timeout = 0; Time in seconds to wait for the function read String-> 0 try to read only once; -1 wait infinitely;
bool32 fillMode = DAQmx_Val_GroupByChannel; Reading non-interlaced channel
const uInt32 arraySizeInSamples = 20; Number of samples that are read
float64 analogValuesFromDevice [arraySizeInSamples];
sampsPerChanRead of Int32;
bool32 * reserved = NULL;

char startTrigger [256] = ' / PFI0/Dev1;
int startEdge = DAQmx_Val_Rising; rising edge

DAQmxErrChk (DAQmxCfgSampClkTiming (analogInputTaskHandle, "", 10000.0, DAQmx_Val_Rising, DAQmx_Val_FiniteSamps, 10));

DAQmxErrChk (DAQmxCfgDigEdgeStartTrig (analogInputTaskHandle, startTrigger, startEdge));

DAQmxErrChk (DAQmxStartTask (analogInputTaskHandle));

DAQmxErrChk (DAQmxReadAnalogF64 (analogInputTaskHandle, numSampsPerChan, timeout, fillMode, analogValuesFromDevice, arraySizeInSamples, & sampsPerChanRead, reserved));

DAQmxErrChk (DAQmxStopTask (analogInputTaskHandle));

Frees the memory of the task
DAQmxErrChk (DAQmxClearTask (analogInputTaskHandle));

...

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

This is the error message we receive.

DAQmx error: relation to the outbreak of the reference or the beginning reading
position of pre-trigger samples before the acquisition is completed.

Wait until the acquisition is complete before reading or increase your reading timeo
UT. Additionally, make sure that the equipment is set up and wired correctly, the signal for
the reference trigger is correct, and that the reference trigger occurs during th
e device is data acquisition.
Property: DAQmx_Read_RelativeTo
Value: DAQmx_Val_FirstPretrigSamp

Task name: ReadAnalogInput

State code:-200281

Can you tell us how to expect the acquisition supplement or increase our reading timeout? We think these are the problems we face.

Thanks for all your help.

Update:

We use is no longer a trigger, so it's resolved.

We believe that we receive at the origin of the mistake because we weren't using a TTL signal.

Tags: NI Hardware

Similar Questions

  • Clock and hw external trigger with USB-6210 on Linux with NOR-DAQmx Base?

    I have two devices USB-6210 I need to synchronize so that they both collect data exactly at the same time. I was told by support OR I can send the clock off Dev1/PFI4 and have the two USB-6210 s read the clock in through their own PFI0. I also want to trigger data collected for each device by sending a trigger off Dev1/PFI6 and have two devices to receive the signal on PFI2.

    All my attempts to try this are filled with error messages and my research online seem to say that's not possible with USB devices on NOR-DAQmx Base 3.4.0f2 on Linux.

    I "ve tried using example AI programs and those who do not seem to work either for external clocks. Here is the code I tried:

    #include "NIDAQmxBase.h"#include 
    
    #define DAQmxErrChk(functionCall) { if( DAQmxFailed(error=(functionCall)) ) { goto Error; } }
    
    int main(void){    // Task parameters    int32       error = 0;    TaskHandle  taskHandle = 0;    char        errBuff[2048]={'\0'};    int32       i;
    
        // Channel parameters    char        chan[] = "Dev1/ai0";    float64     min = -10.0;    float64     max = 10.0;
    
        // Timing parameters    char        clockSource[] = "/Dev1/PFI7";    uInt64      samplesPerChan = 1000;    float64     sampleRate = 10000.0;
    
        // Data read parameters    #define     bufferSize (uInt32)1000    float64     data[bufferSize];    int32       pointsToRead = bufferSize;    int32       pointsRead;    float64     timeout = 10.0;
    
    printf("Calling CreateTask...\n");    DAQmxErrChk (DAQmxBaseCreateTask("",&taskHandle));printf("Calling CreateAIVoltageChan...\n");    DAQmxErrChk (DAQmxBaseCreateAIVoltageChan(taskHandle,chan,"",DAQmx_Val_Cfg_Default,min,max,DAQmx_Val_Volts,NULL));printf("Calling CfgSampleClkTiming...\n");    DAQmxErrChk (DAQmxBaseCfgSampClkTiming(taskHandle,clockSource,sampleRate,DAQmx_Val_Rising,DAQmx_Val_FiniteSamps,samplesPerChan));printf("Calling StartTask...\n");    DAQmxErrChk (DAQmxBaseStartTask(taskHandle));printf("Calling ReadAnalogF64\n");    DAQmxErrChk (DAQmxBaseReadAnalogF64(taskHandle,pointsToRead,timeout,DAQmx_Val_GroupByChannel,data,bufferSize,&pointsRead,NULL));
    
        printf ("Acquired %d samples\n", pointsRead);
    
        // Just print out the first 10 points    for (i = 0; i < 10; ++i)        printf ("data[%d] = %f\n", i, data[i]);
    
    Error:    if( DAQmxFailed(error) )        DAQmxBaseGetExtendedErrorInfo(errBuff,2048);    if(taskHandle != 0) {        DAQmxBaseStopTask (taskHandle);        DAQmxBaseClearTask (taskHandle);    }    if( DAQmxFailed(error) )       printf ("DAQmxBase Error %d: %s\n", error, errBuff);    return 0;}
    

    When I run the resulting program, I see this:

    $. / acquireNScans-ExtClk
    The CreateTask call...
    Call for CreateAIVoltageChan...
    Call for CfgSampleClkTiming...
    Error-89136 DAQmxBase: route specified cannot be satisfied, because the hardware does not support it.

    For example, a clock and a trigger can be imported via one of the PFI lines by using a USB-6210 on Linux with NOR-DAQmx Base? A clock and a trigger exportable via one of the PFI lines?

    If so, does anyone have the code example illustrating how to do this, or can you at least tell me the names of the lines ("PFI0/Dev1" or other) so I can try again?

    Clues or suggestions would be helpful.

    Thank you

    -Tom

    The clockSource in the example specifies an output rather than an input channel channel. Change source "/ Dev1 / PFI0" solved the problem.

    Please close this post.

  • How to calibrate the PCI-6110 with NOR-DAQmx

    Hello

    I am a new user of the PCI-6110 Council tries to run the calibration using LabVIEW procedure. I look at the document "Calibration" on the page of the manuals for the Board of Directors,

    http://sine.NI.com/NIPs/nisearchservlet?nistype=psrelcon&NID=11888&lang=us&q=FQL: 28locale % 3Aen % 29 + AND + % 28phwebnt % 3 A 1081 + OR + phwebnt % 3 A 7075% 29 + AND + 28nicontenttype % 3Aproductmanual % 29 + AND + % 28docstatus % 3Acurrent % 29% 20RANK % 20nilangs: en & title = NOR + PCI-6110 + manual

    One of the first steps in the document is to call the AI_Configure command to set the input mode, beach, etc. I'm using LabVIEW 8.5 with the NOR-DAQmx software, and I can not find the command (which, in LabVIEW, seems to be "AI Config.vi") anywhere. The calibration paper was written in 2003, and I gather from Google searches (please, correct me if wrong) that this command is actually a part of NOR-DAQ traditional, who was replaced by driver OR DAQmx.

    My question is this: what is the equivalent to AI_Configure command in the latest software? Is it perhaps a subsequent document describing how to calibrate using NOR-DAQmx?

    Thanks much for any help.

    Tom McLaughlin

    Hi Tom,

    The calibration Procedure series B, E, M, S, which is also linked from this page, describes how to calibrate the PCI-6110 with NOR-DAQmx.

    Brad

  • Maximum latency to read/write for PCI-DIO-32HS with NOR-DAQmx?

    I was asked to evaluate using the PCI-DIO-32HS and NOR-DAQmx on MacOS X to essentially close a control loop.  My first concern is whether or not it can run fast enough.

    So my questions are: what is the maximum latency from the moment of receiving a signal strobe reading data from external hardware, then read a single 16-bit sample and sending it upward by NOR-DAQ to a user space application?  And, similarly, what is the maximum latency of sending a unique 16-bit value from a space application user down through NOR-DAQ, then write a port and affirming a strobe signal of external-data writing material?

    Thank you.

    Hi AliasMe,

    Thanks for posting and welcome to the Forums EITHER!

    Do you need to process the data in the software and generate a value on this basis?  DIO-32HS (alias PCI-6533) offers in the buffer of inputs and outputs, but you'd have a latency in your control system relying on the OS to do treatment.  Since this period is dependent on the system, I can't give a specification for the amount of time it would take.  However, integrating data in memory, processing and writing back to the card would likely be on the order of several milliseconds.

    Generally, we recommend FPGA in situations of control like this, so you can do all the processing in hardware.  However, if provide you more details on your request we can look into all the options available.

    -John

  • Problem with NOR-DAQmx Base on Scientific Linux 3.4

    Hello everyone.

    I'm trying to install the driver OR-DAQmx Base 3.4 on Scientific Linux 6.0, but I got these errors:

    On this text said that Scientific Linux 5.4 and 5.5 is supported.

    Can anyone help me or 6.0 is not supported?

    Hello decadence,

    Thank you for posting.  Your post, it seems that the problem occurred while trying to install NI VISA 5.0.  Unfortunately, the only versions of Linux that are officially supported by our pilots and implemented to date are those listed in the Readme of each product.  In the Readme for NEITHER VISA 5.0, Scientific Linux versions 5.x are supported, but Scientific Linux 6.0 is not in this list, nor in the Readme for DAQmx Base 3.4.  I hope this helps.

    Kind regards

    Joe S.

  • Why using the driver NOR-DAQmx ANSI C functions in a thread causes a deadlock?

    Firstly, apologies if this is bad advice, but it seemed the closest fit.

    I use MSVC 2008 Express with the library in ANSI C NI DAQmx for some analog output with a box USB-6009. I create a thread to handle the signal generation is based on fixed time. My main thread running the user interface. I found that I get intermittent blockages in release, so that libraries mode NOR are responsible (in the second thread) and I use MSVCRT features (on the main thread). My test code is attached as "deadlock2.cpp".

    I used WinDbg to try to find the cause of the deadlock. Traces of the battery of my two sons are attached as t1_stack.txt and t2_stack.txt.

    It seems that the MSVCRT localtime() function uses a lock when it is called for the first time and then went to lock the Windows DLL loader lock. At the same time libraries NOR (or less libraries mxs) are responsible for locking the charger DLL is being held. The mxsutils library uses getcwd() which seems to try to block something the MSVCRT and therefore my two sons are now deadlocked.

    I can probably work around this by calling the localtime() and the NOR-DAQmx functions before I spawn my second thread so that the DLLs are already loaded in the process. However, I have no guarantee of this to continue working if something changes in the future, and if there are any locks going on finally having the DllMain() calls for a thread hanging may still cause a deadlock. If my results are correct, is it likely that NEITHER would fix the dll for not trying to make something complex in their DllMain()?

    According to NI Measurement and Automation Explorer, I'm under DAQmx libraries v9.3.5f2. I download the latest version now to try, but it will take time.

    Hi dmcminn,

    Thank you for the comprehensive and detailed bug report. I was able to reproduce the problem with NOR-DAQmx 9.6 using the code you posted. I reported it to the R & D team suitable as CAR #366538.

    I agree with your analysis of the problem. Getcwd() so the first call to __tzset() acquired _ENV_LOCK, which Microsoft has documented as the "lock for environment variables. __tzset() also called GetTimeZoneInformation(), which can load additional libraries, that you have demonstrated.

    Here are a couple more possible solutions, but they are not great:

    • Link to the static version of the CRT (/ MT instead of /MD). This would bind a separate copy of the lock of the CRT table in your program, and DAQmx would continue to use the lock to MSVCR90.dll table. They use more of the same _ENV_LOCK.
    • Build using a different version of Microsoft Visual C++ (for example 2005 or 2010). MSVCR80.dll MSVCR90.dll and MSVCR100.dll own separate copies of the lock of the CRT table.

    Whatever it is, it does not eliminate the fact that mxsutils called the CRT while now the loader lock, and this function CRT acquires another lock.

    Furthermore, the forum Multifunction DAQ is a better place to ask questions DAQmx.

    Brad

  • connect labveiw 8.2 with nor pci-6251

    I have no pci-6251 and its cd driver with labview 8. How can I connect the daq with labview 8.2 and run programs

    Hello

    I can't download the driver of NOR-DAQmx 8.7.1, connect labview 8.2 with NOR-DAQmx PCI-6251...

    Why?

    Please answer...

  • NOR-DAQmx 8.0.1 undefined reference

    Hello

    I'm new with NOR-DAQmx on Linux. After reading the posts in this forum, I was able to successfully install OR-DAQmx 8.0.1 on OpenSUSE 11.0. When you run "nilsdev", I get the following list of features:

    OR PXI-6255: "Dev4.
    OR PXI-6733: "Dev3.
    OR PXI-6733: "Dev2.
    OR PXI-6713: "Dev1".

    What is correct. However, when you try to compile the following program example, using "gcc main.c:

    #include "NIDAQmx.h".
    #include
    #define DAQmxErrChk (functionCall) if (DAQmxFailed (error = (functionCall))) goto error; on the other
    int main (void) {}
    error int = 0;
    TaskHandle taskHandle = 0;
    char errBuff [2048] = {'\0'};
    float64 data [3] = {1.0,2.0,3.0};
    /*********************************************/
    DAQmx Configure Code
    /*********************************************/
    DAQmxErrChk (DAQmxCreateTask("",&taskHandle));
    DAQmxErrChk (DAQmxCreateAOVoltageChan(taskHandle,"PXI1Slot4/ao0:2","",-10.0,10.0,DAQmx_Val_Volts,""));)
    /*********************************************/
    Starting code DAQmx
    /*********************************************/
    DAQmxErrChk (DAQmxStartTask (taskHandle));
    /*********************************************/
    DAQmx write code
    /*********************************************/
    DAQmxErrChk (DAQmxWriteAnalogF64(taskHandle,1,1,10.0,DAQmx_Val_GroupByScanNumber,data,,));
    Error:
    If (DAQmxFailed (error))
    DAQmxGetExtendedErrorInfo (errBuff, 2048);
    If (taskHandle! = 0) {}
    /*********************************************/
    Stop DAQmx code
    /*********************************************/
    DAQmxStopTask (taskHandle);
    DAQmxClearTask (taskHandle);
    }
    If (DAQmxFailed (error))
    printf ("Error");
    GetChar ();
    return 0;
    }

    I get several errors about undefined references:

    main.c.text + 0 x 90): refers to 'DAQmxCreateTask' the undefined
    main.c.text + 0xdc): refers to 'DAQmxCreateAOVoltageChan' the undefined
    main.c.text + 0xf0): refers to 'DAQmxStartTask' the undefined
    main.c.text + 0 x 140): refers to 'DAQmxWriteAnalogF64' the undefined
    main.c.text + 0x15f): refers to 'DAQmxGetExtendedErrorInfo' the undefined
    main.c.text + 0 x 171): refers to 'DAQmxStopTask' the undefined
    main.c.text + 0x17c): refers to 'DAQmxClearTask' the undefined

    I have already installed OR DAQmx on a Windows XP computer and got the same errors, but could (using this post) to create the libraries needed to link against. However, I have found no information similar to that in Linux (this message seemed to understand this problem, but unfortunately, the author does not share its solution). So far, I tried various options of connection with no success '-ldl ' etc. Obviously, I'm not bind properly.

    Any help would be greatly appreciated.

    Thank you

    Grine

    I solved step connects. (Why answers always come when you almost gave up? )

    As I suspected, a liaison simple number. Compilation with 'gcc /usr/local/lib/libnidaqmx.so o main main.c', did the trick.

    I have still some errors during execution of the program, but I can probably solve these on my own.

  • NOR-DAQmx 8.9 and 9.0.2 simultaneous install?

    I have the 2009 and 7.1 on the same machine.  When I install DAQmx 9.0.2 for 2009, all my vi acquisition for 7.1 (installed with NOR-DAQmx 8.9) will miss.  Is there a way for 7.1, 2009 and DAQmx 8.9 and 9.0.2 all to coexist on a machine?  Currently, I have to uninstall and install the drivers of acquisition whenever I pass versions of LV.

    Thank you

    Greg

    Hi, there is one thing to do before installing DAQmx, save LV7 directory after install ofDAQmx copy the save and everything works fine. (express alone will not work).

    Concerning

  • Setup of NOR-DAQmx 8.8 Error 1303

    I recently bought NI USB-6211, who works with the software NOR-DAQmx 8.8.

    I have LabView 7.1 installed in my PC which remains compatible with NOR-DAQmx 8.8.

    Every time when I try to install the driver OR-DAQmx 8.8, you receive the following error message,

    However, the account with the fact that I logged in has administrator privileges. But it said "access denied" when I tried to access the folder

    mentioned in the error message. Please help me solve this problem.

    Hi, boiler.

    Some possible solutions to this problem are:

    • Check again once you are logged in as administrator
    • Disable file sharing for the folder of the installation directory, and then add you as an administrator. To do this, right-click on the folder and select sharing and security, then tab share , select do not share this folder. Now, select the Security tab and check that all permissions for administrators check boxes are selected.
    • Unplug your computer from any network (x).
    • Disable any antivirus software.
    • Disable any firewall.
    • Close all active programs.

    This information can be found in this knowledge base article.

    Let me know if you need help most.  I hope that you are having a great day!

  • Compatibility DAQmx and NOT USB-8451

    NEITHER USB-8451 is compatible with NOR-DAQmx?

    The USB-8451 housing does not NOR-DAQmx; It uses a separate driver and API (OR-845 x; ( the latest version is 2.0).

    It is compatible in the sense that you might have OR-DAQmx and NOR-845 x installed at the same time, because they are two independent pieces of software. It is not compatible in the sense that you cannot use the USB-8451 with the API OR-DAQmx case.

  • Runtime error example NOR-DAQmx ANSI C in the Windows 7 virtual machine

    I am under a guest Windows 7 system with a host of Ubuntu 14, using VirtualBox and have encountered a problem running even the simplest examples provided by National Instruments, using the ANSI C API for NOR-DAQmx.

    The first time that the DAQ hardware is turned on, I can run a single measure, and after that, any other indicator displays the following error message:

    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: 0

    Task Name: _unamedTask(0)
    Status Code: -200279

    In order to start a new measurement, I have to restart the DAQ hardware, probably in order to clear the internal buffers that are in the process of substitution.

    I am interested in a measure of continuous tension in basic by using a callback function. (The example of ContAcq_IntClk provided by OR)

    The exactly the same setup, same version of NOR-DAQmx (9.7.5) and running on Visual Studio 2012 smoothly on a computer that is running Windows 7 directly.

    I suspect that the problem is with the internal buffer being somehow messed up because of the connection with the Virtual Machine, but do not find an elegant solution to fix it.

    The camera I use is NI USB-6289.

    Hello fromm8

    Thank you very much for your help, I managed to locate the problem.

    He was not the actual code, or something like that, it was a problem of communication between the VirtualBox machine and the physical device.

    Kept launches MAX test panels a comparable as error the program C.

    I fixed the problem by opting for VMWare, which seems to have the best compatibility with USB devices.

    See you soon!

  • NOR-DAQmx compatibility with the system in real time

    I try to use a time system 11 with LabVIEW Real-time. When I try to connect with the driver OR DAQmx, an error saying that the version of the NOR-DAQmx drivers are bundles with the one on the real time. I tried to use different versions of the NOR-DAQmx drivers that are available in the table of compatibility, but not those who worked. I have an old computer working with the same real-time system that uses LabVIEW 9 and has the driver NOR-DAQmx 9.3.5 f0 driver installed on it but I can't find the drivers on the web. What should I do?

    I am using LabVIEW 2015 in my current computer.

    Thanks in advance.

    Looks like you can just have a lag in the versions of software installed on your host computer and the target.  In order to deploy the code from your host to your target, the two must have corresponding to libraries of functions.  See this link for instructions on updated versions of the software on your target match those installed on your host computer, the wizard of the LabVIEW RT software.  If you have already done this, and it did not help, please provide a screenshot or error code of the message that is to appear.

  • Data acquisition tool NOR-DAQmx with Matlab R2012a

    Hello

    I'm trying to control NI USB-6211 of Matlab 2012 using NOR-DAQmx Data Acquisition tool:

    http://zone.NI.com/DevZone/CDA/tut/p/ID/3005

    I'm working on win7 64 bit. And I see the device AND Measurement & Automation Explorer.

    The tool does not work: DAQ_Demo_Browser do nothing. And I got the error "unexpected or unbalanced parenthesis or support" of AcqNUpdates_nonUI.m

    What is the problem?

    Thank you and best regards,

    Arthur Shulkin

    Hi Arthur,.

    Tools OR DAQmx for Acquisition of data with the Software Inc. MATLAB® from The Mathworks, supports up to the 2008 version of the MATLAB® software.  In order to use our products DAQ Multifunction with MATLAB® software, you could get back to 2008 or earlier, or instead use the Data Acquisition Toolbox provided by The Mathworks, Inc.

    Another option would be to import your ".m" files in a node MathScript in LabVIEW and use the functions of NOR-DAQmx everything in the LabVIEW development environment.  For more information on the Module LabVIEW MathScript, you can consult the information available on this link:

    Inside of the LabVIEW MathScript RT Module

    MATLAB® is a registered trademark of The MathWorks, Inc.

    Katie

  • Is it possible to use a CompactDAQ and NOR-DAQmx in the TPC-2212 with integrated system of Windows 7?

    Hello

    I would like to develop an application with the TPC-2212 (touch screen computers) and a CompactDaq system (NI9237 - 4 channels, ± 25 mV/V, 24-bit simultaneous Bridge Module).

    Is this possible or should I use a panel pc?

    Thank you.

    Hello!

    To work with touch screen, you can use the DAQmx BASE.

    To develop your application, you will need a host computer, where development will actually happen. For touch panel applications, you must use the touch panel module, which has the appropriate functions.
    (http://digital.ni.com/public.nsf/allkb/0FD6F56096A40AA9862578D3002EA41C)

    The touch screen will be the show as another material Measumerent and Automation (MAX) as a target.

    When you have finished your application in LabVIEW you can deploy on your Panel, but he must have the LabVIEW Touch Panel, to run your program.

    I hope it can help you! Doubts, contact us!

    Kind regards!

Maybe you are looking for

  • Pandora crashing when opening with ios 10.

    Is there a quick fix for this or should I just wait for an update?

  • Firefox does not load after update on 09/12/14

    I downloaded the recommended update and Firefox could not connect to the server. Restore my computer to an earlier time and OK all worked.

  • I get the RAM right?

    Hello I've never upgraded RAM before so I would just check that I have made the right choice please. According to this install memory in an iMac - Apple Support , I can get this 2 GB or 4 GB RAM SO-DIMM SDRAM DDR3 1333 MHz memory in each slot. I trie

  • Read/write in a variable using its refnum

    Hello I and VI and a Subvi. In VI, I have a Boolean variable a reference to this Boolean variable. The Subvi have entrance to this reference (see examples). Now, that's my question, in the Subvi can read and write the Boolean value of the variable in

  • Connecting USB on ACER Iconia A3 - A10...

    In addition, my ACER Iconia A3 - A10 when connected to the PC does not load as when I connect my phone to the PC... why?