Counting rising edge during 50ms for a TTL signal

Hello, I'm using Labwindows 6 and a traditionnal DAQ. I've injected a TTL signal on my card and I would like to count the number of rising edge each 50 ms without using an internal timer in labwindows so that the counting pace cannot be disturbed by Windows.
Do someone know how to process or which functions should I use?
Thanks

Hi it's still me with still some troubles
I've generated with my counter0 a square wave of 50 ms pulse width from an internal source but then, I don't know how to specify that this signal will also be the  pin gate (ND_PFI_4) of my counter1 which will count the rising edge.
Moreover I also don't know how to specify my counter1 just to count rising edge while  my gate is at high state; here 's mys code :
    //Generation of an internal 100 KHZ square wave
    GPCTR_Control(1, ND_COUNTER_0, ND_RESET);
    GPCTR_Set_Application(1, ND_COUNTER_0,ND_PULSE_TRAIN_GNR);
    GPCTR_Change_Parameter(1, ND_COUNTER_0, ND_SOURCE,ND_INTERNAL_100_KHZ);
    //Generation of a 100 ms gate
    //50 ms => low state
    //50 ms => high state
    GPCTR_Change_Parameter(1, ND_COUNTER_0, ND_COUNT_1,5000);
    GPCTR_Change_Parameter(1, ND_COUNTER_0, ND_COUNT_2,5000);
     //output the counter pulse, you must call Select_Signal.
    Select_Signal(1, ND_GPCTR0_OUTPUT, ND_GPCTR0_OUTPUT,ND_LOW_TO_HIGH);
    GPCTR_Control(1, ND_COUNTER_0, ND_PROGRAM);  
    //configuration CPTR1 that will count each rising edge while the gate is at high state
    GPCTR_Control (1, ND_COUNTER_1, ND_RESET);
    GPCTR_Set_Application(1, ND_COUNTER_1,ND_SIMPLE_EVENT_CNT);
    GPCTR_Change_Parameter(1, ND_COUNTER_1, ND_SOURCE, ND_PFI_3);
    GPCTR_Change_Parameter (1, ND_COUNTER_1, ND_SOURCE_POLARITY,ND_LOW_TO_HIGH);
    GPCTR_Change_Parameter (1, ND_COUNTER_1, ND_INITIAL_COUNT, 0);
    GPCTR_Control(1,ND_COUNTER_1, ND_PROGRAM);
    GPCTR_Watch (1, ND_COUNTER_1, ND_ARMED, &compteur);
    printf("%d\n",compteur);
And the value of compteur is not the value expected at all.
thanks.
(ps : can you speak french?)

