NI-DAQmx DAQmxReadCounterF64 function

Here is VB6 code to use Ctr0 on PXI-6254 (in slot 2) to do 'PULSE WIDTH' measurement:
Dim taskHandle As Long
Dim ctrData As Double
Dim sampsPerChanRead As Long
Dim MinVal As Double
Dim MaxVal As Double
MinVal = 0.001
MaxVal = 1.0
Line 1: DAQmxErrChk DAQmxCreateTask("", taskHandle) 'Create Task
Line 2: DAQmxErrChk DAQmxCreateCIPulseWidthChan(taskHandle, "PXI1Slot2/Ctr0", "", MinVal, MaxVal, DAQmx_Val_TimeUnits3_Seconds, edge, "") 'Add Ctr channel to the task
Line 3: DAQmxErrChk DAQmxStartTask(taskHandle(taskNo%)) 'Arm counter and start measuring 'Arm and start measurement
'some time later following call is made
Line 4: DAQmxErrChk DAQmxReadCounterF64(taskHandle, 1, 10#, ctrData, 1, sampsPerChanRead, ByVal 0&) 'Read the pulse width
Observation:
1. It seems that if there is nothing connected to the Ctr0 input pin or there is no pulse at the input pin then Line4 above times out after 10 seconds, i.e., VB6 program feezes up for 10 seconds.
2. It was also observed that if I use 'Simulated NI-DAQmx Device' for PXI-6242's Ctr0 (set up in MAX) then Line 4 returns right away.
Questions:
1. Is there any way to make Line 4 'asynchronous' and exit and return pulse width value measured 'so far'? For example, if actual pulse widht is , say, 83 ms, and when Line 4 is executed only 40 ms pulse is done then I would like to see DAQmxReadCounterF64 return 0.040 s. When I get two consecutive readings same, I will know Pulse is done. This way, my 'Pulse Width' value display on the screen counts up starting from zero and stops when pulse is over. NOTE: I do not like to use NI-DAQmx CALLBACKs in VB6 because I think they are not reliable.
2. If I use DAQmxIsTaskDone function, will it tell me when pulse width measurement is over?
3. If answer to Q2 is 'yes' then what happens if second pulse starts before I get a chance to read the first pulse width value?
4. Why does 'Simulated NI-DAQmx Device' behave differently for Line 4?
Thank you.

Hello,
The functionality you are requesting for may not be plausible since counter tasks return values at rising/falling edges (see the link 1 below, section on Counters, Chapter 7 of the M-Series User Manual). A recommended approach would be to use a Digital Input Task; this would require VB6 code manipulation on your end, to read a set number of samples periodically (also, a change in your signal from low/high or vice versa would need to be taken into account). DAQmx Is Task Done function checks if the measurement or generation is finite and the task is done when you acquire/generate the final sample or when you call the Stop Task function/VI. If the measurement/generation is continuous (including on-demand timing), the task is not done until you call the Stop Task function/VI. In addition, the task is done if a fatal error is generated while performing the measurement or generation, or you abort the measurement or generation. NI-DAQmx tasks for simulated devices are verified just as they are on real devices, hence all resources necessary for counters, and so on, are counted and reserved for NI-DAQmx simulated devices just as they are on real devices. However, an important thing to note about simulated DAQmx Counter data is that its always returned as 0 (see link 2 below).
1. M-Series User Manual (Chapter 7: Counters): http://digital.ni.com/manuals.nsf/websearch/2025C99AB0614F9E8625748000577B9A
2. NI DAQmx Simulated Devices: http://zone.ni.com/devzone/cda/tut/p/id/3698
Regards,
Ali M
Applications Engineer
National Instruments
Message Edited by Ali M on 04-05-2010 05:47 PM

Similar Messages

  • Visual C++ AM/FM generation using NI-6062E & DAQmx C functions

    hi all,
    I am trying to write my own code in VC++ .Net(MFC) for FM/AM generation using DAQmx C functions, but it was more demanding than on the LabView platform. I can build the framework for all parameters (ie. Carrier Freq, Modulation Freq, Modulation Index, Amplitude) but as I came to the the array size, sampling rate, buffer size, I don't know what to do??
    Can anyone please have a look?
    Thank you very much!
    Attachments:
    NI_AM_FM.zip ‏60 KB

    Hello Sean,
    The following code is where I think most important to my task of AM/FM generation:
    (Ln147 to Ln162 in FunctionGenerator.cpp)
    void CFunctionGenerator::GenerateSineWave(
    CNiReal64Vector& waveform,
    double frequency,
    double amplitude,
    double sampleClockRate, // samples/sec.
    double samplesPerBuffer)
    double deltaT = 1/sampleClockRate; // sec./samp
    int intSamplesPerBuffer = static_cast(samplesPerBuffer);
    waveform.SetSize(intSamplesPerBuffer,CNiVector::NiVectorDoNotInit);
    for(int i=0;i waveform[i] = amplitude * ::sin( (2.0 * M_PI) * frequency * (i*deltaT) );
    I want to change the waveform 1D array to something like this for FM:
    waveform[i] = amplitude * ::cos(((2.0 * M_PI)*carrier_frequency*(i*deltaT)) + modulation_index*sin((2.0 * M_PI) * modulator_frequency * (i*deltaT)));
    for AM:
    waveform[i] = amplitude * (1 + modulation_index * cos (( 2.0 * M_PI) * modulator_frequency *(i*deltaT))*cos((2.0 * M_PI)* carrier_frequency *(i*deltaT)));
    It seems I need to add two more parameters "double frequency_modulator, double modulation_index," to the GenerateSineWave function,
    but it also looks like I need to adjust the "for(int i=0; i < intSamplesPerBuffer; i++)" because from my LabView Block Diagram iteration of "i" also depends on the two frequency parameters?
    Do I also need to adjust deltaT? or the sampleClockRate is not fixed in FM/AM cases?
    How can I do the above?
    Thank you for your patient.
    Regards,
    RollyMessage Edited by Rolly on 04-06-2005 02:35 PM
    Message Edited by Rolly on 04-06-2005 02:38 PM

  • Error code -200088, accessing DAQmx read function in fncB from fnc A

    Hi,
    I am using NIDAQ 6229, and C code.
    My c code is as follows:
    #define DAQmxErrChk(functionCall) { if( DAQmxFailed(error=(functionCall)) ) { goto Error; } }
    int main()
      TaskHandle aiTaskHandle;
    // and the variables whatever used in the API's declaration below done here and initialised
      DAQmxStartTask (aiTaskHandle);
      DAQmxErrChk (DAQmxCreateTask("AI Task",&aiTaskHandle));
      DAQmxErrChk (DAQmxCreateAIVoltageChan(aiTaskHandle,AIChannelList,AINameList,DAQmx_Val_RSE,0.0,10.0,DAQmx_Val_Volts,NULL)); 
      DAQmxCfgSampClkTiming(aiTaskHandle,"OnboardClock",AIRate,DAQmx_Val_Rising,DAQmx_Val_ContSamps,AISamplesPerChannelAcq);
      while(1)
                fncB( );
    fncB(  )
                DAQmxErrChk (DAQmxReadAnalogF64  
                  (AITaskHandle,DAQmx_Val_Auto,timeOut,DAQmx_Val_GroupByScanNumber,AIReadArray,AIarraySizeInSamps,&AISampsPerChanRead,NULL));
    This Code builds without errors and runs. But the problem is with calling the fncB( ) where the DAQmx read for aiTaskHandle is executing.
    The DAQ read works fine for one time, but in the second call of fncB it gives error " task specified is invalid or does not exist" with error return code: -200088.
    why for the second call , the task specified becoming unknown is not yet all clear.
    the ni error codes document doesnot list this error code yet all.
    i have tried in declaring aiTaskHandle variable global, then in the first time of calling fncB it gives the error as mentioned above.In my application i cant use DAQRead in the same function where i declared the taskHandle , so i have to call it from the function.
    Does some body help in calling the DAQread from another function, and why this task is becoming invalid for the second call,.
    Thanks ,
    vishnu
    Message Edited by gkvishnu on 10-12-2005 08:10 AM

    I found where does my error come from.
    I configure my task from a other function and call this callback to start acquisition (get partly from NI examples)
    I get the error on the Start_AI_Clk(taskAIClk); call.
    int CVICALLBACK AI_TrigStartCallback(int panel, int control, int event, void *callbackData, int eventData1, int eventData2)
        int32       error=0;
         char        Chaine[500],Chaine1[500],ChaineFormateur[500];
        int32       numRead;
        float64     *data=NULL,*dataMoy=NULL;
        int         i,j,Checked;
        double        LocValeurLue,TempsDebut,TempsTotal,TempsEnCours;
        long int     NbMesTotale = 0;
        FILE         *TempFile;
        if( event==EVENT_COMMIT ) {
            if( (data=malloc(NbMes*NbChanAIClk*sizeof(float64)))==NULL ) {
                MessagePopup("Error","Not enough memory");
                goto Error;
            TempsDebut = Timer();
            TempsTotal = TempsDebut;
            TempFile = fopen("TempoResult.txt","w");    
            Start_AI_Clk(taskAIClk);
            ProcessDrawEvents();
            gRunningTrig = 1;
            while( gRunningTrig )
                DAQmxErrChk
    (Read_AI_Clk(taskAIClk,NbMes,data,NbMes*NbChanAIClk,&numRead));
                ProcessSystemEvents();
                 /*data treatment*/
            TempsTotal = Timer() - TempsTotal;
            fprintf(TempFile,"Temps total:%.3f - Nb Mes totales : %d",TempsTotal,NbMesTotale);
            fclose(TempFile);
    Error:
        if( DAQmxFailed(error) )
            TraitErreurCarteDAQmx("Lecture AI horloge externe",error);
        if( taskAIClk!=0 ) {
            Stop_AI_Clk(taskAIClk);
        if( data )
            free(data);
        return 0;
    What happen is when I click on my start button, my function is executed
    once before a EVENT_COMMIT came, so it jumps directly to the Error part,
    then as the taskHandle is not null, it stop the task
     if( taskAIClk!=0 ) {
            Stop_AI_Clk(taskAIClk);
    Then it executes the if(event==EVENT_COMMIT) part and as the task has been stopped, it give the -200088 error code.
    To correct this, I change the Error treatment like this:
    if( DAQmxFailed(error) )
        TraitErreurCarteDAQmx("Lecture AI horloge externe",error);
        Stop_AI_Clk(taskAIClk);
    Yop!
    DanY

  • What function is used to read Angular Position form a Task?

    I have created a DAQmx task in MAX. This task configures a counter on a PCI-6259 to take the A and B counts from an encoder and give the Angular Position. What function do I use to read the value since I am no longer reading counts I am reading the position?
    Thank you in advance for any advice!
    John O'C
    Staff Test Systems Engineer
    Woodward, Inc.
    Skokie, Illinois, USA
    "Life is not a journey to the grave with the intention of arriving safely
    in a pretty and well preserved body, but rather to skid in broadside,
    thoroughly used up, totally worn out, and loudly proclaiming...
    Wow...What a Ride!"
    Solved!
    Go to Solution.

    Hi Izzy,
    I have Created the task in MAX. The task takes input into the counter from an encoder and converts it to angular position. Do I still use the DAQmxReadCounterF64 function to read the counter? I am guessing that I do and that the function returns the angular position rather than the raw counts. Not sure though.
    Thanks for taking the time to respond.
    Regards-
    John O'C
    John O'C
    Staff Test Systems Engineer
    Woodward, Inc.
    Skokie, Illinois, USA
    "Life is not a journey to the grave with the intention of arriving safely
    in a pretty and well preserved body, but rather to skid in broadside,
    thoroughly used up, totally worn out, and loudly proclaiming...
    Wow...What a Ride!"

  • DAQmxReadCounterF64() timeouts blocking program runtime

    Hi,
    I have a PCI-7342 board connected to a MID-7652 box that is being used to control a servo motor on a rotary axis with an encoder. I also have a PCIe-6323 board that is used to read a quadrature linear encoder on the counter using DAQmx and I am programming in C. As the axis rotates, it passes breakpoints and sends a trigger signal in order for the counter to latch a reading from the quadrature encoder.
    The DAQmx is set up using the following functions:
         DAQmxCreateTask(, &thHandle);
         DAQmxCreateCILinEncoderChan(thHandle, "Dev1/ctr0", , , , , , , , , );
         DAQmxCfgSampClkTiming(thHandle, "/Dev1/PFI0", , , , );
         DAQmxStartTask(thHandle);
    This sets up the counter to be latched every time a signal arrives at the PFI0 terminal. I have connected the breakpoint output from the MID-7652 box to PFI0.
    The rotary axis is configured with modulo breakpoints using the following functions:
         flex_configure_breakpoint(, , NIMC_MODULO_BREAKPOINT, NIMC_RESET_BREAKPOINT, );
         flex_load_bp_modulus(, , 250, );
         flex_load_pos_bp(, , 0, );
         flex_enable_breakpoint(, , NIMC_TRUE);
    Due to modulo breakpoints, I have to call flex_enable_breakpoint(, , NIMC_TRUE); every time a breakpoint occurs in order for the next breakpoint to be able to trigger.
    The problem I have lies in the next stage. I want to call the read function which will wait for incoming trigger on PFI0. So I call the function:
         DAQmxReadCounterF64(thHandle, -1, dTimeOut, , , , );
    Next in my code I start the motion of the rotary axis
         flex_start(, , );
         do
              flex_read_axis_status_rtn(, , &usAxisStatus);
              usBPStatus = !((usAxisStatus & NIMC_POS_BREAKPOINT_BIT)==0);
              if (usBPStatus)
                   flex_enable_breakpoint(, , NIMC_TRUE);
         } while ( !(usAxisStatus & (NIMC_MOVE_COMPLETE_BIT | NIMC_AXIS_OFF_BIT )));
    But this line is never reached because the DAQmxReadCounterF64() function keeps waiting for an input at the PFI0 terminal and blocks the program from running and times out, returning an error.
    I have tried rearranging the order of the functions by calling flex_start(); first and then DAQmxReadCounterF64() before the do-while loop.
    The problem with this method is that the DAQmxReadCounterF64() function blocks the runtime and so the second breakpoint is never enabled. The function again times out and returns an error.
    I don't want to set it to indefinite or my program will wait forever and not do anything. Is there a way around the DAQmxReadCounterF64() timeout? Or a way to re-enable the breakpoints?

    Duplicate
    John Passiak

  • What are the units of the DAQmx counter?

    Hello,
    I created this VI and several similar ones a few months ago, but, I have forgotten some of what I did back then.  I believe that this VI should measure period, using the counter on the DAQ chassis.  Can anyone tell me the units of the period measured?  I think it is seconds, but, I am trying to figure out how to figure that out!  The values of the period are generated by the DAQmx READ function in the WHILE loop.  What units is that function outputting to the array?  What are the units of the array elements, essentially?  See the attached VI.
    Also, how do you know?  I opened the DETAILED HELP for the DAQmx Read (Counter 1D DBL NSamp) shown in the VI but, I can't find anything on the units of the data coming out of the terminal labeled DATA with the orange wire, which is actually an array of periods, and we take the average of the most recent 15 or so period measurements.
    I had a suggestion months ago for an online NI manual containing a description of Buffered EdgeCounting measurements, but, when I went to find it, the link had been changed by NI, so, I can't find that manual, but, I think the answer is probably there, because I recall that manual being very useful when I did this before.
    Thanks for the guidance.
    Solved!
    Go to Solution.
    Attachments:
    continuously measure period buffered_singlechannel_forum Nov 13.vi ‏33 KB

    HI dav2010,
    When you create a Virtual Channel, you should specify the units the counter task will use.  There are several options which are listed in the help here:
    http://zone.ni.com/reference/en-XX/help/370469AA-0​1/lvdaqmx/mxcreatechannel/#DAQmxCreateChannel%28CI​...
    I am not on a computer with LabVIEW right now, but I believe the default should be ticks, which is the number of ticks of your device's timebase.  You can find that information in your hardware specifications.
    Regards,
    Chris E.
    Applications Engineer
    National Instruments
    http://www.ni.com/support

  • What is the difference btwn DAQmx ANSI C and VC?

    NI'CD gives some examples, some in DAQmx ANSI C and some in VC? What is the difference?
    How to use DAQmx ANSI C and write it into VC6? Thanks.

    Hello,
    We provide examples in both Visual C++ and ANSI C separately because they are different in nature. ANSI C is a procedural language...when programming on it the general method of solution is to break the task into successively smaller subtasks (top-down design.)
    C++ is an object-oriented language. In C++ generally the first step is to design classes that are abstractions of physical objects. These classes contain both the state of the object, its members, and the capabilities of the object, its methods. After the classes are designed, a program is written that uses these classes to solve the task at hand.
    In order to use DAQmx on VC 6, I would encourage you to look at the NI-DAQmx C Reference Help (it installs with NI-DAQ.)This help contains all the information you should need to program DAQmx in C, it explains NI-DAQmx concepts, functions, properties, etc. You can find this help by going to Start >> Programs >> National Instruments >> NI-DAQ.
    Hope this helps,
    LA

  • Increase Speed of DAQmx Sequence

    Hi Everyone.  I'm working on my first Labview program that will use a stepper motor to apply a load which is measured using a loadcell.  I'm using a stepper motor driver that takes digital output from my NI USB-6009.  I'm struggling with how to improve the rotation speed of the stepper.
    An image of my basic program is attached.  I've tried to make the labels on the tasks explain what each digital signal is responsible for.  I'm hopeful that when I contain the sequence within a while loop the motor rotates quicker than what it does.  Does anyone have an suggestions on how I can improve the speed of the program?
    One thing I was thinking about was instead of passing an individual F and then T to the driver to create the step I could put both the F and T into a waveform.  Unfortunately I haven't had any luck in making that happen with my limited knowledge.
    Another thing that I don't fully understand are the options in the DAQmx write function so I suspect I may be able to do something different there.
    Any suggestions and help that could be offered would be very much appreciated.
    Attachments:
    StepperDrive.jpg ‏178 KB

    Hi Mark,
    Thank you for your reply. I'll try to further explain:
    - the MS1-3 are digital signals that control the angle of a single step for the stepper motor. The stepper that I'm using has a single step angle of 1.8 degrees however the driver allows that to be reduced to half, quarter, eighth, or sixteenth. This is set by the specific combination of high and low values from the MS1, MS2, and MS3 pins. For example, if the desire is to have the motor rotate with a step resolution of 0.45 degrees I would assign MS1 = H, MS2 = L, MS3 = H.
    - the DIR is a digital signal that controls direction of rotation.
    - the STEP pin is a digital signal that first goes to low and then to high.  The driver detects the raising edge of the high signal and make the stepper motor rotate by one step using the parameters defined by DIR and MS1, MS2, and MS3.
    - If anyone is curious I'm using "Big Easy Driver" to operate the stepper (http://www.schmalzhaus.com/BigEasyDriver/BigEasyDriver_UserManal.pdf)
    - I've modified the block diagram (please see attachment) slightly just to give an idea what I'm trying to do.  My goal is to just get the stepper to spin as fast as possible so I believe optimizing whatever is in the while loop is what I want to accomplish.  Once I feel that I've got the best speed I will remove the while loop and turn the program into a SubVI.
    - I'm very new to Labview but I'm guessing that using a waveform that goes from low to high could replace the last two DAQmx write functions with one.  I'm struggling with creating the waveform as well as what to select from the write funtion "polymorphic selector".
    - Is there a preferred method of the sequence structure?  I believe that the DIR and MS1 - 3 pins must be established prior to the STEP signal and using the sequence is how I have tried to control this.
    Again, thanks for any help that can be provided.
    Attachments:
    StepperDrive.jpg ‏194 KB

  • 3113: Activity 'XXPONIT/233480' is missing a function reference.

    Hello All,
    I have designed a workflow in which i have to call workflow for n number of times.
    In this workflow i have taken one notification and one function . when user submits workflow, its reached to user's parent level(1). If it approves then forwarded to function. it will check whether for that parent level(1) parent is found or not. if parent is found then it will identify the parent level(2) and sets into Attribute level(1) .
    and forwarded back to notification.
    when i am trying to run this workflow am getting the *(3113: Activity 'XXPONIT/233480' is missing a function reference.) error.
    Eg. ____________Yes_______
    | |
    v Approve | No
    Start---> Notification ------------------> function ------------------> End
    | ^
    |_____________________________________|
    Reject
    I am pasting pl/sql code here: Suggest me where i am wrong:
    create or replace package body XXPO_WF_NIT_APPROVAL_PKG is
    v_user_id number;
    v_user_name VARCHAR2(15);
    v_flag_parent_exist varchar2(1);
    v_item_key NUMBER;
    PROCEDURE WF_START_PROCESS(p_user_id NUMBER) IS
    v_initiator varchar2(15);
    BEGIN
    /*To generate Unique Value for item key*/
    SELECT XXPO_NIT_SEQ.nextval INTO v_item_key FROM dual;
    dbms_output.put_line('item key ' ||v_item_key);
    /* To create Workflow Process*/
    wf_engine.CreateProcess(itemtype => 'XXPONIT',
    itemkey => v_item_key,
    process => 'NIT_PROC');
    /* For Getting Initiator name who has initiated workflow*/
    SELECT fu.user_name INTO v_initiator
    FROM fnd_user fu
    where user_id = p_user_id;
    /*for getting next approver level user name and user Id*/
    SELECT fu1.user_name,fu1.user_id INTO v_user_name,v_user_id
    FROM per_all_assignments_f paaf1,
    fnd_user fu1
    WHERE paaf1.person_id = fu1.employee_id
    AND paaf1.position_id IN (SELECT ppse.parent_position_id
    FROM per_position_structures pps,
    per_pos_structure_elements ppse
    WHERE pps.position_structure_id = ppse.pos_structure_version_id
    AND pps.position_structure_id = 4061 /*PO Test NIT Heirarchy*/
    AND ppse.subordinate_position_id IN (SELECT DISTINCT paaf.position_id
    FROM Per_All_Assignments_f paaf
    WHERE paaf.position_id IS NOT NULL
    AND paaf.person_id IN (SELECT papf.person_id
    FROM per_all_people_f papf,
    fnd_user fu
    WHERE fu.employee_id = papf.person_id
    AND papf.current_employee_flag = 'Y'
    AND trunc(SYSDATE) BETWEEN papf.effective_start_date
    AND papf.EFFECTIVE_END_DATE
    AND fu.user_id = p_user_id/*1547*/ )));
    wf_engine.SetItemAttrText(itemtype => 'XXPONIT',
    itemkey => v_item_key,
    aname => 'INITIATOR',
    avalue => v_initiator);
    dbms_output.put_line(v_initiator);
    wf_engine.SetItemAttrText(itemtype => 'XXPONIT',
    itemkey => v_item_key,
    aname => 'ATR_LEVEL1',
    avalue => v_user_name);
    dbms_output.put_line('6');
    wf_engine.StartProcess(itemtype => 'XXPONIT',
    itemkey => v_item_key);
    COMMIT;
    EXCEPTION
    WHEN NO_DATA_FOUND THEN
    dbms_output.put_line('In WF_START_PROCESS' ||SQLCODE || ':No data found' || SQLERRM);
    WHEN DUP_VAL_ON_INDEX THEN
    dbms_output.put_line('In WF_START_PROCESS' ||SQLCODE || ':Duplicate values found' || SQLERRM);
    WHEN OTHERS THEN
    dbms_output.put_line('In WF_START_PROCESS' ||SQLCODE || ':Other Exception' || SQLERRM);
    END WF_START_PROCESS;
    --====================End of WF_Start procedure================
    procedure is_comment_null(itemtype IN VARCHAR2,
    itemkey IN VARCHAR2,
    actid IN NUMBER,
    funcmode IN VARCHAR2,
    resultout OUT VARCHAR2) is
    v_comments_fst_level varchar2(200);
    v_result_fst varchar2(100);
    v_count number;
    BEGIN
    v_comments_fst_level := WF_NOTIFICATION.GetAttrText(WF_ENGINE.CONTEXT_NID,
    'COMMENT_FST');
    v_result_fst := WF_NOTIFICATION.GETATTRTEXT(WF_ENGINE.CONTEXT_NID,
    'RESULT');
    dbms_output.put_line(v_result_fst);
    IF( FUNCMODE = 'RESPOND') THEN
    IF (v_result_fst = 'REJECTED') THEN
    IF v_comments_fst_level IS NULL THEN
    RESULTOUT :='ERROR: Comment is required while rejecting the request';
    RETURN;
    END IF;
    END IF;
    END IF;
    dbms_output.put_line(SQLCODE || ':No data found' || SQLERRM);
    EXCEPTION
    WHEN NO_DATA_FOUND THEN
    dbms_output.put_line('is_comment_null'|| SQLCODE || ':No data found' || SQLERRM);
    WHEN DUP_VAL_ON_INDEX THEN
    dbms_output.put_line('is_comment_null' || SQLCODE || ':Duplicate values found' || SQLERRM);
    WHEN OTHERS THEN
    dbms_output.put_line('is_comment_null'|| SQLCODE || ':Other Exception' || SQLERRM);
    END is_comment_null;
    --===================================
    PROCEDURE Next_approver(ITEMTYPE IN VARCHAR2,
    ITEMKEY IN VARCHAR2,
    ACTID IN NUMBER,
    FUNCMODE IN VARCHAR2,
    RESULTOUT OUT NOCOPY VARCHAR2)
    IS
    v_count number;
    BEGIN
    --==============To initiate next approval workflow================
    IF( FUNCMODE = 'RUN') THEN
    SELECT count(fu1.user_name) INTO v_count
    FROM per_all_assignments_f paaf1,
    fnd_user fu1
    WHERE paaf1.person_id = fu1.employee_id
    AND paaf1.position_id IN (SELECT ppse.parent_position_id
    FROM per_position_structures pps,
    per_pos_structure_elements ppse
    WHERE pps.position_structure_id = ppse.pos_structure_version_id
    AND pps.position_structure_id = 4061
    AND ppse.subordinate_position_id IN (SELECT DISTINCT paaf.position_id
    FROM Per_All_Assignments_f paaf
    WHERE paaf.position_id IS NOT NULL
    AND paaf.person_id IN (SELECT papf.person_id
    FROM per_all_people_f papf,
    fnd_user fu
    WHERE fu.employee_id = papf.person_id
    AND papf.current_employee_flag = 'Y'
    AND trunc(SYSDATE) BETWEEN papf.effective_start_date
    AND papf.EFFECTIVE_END_DATE
    AND fu.user_id = v_user_id)));
    IF v_count > 0 THEN
    v_flag_parent_exist := 'Y';
    /* To get next approver name */
    SELECT fu1.user_name INTO v_user_name
    FROM per_all_assignments_f paaf1,
    fnd_user fu1
    WHERE paaf1.person_id = fu1.employee_id
    AND paaf1.position_id IN (SELECT ppse.parent_position_id
    FROM per_position_structures pps,
    per_pos_structure_elements ppse
    WHERE pps.position_structure_id = ppse.pos_structure_version_id
    AND pps.position_structure_id = 4061
    AND ppse.subordinate_position_id IN (SELECT DISTINCT paaf.position_id
    FROM Per_All_Assignments_f paaf
    WHERE paaf.position_id IS NOT NULL
    AND paaf.person_id IN (SELECT papf.person_id
    FROM per_all_people_f papf,
    fnd_user fu
    WHERE fu.employee_id = papf.person_id
    AND papf.current_employee_flag = 'Y'
    AND trunc(SYSDATE) BETWEEN papf.effective_start_date
    AND papf.EFFECTIVE_END_DATE
    AND fu.user_id = v_user_id)));
    --WF_START_PROCESS(v_user_id);
    wf_engine.SetItemAttrText(itemtype => 'XXPONIT',
    itemkey => v_item_key,
    aname => 'ATR_LEVEL1',
    avalue => v_user_name);
    ELSE
    v_flag_parent_exist := 'N';
    END IF;
    END IF;
    IF v_flag_parent_exist = 'Y' THEN
    RESULTOUT := 'Y';
    ELSE IF v_flag_parent_exist = 'N' THEN
    RESULTOUT := 'N';
    END IF;
    END IF;
    END Next_approver;
    end XXPO_WF_NIT_APPROVAL_PKG;
    Thanks,
    sheetal Mittal

    HI
    I believe the document that you are looking for can be found in the following location. This help file describes the NI-DAQmx Library functions, which you can use with National Instruments data acquisition and switch devices to develop instrumentation, acquisition, and control applications.
    Message Edited by jaced on 11-05-2007 12:18 PM
    JaceD
    Signal Sources Product Support Engineer
    National Instruments
    Attachments:
    NI-DAQmx C help.jpg ‏98 KB

  • "Simple" C NI-DAQmx programming

    After days of comprehensive DAQmx C functions documentation parsing, I still cannot do a very basic acquisition task... I do not understand clearly how to set timing and trigger functions!
    On a 200 kS/s PCI-6024E card, I would like to acquire signals on analog inputs "ai0" to "ai5" on every rising edge on port "pfi0/ai start" (ca. 50Hz). On every rising edge of "pfi0", I would like to convert the signal on port "ai0", then 5µs later on port "ai1", and so on up to port "ai5" where conversion should start 25µs later. And the whole process would run again 20ms later.
    This should occur in a THREAD_PRIORITY_TIME_CRITICAL thread in my process. This thread would "idle" wait for each "pf0" rising edge and subsequent conversions with the "DA
    QmxReadAnalogF64()" function.
    Thanks for your help ;-)

    NI-DAQmx installs examples in Program Files\National Instruments\NI-DAQ\DAQmx ANSI C Dev\. There are lots of simple example applications for various aspects of NI-DAQmx.
    In your first post, you show examples of DAQmx calls. They aren't organized into code snippets, so I presume that in the real code you are checking the return error codes!
    I also notice that at one point you have "/dev1/pf0". I bet you meant to type "/dev1/pfi0"
    John Weeks
    WaveMetrics, Inc.
    Phone (503) 620-3001
    Fax (503) 620-6754
    www.wavemetrics.com

  • Controlling NI2568 Switches using VB6 and DAQmx

    Can the NI-2568 (and similar) switches be controlled using VB6 and DAQmx?
    I got the impression from the "NI-DAQmx C API VIsual Basic 6.0" Help, that by using the "Digital Output API ",  it could be done very similarly to opening/closing a discrete , but no samples were included.
    I just need to close a few relays and don't know if I have to install the "NI-Switch" software or not.
    If it can be done, what would be the channel string to pass to the DAQmxCreateDOChan dll function
    (in place of "Dev<x>/Port<y>/Line<z>").  MAX shows my (simulated-don't have the hardware yet) switch device to be "PXI1Slot3" .
    Thanks,
    Jon 

    Hi Jon,
    You can also use NI-DAQmx Switch functions to control PXI-2568 rather using NI-SWITCH (NI-SWITCH installs ready-made VB examples)
    You can use functions such as
    DAQmxSwitchSetTopologyAndReset, DAQmxSwitchCloseRelays, DAQmxSwitchOpenRelays to control individual relays in PXI-2568. ANSI C Examples for DAQmx switches can be found at C:\Program Files\National Instruments\NI-DAQ\Examples\DAQmx ANSI C\Switches. This can be used to write VB 6 code. Refer to  using "C Examples to create VB 6.0 Applications" in C:\Program Files\National Instruments\NI-DAQ\Docs\cvb60daqmx.chm for help on converting C examples to VB 6.0.
    Kalyanramu Vemishetty
    Automated Test Systems Engineer
    National Instruments

  • DAQmx show raw output?

    I am writing an array of doubles using the DAQmx write function. I would like to know what the raw / unscaled values sent to the Digital/Analog converter are. Is there an easy way to do this, such as a premade VI, or maybe a way to use a simulated device as a loopback in NI MAX?
    Solved!
    Go to Solution.

    Hello fborlc,
    Looking at the DAQmx help for X Series Simultaneous Sampling devices (like the USB-6366); it seems you should be able to use the Internal Channels with Channel Property Nodes. If you check the help information, it states that using the device’s AI physical channel (for example, Dev1/ai0) for the DAQmx Create Virtual Channel VI specifies the ADC for the internal channel. You can then set the appropriate string value on the Input Source channel attribute/property. If you place a Channel Property Node in the block diagram, configure it for Analog Input>>General Properties>>Input Configuration>>Input Source, you should be able to use this feature. I don’t have one of these devices at hand, so I couldn’t test it, but you could try this suggestion. I found this information by searching for Internal Channel X Series in the DAQmx Help file.
    Regards,
    Alina M

  • DAQmX read trigger

    On the DAQmx timing block what does the source onboard clock mean. I am using USB6225 as my DAQ device and I didn't find any clockspeed for onboard clock on the manual for that device. Please need some help.

    First of all, you should clean up your diagram before you submit it here for review.  All of the DAQ settings are on top of each other.  It is impossible to follow the wiring unless I move things out of the way.  How can you troubleshoot anything if you can't see the connections?
    Next, your Current Channel control is a DBL.  It should be I32.  Change it.
    The Onboard Clock IS the internal clock.  In the DAQmx Timing function (Sample Clock), the rate input is the clock speed.
    Instead of having two DAQmx channels in separate threads, it would be better to create one DAQmx task that contains both channels you want to use, provided that all settings for both channels are the same.  This appears to be the case in your vi.  Use the Create Task function and wire the output into the task input of  DAQmx Create Channel.  Then you don't have to worry about separate identical threads.  You will have to change the read function to Multiple Channels Single Sample.  Why are you using Single Sample when you have the number of samples per channel set to 10.  If you want 10 samples, you need to selet Multiple Samples.  Your output will be an array of 10 samples.  If using Multiple Channels Multiple Samples, you can choose an output of 2D array.  The first row will contain 10 samples for the first channel, and the second row is for the second channel.  Use index array to separate them for processing.
    - tbob
    Inventor of the WORM Global

  • DAQmx Write - Append samples to buffer

    I'm developing a program to play back a waveform from a large file on disk. This is 72 hours of 1kHz data on 4 channels. I can't load the entire waveform into memory, so I wanted to feed the DAQ task 1 minute at a time. I figured that I would read in a minute of file data, convert it to a waveform, and then write it to the DAQ task. While that one minute is being sent out, I can read in the next minute and convert it and have it ready to load into the DAQ task.
    The problem is that the DAQmx Write function has two "Relative To"  options, "First Sample" and "Current Sample". Given my idea above, I'd expect that there would be a "Last Sample" option as well so I could just tack on the next block of data to the end of the currently playing sample.
    I need to avoid any glitching on the line. I'm not sure if a simple write in a loop will be fast enough to copy the new data to the DAQ buffer. I don't have my hardware yet, but I'd like to have the basics of my application set up so I can plug in the hardware on the day it gets here. But I don't want any nasty suprises that would cause me to completely restructure my software.
    Are there any other functions that I could look at in order to accomplish my goal?
    Brian Rose

    Hi Brian,
    I am not sure what devices you are using, version of DAQmx and LabVIEW you are using but I have some ideas that hopefully will help you out.  First off, I wanted to reference you to an example in the NI Example Finder that I was using for testing.  The example is called "Cont Gen Voltage Wfm-Int Clk-Non Regeneration.vi" and can be found by Help>>Find Examples>>Hardware Input and Output>>DAQmx>>Analog Generation>>Voltage.  This example is what you should base your code off of because it continually writes samples to the buffer every iteration.  Make sure though to set the "Relative To" DAQmx write vi to "current write position".  This needs to be added when you are setting up the generation in the DAQmx write property node.  This setting will write the data to the end of the buffer and not overwrite your waveform.  Also, you will need to change your waveform you are writing to the DAQmx Write vi to the waveform you are reading from the file.  It sounds though that you already have this portion set up.   
    Regards,
    Jordan F
    National Instruments

  • Questions about Alternate Syntax using DAQmx

    Hello all,
    my group has started using an alternative syntax for DAQmx Functions. Here's part of our original code:
    nitWFM->AOChannels.CreateVoltageChannel("Dev1/ao0", _T(""), dMinimum, dMaximum, DAQmxAOVoltageUnitsVolts);
    nitWFM->AOChannels.CreateVoltageChannel("Dev1/ao1", _T(""), dMinimum, dMaximum, DAQmxAOVoltageUnitsVolts);
    nitWFM->AOChannels.CreateVoltageChannel("Dev1/ao2", _T(""), dMinimum, dMaximum, DAQmxAOVoltageUnitsVolts);
    nitWFM->AOChannels.CreateVoltageChannel("Dev1/ao3", _T(""), dMinimum, dMaximum, DAQmxAOVoltageUnitsVolts);
    which became:
    DAQmxCreateAIVoltageChan(nitWFM,"Dev1/ao0","",DAQmx_Val_Cfg_Default,dMinimum, dMaximum,DAQmx_Val_Volts,NULL));
    DAQmxCreateAIVoltageChan(nitWFM,"Dev1/ao1","",DAQmx_Val_Cfg_Default,dMinimum, dMaximum,DAQmx_Val_Volts,NULL));
    DAQmxCreateAIVoltageChan(nitWFM,"Dev1/ao2","",DAQmx_Val_Cfg_Default,dMinimum, dMaximum,DAQmx_Val_Volts,NULL));
    DAQmxCreateAIVoltageChan(nitWFM,"Dev1/ao3","",DAQmx_Val_Cfg_Default,dMinimum, dMaximum,DAQmx_Val_Volts,NULL));
    we changed it to accommodate for a function that seemed to only work for us in one syntax (DAQmxSetWriteAttribute (nitWFM, DAQmx_Write_RegenMode, DAQmx_Val_DoNotAllowRegen))
    My question is, what is the alternative syntax for the following lines?:
    nitWFM->Control(DAQmxTaskVerify);
    CNiDAQmxAnalogMultiChannelWriter writer(nitWFM->Stream);
    because keeping them this way resulted in an error.
    Your responses are much appreciated.
    Solved!
    Go to Solution.

    Hello,
    The first function can be found in the C Reference Help by going to Start»All Programs»National Instruments»NI-DAQ»Text Based Code Support»NI-DAQmx C Reference Help and expanding the NI-DAQmx C Functions»Task Configuration/Control»Advanced»DAQmxTaskControl. This explains this function and the syntax to use. 
    Regards,
    Justin
    Justin
    National Instruments
    Product Support Engineer - Conditioned Measurements

Maybe you are looking for