Similar Messages

  • GiGe camera waits till there is a TTL signal takes a picture and then waits again for another TTL signal (IMAQdx)

    Hello , I have a problem with a GIgE AVT camera.
    All I want to do is make the camera wait and each time there is a TTL signal snap a picture and save it to the disk.
    I have spent hours and hours trying to make this work but I had no luck !
    Could someone with knowledge of the IMAQdx drivers help me please !?
    I really can't find a solution to this problem!

    Hello LaThoS, 
    thanks for your reply .
    What i am trying to do is use an AVT GS660 which actually has a hardware trigger input and all i am trying to do is put it in a while loop and make it wait untill there is an external ttl signal, then take a picture , save it and then wait for another ttl signal !
    I 've seen the examples but i cannot see how they are going to be usefull to me since there is no hardaware ttl signal on the cam( https://decibel.ni.com/content/docs/DOC-15346)
    I am attaching my sample code.
    Could you please help me figure it out ?
    Thanks in advance,
    yannis.
    ps:the problems that i am facing is that on ttl the camera starts saving the same image continisously till i stop the loop !
    Attachments:
    AVT_v5_NI.vi ‏75 KB
    enum.ctl ‏4 KB

  • DASYLAB : start acquisition on rising edge during a certain period of time

    Hello,
    I would like to know how to do on Dasylab to start acquire data on rising edge and during 0.6s exactly.
    Secondly, I've a little problem with the module "Integer". I displayed an acceleration and I would like to have the speed and position with a double integer but I did'nt find how to do this on Dasylab...
    Thanks,
    Morgane Charbonneau.
    Solved!
    Go to Solution.

    Hello,
    do you know this link?
    http://digital.ni.com/public.nsf/allkb/AE0A4D71F0CD603786256D9C0075B95B?OpenDocument
    http://digital.ni.com/public.nsf/allkb/91D44FC21F0DF0CE86256BB1003F6CD9?OpenDocument
    http://digital.ni.com/public.nsf/allkb/77F973851F041E0F86256BB1003EB94C?OpenDocument
    Regards
    Samuel G. | Application Engineer Team Leader
    Certified LabVIEW Developer
    National Instruments France
    #adMrkt{text-align: center;font-size:11px; font-weight: bold;} #adMrkt a {text-decoration: none;} #adMrkt a:hover{font-size: 9px;} #adMrkt a span{display: none;} #adMrkt a:hover span{display: block;}
    Été de LabVIEW 2014
    12 présentations en ligne, du 30 juin au 18 juillet

  • How to send a ttl signal with a good exactitude less than 10ms?

    i have a pci 6013 (8 input channel) and pci 6711 (4 outpout channel).Then i need to send a ttl signal to a camera ccd to take a photo when a waveform sinus is equal at zero (rising), but when i send this TTl signal with dasylab using generator pulse or combi trigger and readind this signal, i have difference between dasylab pulse(that is exactly) and measurement pulse that is approximate 40ms after.But i need to have less than 10ms is it possible?
    Frequence rate =1000hz and block size=512 the waveform sinus is 0.2Hz.i have already try to increase the sampling rate but nothing happens.Thank for your help.

    Yes, it's possible.
    You just have to reduce your block size to 10 !
    For more informations, visit Forum Dasylab en français at http://forum.aceboard.net/?login=128657
    Frédéric Miqueau
    MD Electronic, France
    http://www.mdelectronic.fr
    French Dasylab Forum : http://www.dasylab-forum.de/forum/index.php?showforum=43

  • Is it possible to start one counter on the rising edge of its gate and the second counter on the falling edge of the gate of the first counter?

    Hello,
    for my application I want to perform a buffered semi-period measurement with three counters.
    Therefore the first one have to start on a rising edge of its GATE and stop on the next rising edge. This is not a problem.
    But the second one should start on the falling edge (that immediately follows the rising edge) of counter 1 and stop the same time counter 1 will do.
    The third one should start after the falling edge of counter 2.
    Is this actually possible?
    Thanks in advance.
    Regards Thomas

    I think I may be a bit confused on exactly what you are trying to accomplish, so if my answer does not
    help, I apologize.
    Anyways, the way to do it (from what I gather) is to set the gate of the third counter to start on the falling edge of counter 1 and start on the next falling edge of counter 1.
    A little more clarity in how the counters are intended to start/stop may be helpful in getting a better answer.
    Derek

  • How do I perform a trigger that collect the data for every rising edge continuously and then automatically put the data in a .xls file??

    I need to collect the data for every rising edge a trigger perfoms. So far I could collect the data but it seems that it only collect the data in the start of triggering, but not continuously. I also want to put the data in an excel spreadsheet and automatically add new set of data when the next rising edge occur. Please help.
    thanks a lot.

    LabWindows/CVI actually ships with a comprehensive set of examples for just about every area of programming you can use it in, including triggered analog data acquisition and ActiveX control of Microsoft Excel for data logging. Go to the following two directories on your computer to find respective examples for the two areas you are inquiring about:
    1) C:\MeasurementStudio\CVI\samples\DAQ\Ai\DAQsingleBufExtTrig.PRJ
    2) C:\MeasurementStudio\CVI\samples\activex\excel\excel2000dem.prj
    Just make sure to study the examples carefully so that you fully understand the processes followed for triggered analog acquisition and the process of launching an ActiveX automation server for control, and then you should be able to merge the concepts shown in both of the example
    s to make the application you desire.
    Jason F.
    Applications Engineer
    National Instruments
    www.ni.com/ask

  • How can i get the every rising edge's time value with usb 6212 counter continues acquisition

    i have a usb 6212,and now i can get every pluse 'period ,frequency。 
    i want to know how to get the every rising edge's time point value by DAQmx Counter.
    thx

    As you already know YouTube doesn't play in the background, that's why I wasted my time trying to give you an alternative.

  • Counting falling edge on pci 6281

    I have an analogue signal consisting of pulses of 5V (reference level 5V, pulses to 0V) which occur randomly.
    I read this signal in using a pci 6281 NI card. This works fine.
    Now I would like to count the number of pulses for a given time (e.g. number of falling edges). According to what I read in the manual it should be possible to configure the system such that one can start a counter (arm it) and then ask the counter from time to time what the current number of pulses is.
    So the question is rather simple: what is the best configuration to do this? Should I use a different input (instead of analoge input)? Can I use the simple 'count events or time.vi' or should I use more advanced counter vi's?
    Thanks for any suggestion.

    Dear Steven,
    The best way to count events (falling or rising edge), it is to use the counter
    functionality. The device NI-6281 provides two counters.
    That means
        for the Software: see the examples under. Find Examples
    -> Hardware Input and Ouput -> DAQmx -> Counter Measurements ->
    Count Digital Events
        for the Hardware: you need to connect you signal to the
    input ctr0/source
    PS: Counter level is based on the TTL technologies
    Best regards
    Nick_CH
    www.ni.com/gettingstarted

  • How can I use the pulse train from a 6602 to trigger an niFGEN and niSCOPE on each rising edge of the pulse train?

    Hello,
    Here is my application: I need to use a 6602 counter/timer to generate a pulse train of certain frequency and duty cycle. On each rising edge of this pulse train, I need to output an arbitrary waveform on Ch. 0 of an niFGEN (5422) AND acquire data from CH. 0 of an niSCOPE (5124). I also need to synchronize the niFGEN and the niSCOPE to the same clock used for the pulse train (6602/ctr0). This process needs to continue until the user stops the system.
    I can generate the pulse train using the 6602 just fine using ctr0, but the pulse train shows up on OUT0 by default. When setting up the niFGEN and niSCOPE to trigger on rising/positive slope edge, OUT0 is not an option for either device as a source for the digital rising edge (pulse train). The main options for both are PFI0-3 and RTSI lines.
    Questions:
    1.) Is there a way that I can direct the pulse train to a location (such as an RTSI line) where BOTH the niFGEN and the niSCOPE can use it as a start trigger for each rising edge? I noticed in MAX that a route can be made between ctr0's internal output and a trigger line and others. If this is a solution, could you please explain how to accomplish this?
    2.) Once I configure the niFGEN and niSCOPE to be triggered on a digital rising edge, how can I effectively have this happen for every rising edge from the pulse train? In other words, can I just initiate the FGEN outside of the while loop and it will generate a waveform for each rising edge it sees at the source until the while loop is exitted?
    3.) Is setting a reference clock for the niFGEN and the niSCOPE the same thing as synchronizing both devices using the same clock that generated the pulse train? It is not clear to me the difference, and why it would necessarily be useful.
    Images of my current front panel and block diagram are attached. If you would rather have the actual VI's just let me know. Any help and/or explanation on this is greatly appreciated. Thanks in advance.
    Attachments:
    Front_Panel_Control.jpg ‏278 KB
    Block_Diagram_Control.jpg ‏263 KB

    Hello Cgifford,
    Welcome to National Instruments Forums.
    To output your signal to the PFI lines,
    you can use external connectios between OUT0 and PFI lines. You can also use
    the backplane to do so by routing into the same RTSI line.
    1)
    On the SCOPE and FGEN, the name of the
    terminals are actually “PXI Trigger Line x/RTSIx” but on the 6602 you might
    need to route the signal using the property:
    You can also use the DAQmx route signal which perform the same opperation.
    2)
    This will depend on the frequency of
    your pulse train. If this is lower than about 10 ms, then you can probably
    place this on a loop and start and stop the acquisition every time. If the
    frequency is higher than this, you will have to use:
    -       Scripting on the FGEN side (read more)
    -       MultiRecord Fetch (more information in the scope help file
    section “Acquisition Functions Reading versus Fetching”).
    3)
    The short answer is yes. The longer one
    might depend on how tight you need the synchronization to be (us, ns, ps). For
    very tight synchronization, you should look into here.
    Message Edited by Yardov on 06-18-2007 03:14 PM
    Gerardo O.
    RF Systems Engineering
    National Instruments
    Attachments:
    property.JPG ‏7 KB

  • Is there "rising edge"-block in labview?

    And block down counter? rising edge comes from button, digital line etc..

    Hi
    I want to detect rising edge of FPGA DIOs(trigger0 in attachment) to the RT side.if rising edge happen i have to send some data to FPGA. For this i took while loop on RT side and read boolean indicator(DIO trigeer 0) from FPGA to RT and inplimented some logic to detect rising edge(plz see in attachment). if this indicator(2v on DIO) is true i am executing true case shown in attachment(dont consider logic inside true case).My problem is on RT side true case(plz see in attached file) is executing for both rising and falling edge.As per the logic imlimented to detect rising true case should execute only for 0v to 2v change on pin but this true case is execute for 2v to 0 v change on DIO pin.Why this happen.Can any one  plz tell me.
    I am testing this with power supply appalying 0v and 2v across the DIO pin no 86 of sbrio 9606.  
    Attachments:
    FPGA.png ‏163 KB
    RT.png ‏151 KB

  • 6602: Rising edge capturing hardware interrupt

    I have this signal in input:
    I have to do something on rising edge as soon as possible.
    My idea is to receive an hw interrupt from the board, and to write an isr soubroutine.
    I read about callback function so i write some code.
    But when i call:
        DAQmxErrChk ( DAQmxCfgChangeDetectionTiming ( udpTaskHandle,
                                                      "Dev1/Ctr0",
                                                      "Dev1/Ctr0",
                                                      DAQmx_Val_ContSamps,
                                                      1));
    I have an error for the ctr0, it seems i can use onli the port0.
    Now my question.... is there on port0 a software thread that read continuosly the value of the pins?
    Or is there an hardware interrupt anyway ?
    I think that a software thread has a big latency for me, at this point don't need the 6602 board,
    i could read  the signal on LPT standard port.
    Thank you for the answer.
    There are 10 kinds of people. Those who understand binary notation, and those who do not.
    Solved!
    Go to Solution.

    Sorry if it's passed a long time, i tryed to do as you suggested, but if i set  DAQmx_Val_HWTimedSinglePoint how can i have a continuos acquisition?
    that's my code, it seems that thecallback function is called only once.
    #include <stdio.h>
    #include <NIDAQmx.h>
    #define DAQmxErrChk(functionCall) if( DAQmxFailed(error=(functionCall)) ) goto Error; else
    int32 CVICALLBACK TriggerDetectionCallback(TaskHandle taskHandle, int32 signalID, void *callbackData);
    void Cleanup (void);
    static TaskHandle  taskHandle=0;
    int main(void)
        int         error=0;
        int32       read;
        uInt32      data[1000];
        char        errBuff[2048]={'\0'};
        // DAQmx Configure Code
        DAQmxErrChk (DAQmxCreateTask("",&taskHandle));
        DAQmxErrChk (DAQmxCreateCICountEdgesChan(taskHandle,
                                                 "Dev1/ctr1",
                                                 DAQmx_Val_Rising,
                                                 0,
                                                 DAQmx_Val_CountUp));
        DAQmxErrChk (DAQmxCfgSampClkTiming(taskHandle,
                                           "/Dev1/PFI35",
                                           1000.0,
                                           DAQmx_Val_Rising,
                                           DAQmx_Val_HWTimedSinglePoint ,
                                           1000));
        DAQmxErrChk (DAQmxRegisterSignalEvent(taskHandle,
                                              DAQmx_Val_SampleClock ,
                                              0,
                                              TriggerDetectionCallback,
                                              NULL)
        // DAQmx Start Code
        DAQmxErrChk (DAQmxStartTask(taskHandle));
        printf("Continuously reading. Press Ctrl+C to interrupt\n");
        while( 1 ) {
    Error:
        puts("");
        if( DAQmxFailed(error) )
            DAQmxGetExtendedErrorInfo(errBuff,2048);
        if( taskHandle!=0 ) {
            // DAQmx Stop Code
            DAQmxStopTask(taskHandle);
            DAQmxClearTask(taskHandle);
        if( DAQmxFailed(error) )
            printf("DAQmx Error: %s\n",errBuff);
        printf("End of program, press Enter key to quit\n");
        getchar();
        return 0;
    int32 CVICALLBACK TriggerDetectionCallback(TaskHandle taskHandle, int32 signalID, void *callbackData)
        int32   error=0;
        uInt32  data[200]={0};
        int32   numRead;
        uInt32  i=0;
        char    errBuff[2048]={'\0'};
        static int count =0;
        count++;
        printf("\n\n%d", count);
        if( taskHandle ) {
            // DAQmx Read Code
            DAQmxErrChk (DAQmxReadCounterU32(taskHandle,1000,10.0,data,1000,&numRead,NULL));
            printf("\n%d",data);
        return 0;
    Error:
        if( DAQmxFailed(error) )
            DAQmxGetExtendedErrorInfo(errBuff,2048);
            Cleanup();
            printf("DAQmx Error: %s\n",errBuff);
        return 0;
    void Cleanup (void)
        if( taskHandle!=0 )
            // DAQmx Stop Code
            DAQmxStopTask(taskHandle);
            DAQmxClearTask(taskHandle);
            taskHandle = 0;
    Message Edited by blacksocket on 30-03-2010 03:56 PM
    There are 10 kinds of people. Those who understand binary notation, and those who do not.

  • PFI0 Trigger : howto plot PFI0 and record dateTime of Rising Edge ?

    Hi,
    I'm acquiring an analog signal on my PCI 6250, triggered on PFI0. For this test, I use DAQ Assistant
    I use VS2010, MS2013, DAQmx 14.0 .
    I acquire at 1MHz, 5,000,000 of samples (5 seconds)
    I would like to plot on a Digital Graph my PFI0 signal, which shows on horizontal axis Date Time. I would like also to know if it possible to record the DateTime of each Rising edge detected (Rising edge period on PFI0 may be faster than 5s) in parallel of my Analog Acquisition or at least the DateTime of the rising edge which has triggered the Analog acquisition.
    Kind Regards,

    Hello Charly,
    Yes you could start 2 differents tasks, one analog aquisition to plot your signal and at the same time one numeric like a counter to mesure your rising edges.
    Hope this will help you,
    Kind regards,
    Maxime G. | Application Engineer
    National Instruments France
    #adMrkt{text-align: center;font-size:11px; font-weight: bold;} #adMrkt a {text-decoration: none;} #adMrkt a:hover{font-size: 9px;} #adMrkt a span{display: none;} #adMrkt a:hover span{display: block;}
    LabVIEW Tour
    Journées Techniques dans 10 villes en France, du 4 au 20 novembre 2014

  • TTL signal count problem: mistaken counting

    Hello,
    I use a 0.2Hz TTL signal to synchronize two devices. I use a Usb 6210 card to count the TTL pulse. The counter is triggered when it detects rising edges. In my case, the counter was sometimes triggered at low level, which causes a false result (see the attached images, the TTL signal is sampled at 20Hz and the dots represent an increment of counter). How can I resolve this problem?
    In addition, the cable which connects the TTL output was welded by myself, could it be a problem of poor contact?
    Thanks a lot,
    KX
    Solved!
    Go to Solution.
    Attachments:
    pb_ttl1.jpg ‏80 KB
    pb_ttl2.jpg ‏223 KB

    What is the nature of the device producing the TTL trigger signal?  Is it possible, for example, that it could produce a 1-microsecond pulse (that might not be visible on your plot of the signal) that would trigger the counter?  Are you really producing a digital pulse (i.e. is your circuit something that is either "on" or "off", as opposed to "produces an analog voltage in the range 0 to 5 volts")?  Are there other devices around that could be producing pulses that are being "picked up" by your counter?  Is the cable connecting the TTL pulses to the counter shielded?  Is the shield grounded at only one end?
    These questions (and the previous one) suggest that the problem may be "electronics" rather than "LabVIEW" ...

  • Configure PXI-2567 to Trigger on Rising Edge using LabWindows​/CVI

    I need some help configuring the trigger edge for a PXI-2567 using Labwindows/CVI.  I have been able to successfully create and execute a scan list using both the ni-switch and daqmx APIs.  However, currently the PXI-2567 triggers on the falling edge of an input trigger.  I need to configure it to trigger on the rising edge of an input trigger.  Every function I could find in the daqmx API for configuring the trigger edge gave a non-fatal runtime error, and I could find no such functions in the ni-switch API.
    Any help configuring the input trigger edge on the PXI-2567 using Labwindows/CVI would be appreciated.
    Thanks

    Hi JonRice,
    You can configure the scan list to execute on the rising edge of an input trigger.  Here are the Labwindows/CVI and LabVIEW functions you would want to use to retrieve, specify or verify the edge of a digital signal that advances to the next entry in a scan list.
    NI-DAQmx C Property: More >> Advance >> Digital Edge >> Edge
    You can get/set/reset this property using:
    DAQmxGetDigEdgeAdvTrigEdge
    DAQmxSetDigEdgeAdvTrigEdge
    DAQmxResetDigEdgeAdvTrigEdge
    NI-SWITCH C Attribute: NISWITCH_ATTR_TRIGGER_INPUT_POLARITY
    You can get/set/check this attribute using:
    niSwitch_GetAttributeViInt32
    niSwitch_SetAttributeViInt32
    niSwitch_CheckAttributeViInt32
    NI-DAQmx LabVIEW Property: More:Advanceigital Edge:Edge
    DAQmx Trigger Property Node
    Short Name: Adv.DigEdge.Edge
    NI-SWITCH LabVIEW Property: Trigger Input Polarity
    niSwitch Property Node
    Short Name: Trigger Input Polarity
    Hope this helps!  Let me know if you have further questions.
    Chad Erickson
    Switch Product Support Engineer
    NI - USA

  • Rising Edge on AO Start

    Hi,
    I'm using a PXI 6251 Daq card.
    On this one, I'm generate on analog output a finite signal.
    I would like to initiate a rising edge on PXIx terminal when the Output analog task is realy run.
    In fact i would like to provoq an output trigger when the analog task is start.
    Is it possible ?
    Thanks for reply.
    Regards
    =========================
    Bonjour,
    Je dispose d'une carte PXI 6251
    Sur celle-ci je génére un signal Analogique Finit.
    Je souhaite provoquer un front montant sur une sortie PFIX quand la tache de génération à démarrer. Puis que cette sortie tombe à 0 quand la tache est stopée....
    Est-ce possible ?
    Merci pour vos réponses.
    Solved!
    Go to Solution.

    Hello __KB__,
    I think you should start from this example : https://decibel.ni.com/content/docs/DOC-5374
    Then, you'll have to adapt it in order to define a pattern which generates a high level as soon as the analog task starts and which generates a low level at the end of the finite acquisition.
    In order to know which digital line matches with your PFI line, you will have to look at the documentation of the PXI 6251 (http://www.ni.com/pdf/manuals/371291h.pdf, page 14). You can also get the information from MAX.
    Regards,
    Jérémy C.
    National Instruments France
    #adMrkt{text-align: center;font-size:11px; font-weight: bold;} #adMrkt a {text-decoration: none;} #adMrkt a:hover{font-size: 9px;} #adMrkt a span{display: none;} #adMrkt a:hover span{display: block;}
    Travaux Pratiques d'initiation à LabVIEW et à la mesure
    Du 2 au 23 octobre, partout en France

Maybe you are looking for

  • ORDS Template with parameter does not work

    Hello everybody, I can not get working a RESTful Service using the ORDS_SERVICES -API (ORDS version 3.0.0.343.07.58), same Query without parameter (hardcoded product_id) works fine. declare l_module_id number; l_template_id number; l_handler_id  numb

  • Resetting a computer

    Is there a way to restore your computer to the way it was when it was bought? I bought it in April of this year. Im having blue screens and I don't no how to fix it!

  • HT1212 So my phone is locked and I'm having a tough time.

    So i changed my password to go in my phone. But after a while i forgot it and i disabled my phone for a long time(2 days). So i went online to help me with this problem and it said this. If you have previously synced your device with iTunes, you may

  • How do download Adobe Flash Player without error parsing voucher problem?

    Hello, I'm trying to download and install Adobe Flash Player. I uninstalled all versions of Flash Player. I have the Adobe Download manager still loaded and the Adobe Photo Shop and the Adobe Reader still loaded. I use Mozilla Firefox version 3.6.8.

  • Mac keeps freezing. hold down power until computer turns off.

    My brand new macbook pro 13".... keeps randomly freezing up while on the internet, on legitimate sites. A black box pops up and says: You need to restart your computer. Hold down the power button until it turns off. So I do this, turn it back on, and