Start Counter Output on a Analog Trigger in the PCI 6259 Mseries board

Hi,
My question is regarding how to use Analog Triggering to start a counter in the PCI 6259 M-series board.
I have attatched a program here
'Mult_Device_Digital_Analog_Out_on_Analog_Trigger.​vi'
and I'll explain my problem regarding this program.
I've tried to include all the details about the program in the documentation for the VI, but what the program
does is essentially output a set of digital and analog patterns as specified by an end user, and at times
specified in the front panel.
Problem 1.
I wish to start the whole operation on a analog trigger signal, in the program its the boolean "Line Trigger",
but I get an error saying that trigger type is not supported, when the M Series board manual clearly says it can be done.
Is there something wrong with my program ?
Thanks.
Shomu
Attachments:
Programs.zip ‏101 KB

Shomu
Admittedly, it might take a little time to find the documentation, but it is there. Also, the error you are getting indicates the proper trigger signals to use. In the help look at the analog Triggering Considerations for E Series, M Series, and S Series.
With that being said the easiest thing to do is to setup an Analog Input task configured to start on an Analog Trigger. Then, setup a digital edge trigger for the Counter task. The signal you are going to want to look for is the Analog Comparison Event. This signal won't show up by default in the list. What you need to do is right click on the trigger source constant or control and select I/O Name Filtering. Then check Include Advanced Terminals. Once you have done this you can select the Analog Comparison Event
StuartG

Similar Messages

  • Using LabVIEW to program a Pattern Trigger for the PCI-5112

    I am trying to program a pattern trigger for the PCI-5112.  Has anyone ever done this?  I am trying to use the the "Fetch forever" example as a base, then use the software trigger when there is a pattern match.
    Any help or advice with this would be very appreciated.
    PS as an example, I want to trigger when the pre-trigger data matches the pattern, say a 8 bit word such as 1010 0000.  Maybe I can try to do like my Tektonix TS5104B scope and try to program a timeout trigger.

    Good morning Andronicus,
    Thanks for contacting National Instruments with your issue, we'll try our best to resolve it for you as quickly and efficiently as possible.
    Unfortunately, there is no easy way to do what you're trying to accomplish with simply a Scope alone. The trigger input and PFI lines have no buffer and are only capable of looking for a single edge, and the standard CH0 and CH1 inputs strictly represent signals in analog. 
    So your current approach may be best, of using the Fetch Forever to acquire the signal into a prebuffer and then analyzing it and sending a software trigger.  So the best you can do in terms of response will be software-time, which is not ideal.  There is also the very tricky matter of interpreting that analog signal as a digital signal.  You'd have to know the clock rate of the incoming pattern and then also the phase in order to correctly assess the incoming pattern.  No easy task, and certainly nothing that would be super reliable or recommended.
    Your best bet would be to purchase one of our  HSDIO cards, such as the PCI-653x that inherently does pattern triggering in the hardware domain, and then route the start trigger (i.e. when the pattern has been matched) via a RTSI cable to the Scope card which can then simply use the digital edge trigger to begin it's acquisition.  This will be far more robust, easier to code and have a much quicker response time. 
    Best of luck with your project.
    Sincerely,
    Minh Tran
    Applications Engineering
    National Instruments

  • Please help with C code to synchronize counter output to analog input

    Hi All,
    I am using NI DAQ USB-6353 with text-based C code to control it. I would like to send a continuous pulse train from the DAQ to pulse a power supply, which then activates an electron beam producing current to be read by the analog input port of the same DAQ. I would like to keep only the analog samples during the pulse peak and samples of a couple pulse widths right after. I am successfully to generate a pulse train using the sampled clock from a counter output channel, but fail to use the same clock to synchronize the pulse train with the analog input. DAQmxReadAnalogF64 is not called by the static function EveryNCallback set for the analog input task. Am I doing something wrong with the following codes? It would be great if it turns out only I am using the wrong sampled clock name of the counter ("dev1/PFI8") for the analog input. Or is something more fundamental that a counter cannot be sync. with an analog input?
    Would someone be able to send me a link to an example in C or C++ or visual basic showing how to synchronize a buffered sample clocked digital pulse train from a counter output channel to an analog input? To simplify the post, the below codes do not include the static functions EveryNCallback and DoneCallBack, but I can send them if needed.
    Many thanks in advance for your help,
    Thuc Bui
    //setting operation parameters
    double initDelay = 0.0, freq = 10;
    double dutyCycle = 0.0001;           //thus pulse width is 10 microsec
    unsigned highTicks = 4;   //per period
    unsigned numSamplesPerPeriod = highTicks / dutyCycle;   //40000 samples/period
    unsigned lowTicks = numSamplesPerPeriod - highTicks;      //per period
    unsigned sampleRate = 2*numSamplesPerPeriod*freq;       //800000 samples/s
    //create counter
    TaskHandle counterTask;
    int errCode = DAQmxCreateTask("", & counterTask);
    errCode = DAQmxCreateCOPulseChanFreq(counterTask, "dev1/ctr0", "",
                                     DAQmx_Val_Hz, DAQmx_Val_Low,
                                     initDelay, freq, dutyCycle);
    errCode = DAQmxCfgSampClkTiming(counterTask, "dev1/PFI8", sampleRate, DAQmx_Val_Rising,
                               DAQmx_Val_ContSamp, numSamplesPerPeriod);
    //create analog input
    TaskHandle aiTask;
    double minVolt = 0.0, maxVolt = 1.0;
    errCode = DAQmxCreateAIVoltageChan(aiTask, "dev1/ai0", "", DAQmx_Val_Diff,
                                     minVolt, maxVolt, DAQmx_Val_Volts, "");
    unsigned bufferSize = 10* numSamplesPerPeriod;
    errCode = DAQmxSetBufInputBufSize(aiTask, bufferSize);
    errCode = DAQmxCfgSampClkTiming(aiTask, "dev1/PFI8", sampleRate, DAQmx_Val_Rising, DAQmx_Val_ContSamp, numSamplesPerPeriod);
    errCode = DAQmxRegisterEveryNSamplesEvent(aiTask, DAQmx_Val_Acquired_Into_Buffer,
                                            numSamplesPerPeriod, 0, EveryNCallback, 0);
    errCode = DAQmxRegisterDoneEvent(aiTask, 0, DoneCallBack, 0)
    //start aiTask first
    errCode = DAQmxStartTask(aiTask);
    //then counterTask
    errCode = DAQmxStartTask(counterTask);

    Hi Xavier,
    Thank you very much for getting back to me. I really appreciate it. I followed your advice with the option 2 and simplified my code by using one of the NI C example templates to generate the below codes (also attached). I was able to see the pulses generated with an oscilloscope, and on the same oscilloscope I could see the ouput pulses of the electron beam probe. Unfortunately, the below code via DAQmxReadAnalogF64 reports of no data read from the probe and finally times out. Below is the error message given by this function. I did check the connection of the analog input wires to make sure they were connected to pin 1 (A0+) and 2 (A0-) because I was using the terminal configuration DAQmx_Val_Diff. Do you see any obvious errors I have made in my codes?
    Thanks a lot for your help,
    Thuc Bui
    Task started, waiting for trigger...
    Acquired 0 analog samples DAQmx Error: Some or all of the samples requested have not yet been acquired.
    To wait for the samples to become available use a longer read timeout or read later in your program. To make the samples available sooner, increase the sample rate. If your task uses a start trigger,  make sure that your start trigger is configured correctly. It is also possible that you configured the task for external timing, and no clock was supplied. If this is the case, supply an external clock.
    Property: DAQmx_Read_RelativeTo
    Corresponding Value: DAQmx_Val_CurrReadPos
    Property: DAQmx_Read_Offset
    Corresponding Value: 0
    Task Name: _unnamedTask<1>
    Status Code: -200284
    End of program, press Enter key to quit
    ********************** C Code **************************************************
    #include <stdio.h>
    #include "NIDAQmx.h"
    #include <math.h>
    #define DAQmxErrChk(functionCall) { if( DAQmxFailed(error=(functionCall)) ) { goto Error; } }
    int main(void) {  
    int32 error = 0;  
    char errBuff[2048]={'\0'};
    TaskHandle  taskHandleDig=0;  
    TaskHandle taskHandleAna=0;    
    double  timeout=10;  
    double minVol = -1.0, maxVol = 1.0;
    double initDelay = 0.0;  
    double freq = 10.0;  
    double pulseWidth = 1.0e-5; //10us  
    double dutyCycle = pulseWidth * freq;
    unsigned hiTicks = 4;  
    double sampleRate = hiTicks/pulseWidth; //samples/s  
    unsigned lowTicks = ceil(sampleRate/freq) - hiTicks;  
    unsigned nSpPeriod = hiTicks + lowTicks;
    unsigned numPulses = 1;  
    unsigned nSpCh = numPulses*nSpPeriod;    
    double sampleRate2 = ceil(2.0*sampleRate);  
    unsigned sampleMode = DAQmx_Val_FiniteSamps;
     /*********************************************/  /*/ DAQmx Configure Code  /*********************************************/  
    DAQmxErrChk(DAQmxCreateTask("", &taskHandleDig));  DAQmxErrChk(DAQmxCreateTask("", &taskHandleAna));    
    DAQmxErrChk(DAQmxCreateAIVoltageChan(taskHandleAna, "Dev2/ai0", "", DAQmx_Val_Diff, minVol, maxVol, DAQmx_Val_Volts, ""));  
    DAQmxErrChk(DAQmxCfgSampClkTiming(taskHandleAna, "/Dev2/Ctr0InternalOutput", sampleRate2, DAQmx_Val_Rising, sampleMode, nSpCh));
    DAQmxErrChk(DAQmxCreateCOPulseChanFreq(taskHandleDig, "Dev2/ctr0", "", DAQmx_Val_Hz, DAQmx_Val_Low, initDelay, freq, dutyCycle));  
    DAQmxErrChk(DAQmxCfgSampClkTiming(taskHandleDig, "/Dev2/PFI12", sampleRate2, DAQmx_Val_Rising, sampleMode, nSpCh));    
    unsigned bufferSize = nSpCh;  
    DAQmxErrChk(DAQmxSetBufInputBufSize(taskHandleAna, bufferSize));  
    DAQmxErrChk(DAQmxSetBufOutputBufSize(taskHandleDig, bufferSize));
    /*********************************************/  /*/ DAQmx Write Code  /*********************************************/  
    DAQmxErrChk(DAQmxWriteCtrTicksScalar(taskHandleDig, 0, timeout, hiTicks, lowTicks, NULL));
    /*********************************************/  /*/ DAQmx Start Code  /*********************************************/  
    DAQmxErrChk(DAQmxStartTask(taskHandleAna));  DAQmxErrChk(DAQmxStartTask(taskHandleDig));
    printf("Task started, waiting for trigger...\n");
    /*********************************************/  /*/ DAQmx Read Code  /*********************************************/  
    double* dataAna = new double[nSpCh];  
    int32 numReadAna = 0;  
    int errCode = DAQmxReadAnalogF64(taskHandleAna, -1, timeout, DAQmx_Val_GroupByChannel, dataAna, nSpCh, &numReadAna, NULL);  
    printf("Acquired %d analog samples\n",numReadAna);  
    if (numReadAna) {   
        unsigned nPts = (numReadAna < hiTicks)? numReadAna : hiTicks;  
        for (unsigned n = 0; n < nPts; ++n) {    
             printf("%6.3f ", dataAna[n]);   
        printf("\n");  
    delete [] dataAna;
    DAQmxErrChk(errCode);
    Error:  
    if( DAQmxFailed(error) )   DAQmxGetExtendedErrorInfo(errBuff,2048);  
    if( taskHandleDig!=0 && taskHandleAna!=0 ) {   
    /*********************************************/   /*/ DAQmx Stop Code   /*********************************************/   
        DAQmxStopTask(taskHandleDig);   
        DAQmxClearTask(taskHandleDig);   
        DAQmxStopTask(taskHandleAna);   
        DAQmxClearTask(taskHandleAna);  
    if( DAQmxFailed(error) )   printf("DAQmx Error: %s\n",errBuff);  
    printf("End of program, press Enter key to quit\n");  
    getchar();  
    return 0;
    Attachments:
    Correlated DIO AI_Sample_Clock Dig Start.c ‏6 KB

  • How to filter starttrigger on counter output precisely

    HW PCI6602
    Measurement studio 2008 (C#)NI-DAQmx 9.02I’m trying to trig a camera using the output from a counter.
    The camera should be trigged when the counter input pulse width is larger than approx (filterPulseWidth 10us).To do this a have set up the following tasktask.COChannels.CreatePulseChannelTime(counter,                "TriggerTaskChannel", COPulseTimeUnits.Seconds, COPulseIdleState.Low, 0, 80E-6, 0.007);             task.Triggers.StartTrigger.Type = StartTriggerType.DigitalEdge;            task.Triggers.StartTrigger.DigitalEdge.Edge = DigitalEdgeStartTriggerEdge.Rising;             task.Triggers.StartTrigger.Retriggerable = true;task.Triggers.StartTrigger.DigitalEdge.DigitalFilterMinimumPulseWidth = filterPulseWidth;            task.Triggers.StartTrigger.DigitalEdge.DigitalFilterEnable = true;Unfortunatly this filter has the following behaviour”If the period of the filter clock timebase is tfltrclk, this filter guarantees topass pulse widths that are 2*tfltrclk or longer and to block pulse widths thatare tfltrclk or shorter. A pulse with a width between these two ranges may ormay not pass, depending on the phase of the pulse with respect to the filterclock timebase”.It means that I have no sharp distinction on my filter as one would when applying a filter to an ordinary pulse width measuring task. Implementing this with via the software in a callback is to slow.The bottom line is that I would like to generate a pulse on my counter output when the trigger/counter input is greater than say 10us. The output pulse could be predetermind as in the sample code above or as long as the filtered input (I.e counter just pass filtered input to my output).How can this be done? BR
    Jongas
    Solved!
    Go to Solution.

    Hi Jongas,
    Is it OK if the trigger is sent once the pulse hits 10 us, rather than
    on the exact falling edge?  I'll assume the exact timing isn't as important, but you would like the trigger to occur very close to the falling edge (within a couple of us).  The important thing is that we trigger as close as possible to when the PWM has hit 50% duty cycle.
    Some brainstorming:
    Digital Filtering on the 660x Isn't the Best for This:
    Digital filtering might not be as practical here on your 6602 due to the region of uncertainty between 5 and 10 (or 10 and 20) us pulses.  The TIO boards count two consecutive edges of a filter clock to determine when to pass a signal through so the guaranteed rejected pulse width is always half of your guaranteed passed pulse width (providing an external filter clock timebase that is synchronized with your external signal could potentially reduce this uncertainty but I honestly haven't tried this before and I would imagine it is not going to be very straightforward).
    X Series Alternative:
    Our X Series devices use a different method of digital filtering that would work better for you.  If a hardware change is an option (and you can use PCIe) then you might consider this.  You could use the 20 MHz timebase as your filter clock timebase and could guarantee to pass 10 us (200/20M) and reject 9.95 us (201/20M).  The 6320 is currently our lowest cost X Series board.  A couple of points about this solution:
    1.  To configure the PFI filter, you need to use some sort of dummy task to
    access the property nodes.  Here is an
    example of this (although it is written in LabVIEW).
    2.  You can route the filtered PFI signal to be exported on another PFI line, but this will reserve Counter 3.  This is documented in the Device Routes tab of Measurement and Automation Explorer.
    3.  The filtered output will be 9.95-10 us delayed from the input signal, so you could trigger the camera off of the rising edge of the filtered output directly and be fairly close to the actual falling edge.
    External AND Gate Alternative:
    You could configure a Counter Output to generate a re-triggerable pulse with a 10 us initial delay (to be triggered off of the rising edge of your PWM signal).  Assuming the pulse is short enough to complete before the next period of your PWM signal, the counter output would only be high at the same time as the PWM signal if the signal was longer than 10 us.  Use the external AND gate to combine these two signals and the result would be the trigger for your camera (the rising edge would correspond to 10 us after the PWM signal first goes high).
    If you wanted to you could make the counter output pulse a little longer (say 8 us) and trigger the camera off of the falling edge out of the AND gate (a.k.a. rising edge out of a NAND gate) which would line up with the exact falling edge of the PWM signal.  Don't make the CO pulse too long or it will overlap with the next period of the PWM.
    Another Idea:
    One idea that I keep coming back to is to use the internal rollover event of a counter input task (a pulse is generated whenever a counter rolls over on its Internal Output which can be routed to a PFI line).  I don't think this will work, but the idea in theory would be to:
    1.  Set Default state to known value (e.g. 2^32-200).
    2.  Gate the Counter so it only counts during the time PWM is high.  Have it count the 20 MHz timebase.
    3.  Reset the Counter to default state on the falling edge of the PWM signal.
    4.  The counter would rollover if 200 pulses occurred of the 20 MHz timebase (10 us), and the Counter Output could be routed to a PFI line to trigger the camera.
    The problem is that there is no good way to reset the counter except for an encoder measurement (Kevin has already made a nice suggestion about this).  A Pulse Width Measurement would technically reset the counter, but you cannot currently set the default value of a Pulse Width Measurement task so there is no way to make the rollover happen prematurely).
    Configuring an encoder measurement and working with the multiple counters on the 6602 to produce appropriate A,B, and Z signals might be a method to look into further, but at this point I think you'd be better off with an external AND gate.
    I don't want to say it's impossible with just the 6602, but I can't think of a straightforward way to go about it without external hardware (although maybe I can sleep on it and think of something later... how many counters do you have to work with?). 
    With your current NI Hardware, I think your best bet is to go with an external AND gate.  If you're planning on purchasing an X Series card the digital filtering idea is actually not a bad way to go.
    I hope this is helpful!
    Best Regards,
    John Passiak

  • Control analog output based on analog input

    Dear forumers,
    I am pretty new to the labview programming so excuse me if this was posted before.
    I use: Labview 8.5 + PCI 6229
    I want to create a real time feedback: to control analog output based on analog input. The task is very simple - if the ai1 (analog input 1) voltage is larger than a constant, then decrease the voltage of the ao1 (analog output 1) by a constant. Otherwise increase the voltage of ao1 by the same constant.
    All should work for 10 seconds.
    I have tried to implement this using 2 daq asistants and various methods. The problem is that I get the whole signal recorded from the ai1 ( 10 seconds) and then modified and released to the output (another 10 seconds). The execution takes 20 seconds instead of 10 and it is not realtime at all.
    Is it a must to make vi in "run continuous" mode to make it work ?
    Please help :}.
    I am attaching 2 examples.
    1. Main idea what I am trying to accomplish
    2. Very simple example that still does not work in real time simultaneously.
    Attachments:
    example-main.vi ‏180 KB
    example-simple.vi ‏147 KB

    nooto wrote:
    Thank you for your suggestion.
    I understand the simple arithmetic you are talking about. However I do not understand why it takes 20 seconds instead of 10 to complete the task. In other way to say - why it reads the whole input first (10 seconds) then write the output ( 10 seconds).
    Why doesn't ir read and write simultaneously?
    If I use Elapsed Time function - what feedback response time can I expect ? Is it good to use Elapsed Time if i need fast response time? In my application i would I need about 1 milisecond response time. Currently in the example the rate is 50 Hz, later I would like to change the rate to 1000.
    You simply don't understand the underlying paradigm of LabVIEW -
    dataflow. You have a dependency between the first DAQ Assistant and the
    second. The second simply will not start until the first finishes. There
    is no way around that given your condition that the output depends on
    what you read.
    If you want 1 millisecond response time then you will have to swithc to a real-time OS. Windows does not have that kind of resolution and there is way to much jitter.

  • Can PCI-6023E support hardware Analog trigger

    I try to use the PCI-6023E to do the hardware analog triggering, but it gives me the Error-10403 while I test with the vi example, Aiacquires N Scans Analog Hardware Trig.vi. Is there any way for this board to do the hardware triggering?

    Jack,
    The PCI-6023E DAQ board only supports digital triggering. You can check all the features of this board in the Data Sheet and Specifications on the Catalog page (see link below)
    2002 Catalog - PCI-6023E
    http://sine.ni.com/apps/we/nioc.vp?cid=1063〈=US
    If you need to perform analog triggering, you have three options:
    1) You can simulate it by acquiring continuosly all the signals that you want to monitor including the one that acts as the analog trigger. Compare the value read from this last one with the boundary that is supposed to trigger the acquisition, and when the value read reaches this boundary, you can save or display the data from all your channels.
    2) You could implement an external circuit that will compare the analog trigger signa
    l with the boundary value, and when they coincide, will generate a digital pulse that you can use as a digital trigger. This option optimizes your CPU usage.
    You can find detail information on how to set up the digital trigger in Chapter 4>>Timing Connections of the User Manual linked below.
    6023E/6024E/6025E User Manual
    http://digital.ni.com/manuals.nsf/websearch/0C88F40FFE7F28CD862569AE00574AC1?OpenDocument&node=132100_US
    3) Finally, you could get one of our boards that supports analog triggering. The PCI-MIO-16E-4 board has similar specifications that the PCI-6023E, and it has some additional features as well. See link below for more information.
    2002 Catalog - PCI-MIO-16E-4
    http://sine.ni.com/apps/we/nioc.vp?lang=US&cid=10795
    Good luck with your application,
    Claudia Lorente
    Applications Engineer
    National Instruments

  • Counter Output Pin on PCI-6229

    I am using NI-DAQmx 7.3 C API with (among others) a PCI-6229.
    I have used DAQmxSetCOPulseTerm() to connect a counter output to a terminal other than the default. It seems to work- the output pulses do, in fact, appear at PFI 6 (the terminal I'm using for testing). But the pulses continue to appear at the default output pin as well.
    Is that expected?
    In order to reverse the situation, I used DAQmxResetCOPulseTerm() just before calling DAQmxClearTask(). The function returns zero, but if I subsequently make a new task to do pulse output from the same counter, pulses appear at both PFI 6 and at the default pin.
    Am I missing something?
    John Weeks
    WaveMetrics, Inc.
    Phone (503) 620-3001
    Fax (503) 620-6754
    www.wavemetrics.com

    Salvador Santolucito wrote:
    Hi John,
    I would suggest using the DAQmxTristateOutputTerminal. I have tried what you are doing in LabVIEW and I'm seeing the exact same results. When I set the default pin to tristate, the counter output does not show up on it.
    -Sal
    Thanks for trying it and confirming what I saw, and thanks for the pointer to DAQmxTristateOutputTerminal.
    John Weeks
    WaveMetrics, Inc.
    Phone (503) 620-3001
    Fax (503) 620-6754
    www.wavemetrics.com

  • Buffered counter output in C

    Hi everyone,
    I am looking for a possibility to generate a finite buffered counter output with varying pulse widths, using the X-Series. I am working in C / Python.
    I want to output two pulses triggered to an external signal. The first pulse should be short, the second pulse long. 
    The following code outputs only two identical pulses. How can I modify it to output two different pulses?
    CreateCOPulseChanTicks(channel,"","100MhzTimebase",DAQmx_Val_Low,0,300,300)
    CfgImplicitTiming(DAQmx_Val_FiniteSamps,2) #output two pulses
    CfgDigEdgeStartTrig(src,DAQmx_Val_Falling) #external signal
    SetStartTrigRetriggerable(True) #retrigger
    Best Regards,
    Stefan

    It's good you found a workaround but the behavior doesn't seem right to me...
    The default behavior in DAQmx (the C / LabVIEW / .NET APIs) is to regenerate data from the buffer.  Perhaps the python wrapper you are using is disallowing regeneration somewhere?  I tried this with regeneration disabled and it gives the same behavior you reported (though with regeneration enabled it does not).
    You can use DAQmxGetWriteRegenMode to verify this theory and DAQmxSetWriteRegenMode to enable regeneration in case it is disabled.
    Best Regards,
    John Passiak

  • How to use counter using PCI 6259

    Hello, users,
    I have a PCI 6259 board and use Labview 7.1.
    I'd like to repetitively count the photon signals at 10ms integration time. I want cumulative counts in every 1 sec (1000ms) (or 1 min (60000ms)) And I want to save counts into txt.file which is open in excel program.
    I am a beginner to use counter using PCI 6259 board.
    1. Could you explain default NI-DAQmx counter terminals, i.e., CTR 0 SRC, CTR 0 GATE, CTR 0 AUX, and CTR 0 OUT?
    2. How do I use them or how can I connect to count TTL pulse using PCI 6259?
    3. As I mention my purpose above, which example is the first step to start working my purpose?
    4. If you know good example, could you tell me about that?
    5. If anyone has labview example which is similar to my aim, could you give me some tips or your examples?
    Any hint, comment or advice would be appreciated.
    Thank you so much for your response.
    Leek2

    I have never used the PCI 6259 but have used counters many times with labview, the coding should be the same independent of the board.  What you want to do is finite buffered edge counting using a internal clock.  The best way to do this is to look at the examples programs and use the express vi to get started, then you can use this code to customize your program exactly as you need.
    To address your questions:
    1. CTR0 means "counter 0" the name of the physical resource sometimes listed at GPCTR0.  Each counter has 4 connections to the outside world:
    source "src"(for counting input TTL signals),
    gate (for synchronizing to external clocks and edges),
    out (for pulse-train out operations)
    and aux (specialty operations such as up/down counting and encoding)
    2.For event counting with internal clocking you will only use the src this is the input from the signal you wish to count (ie PMT discriminator for photon counting).
    3,4,5. Look at the count edge examples, there isn't one that does exactly what you want but I have done this with a 6602 (it has e counters) where I use one set of counters to set up a finite pulse train in your case 1000Hz with 1000 pulses, and another counter to edge count on an external pulse, with the source of this pulse routed from the out of the other counter.  Then you can start the task and read when 1000 samples are in the buffer (about 1 second later).
    Hope this helps,
    Paul
    Paul Falkenstein
    Coleman Technologies Inc.
    CLA, CPI, AIA-Vision
    Labview 4.0- 2013, RT, Vision, FPGA

  • No digital trigger signal on a PFI x-port in a PCI-6259

    Hi,
    I am using a PCI 6259 DAQcard (with a SHC68-68-EPM cable and version:2.9.1f0) to get an analog signal and a digital signal. The analog signal is used in NI MAX or NI Signal Express (DAQmn 9.7.5) to trigger it with the digital signal. When the digital signal is mounted on a Px/x port I can detect it. If I want to use it as a trigger signal on a PFI x-  (better PFI x/Py.y-) .port I do not get any trigger quantitiy.
    With a NI USB 6008 everything works quite well. Remark: The digital post is just labled as: PTI 0 and not as in the case of the PCI 6259 on the NI CB-68LPR-board: PFI x/Py.y.
    Another remark is that I did not measure a voltage difference of 5 volt at the provided port.
    How can I fix the problem and use a PFI x/Py.y-port for a digital trigger?
    Solved!
    Go to Solution.

    Hey AndGar,
    by trying I found one chanel on the platine with give me an trigger signal. So I can measure something but not in every chanal.
    Maybe just the PFI x- ports are reserved for triggering and you need to close every other task which measures a digital signal.
    *actuall I have no access to the programm*
    Thanks and best regards,
    Marcus

  • Writing to digital port disrupting counter on PCI-6259? (nidaqmxbase)

    Hello,
    I've set up my PCI-6259 with an angular encoder counter, as per the C code example at http://zone.ni.com/devzone/cda/epd/p/id/5735
    This appears to work great, but I would also like to use my PCI-6259's digital lines to control a TTL switch on the encoder it's measuring (among other things). If I set up a separate task in the same program and install a new DOChan to the task, it works great: I can control the TTL and measure the encoder position at the same time.
    However, I would like to be able to control the digital lines, e.g., via a script, while leaving the encoder readout running continuously. I tried running the angular encoder counter example code, and while it was running, I ran the dio/writeDigPort example.
    First of all, the writeDigPort took about 3 times longer than usual to run. It wrote to the digital line successfully, but as soon as it had, it corrupted the counter somehow. The angular encoder example began to spit out garbage, rather than the measured angle.
    Is this just a limitation of nidaqmxbase, wherein I cannot use the PCI-6259 resource from multiple processes? I can imagine this being the case, since I think the counter setup is using a DMA.
    Or is there a workaround? Any advice is much appreciated, thanks!
    -Chase

    I think what was meant is that DAQmx Base is not multi-thread safe.  From the readme:
    NI-DAQmx Base is not multi-thread safe. In LabVIEW, use the error cluster to
    force execution order. In C, use only one thread to make API calls; especially
    for task/channel creation and deletion.
    So, if using DAQmx Base, all of your functions should be in the same thread (i.e. don't make parallel calls to the driver).
    Having said this, I notice you're using the PCI-6259 which is supported in DAQmx for Linux.  You didn't mention what OS you're using, but if you are able to use the full version of DAQmx I would recommend doing this.  DAQmx is multi-thread safe, and provides more functionality and better performance than DAQmx Base.
    Best Regards,
    John Passiak

  • How to use counter output pulses to trigger analog input?

    Hello all,
    I hope the kind people using this forum can help me, a lowly beginner LV programmer! I have been attempting to create a VI that produces a user defined number of TTL pulses, separated by every n seconds. Each TTL would be outputted to a stimulator, which in turn generates its own TTL. Using the stimulator-generated TTL, I would like to trigger finite analog data acquisition (e.g. for every TTL, trigger the collection of a data sweep that contains 4000 samples (collected at 4000 Hz), with 1000 samples collected pre-trigger. I would like to also be able to see each data sweep as it is triggered on a chart. As I understand things (lots of online/book/forum reading), I should be using the counter output to generate my TTL pulses, and syncing each counter produced TTL with analog input, as well as using a reference trigger. Also, the AI part should be started first, so that I don' t miss any counter outputs. If it matters, I also need to use one of the AI channels to acquire the TTL, so I can see my stimulator-induced responses to the stimulator in time.
    I am able to generate the TTL pulses from the counter output, but I am having a problem with the AI part. I am unsure how to sync the counter output with AI. Also, since I need to acquire pre-trigger samples, I would be needing to acquire samples continuously, but when I set 'continuous samples' on daqmx timing, the VI doesn't work (hence why's its set to 'finite samples').
     I hope someone out there can help, as I have been at this for what seems ages, with limited success. I am using a USB-6259 and LabView v8.2. Thanks!
    Attachments:
    RC001 v_1.vi ‏49 KB

    Hello,
    Due to the fact that analog tasks themselves are not retriggerable, a
    pulse train produced by a counter is always used as the sample clock
    for the analog input task in order to recreate a retriggerable effect
    for analog input. This can be done by creating a finite pulse train set
    to retriggerable using the DAQmx Trigger Property Node, or the pulse
    train could be continuous and just be gated by another signal. Neither
    of these methods can be properly applied in hardware to create a
    retriggerable reference trigger. You can however implement something
    similar in software by just stopping and restarting your reference
    triggered analog input task within a loop. There will be some delay
    between when the task is stopped and restarted, as these events require
    software intervention, but if there is enough time between when each
    trigger signal is generated, there should not be any noticeable delay
    or missed samples.
    I have attached an example of this!
    Mark B
    ===If this fixes your problem, mark as solution!===
    Attachments:
    RC001 v_1mod.vi ‏25 KB

  • Time measurement between counter output my device and analog input

    Hello!
    I'm trying to measure the time to generate a digital pulse train on the counter output, that goes to a frequency converter that controls a motor.  So I think it'd be the best way to wire the output of the frequency converter with an analogue input and make a timestamp before I generate the pulse and a timestamp when I recognize the singal, but I think that wouldn't be a serious measurement ?
    What's the best way to measure the time?
    kind regards peter

    hi there
    well, there a several ways to do this. the problem with the software - timestamps is the minimal resolution of 1ms. i'd suggest:
    - wire a copy of the digital pulse train to an analog input channel
    - wire a copy of the frequency converter to another analog input channel
    - create an analog input task with the two channels (the sampling rate defines the timing resolution,make sure to acquire enough samples to see the response signal) 
    - start this task
    - send the digital pulse train
    to optimize your acquisition you can use another copy of the digital pulse train as a start trigger for your analog acquisition.
    -> then you'll see the digital pulse train on one of the analog channels and the frequency output on the other one. both channels have the same time axis with a resolution defined by your sampling rate (~us depending on your hardware). then you can analyze the data.
    search the example finder for examples of how to create tasks and triggers.
    Best regards
    chris
    CL(A)Dly bending G-Force with LabVIEW
    famous last words: "oh my god, it is full of stars!"

  • How to trigger a TTL output with an analog input

    Hello,
    I have an apparatus for measuring the flame speed of various hydrocarbon/air mixtures.  The chamber uses central ignition as the means for igniting the mixture.  My goal is to film the ignition process with a high speed Phantom video camera.  I control the ignition with an analog output signal from a SCC-68 DAQ.  I would like to trigger the camera with the same signal that triggers the ignition sequence.  The camera is triggered with one TTL pulse so ideally I would connect the output analog voltage signal to an input analog voltage port that would be used to trigger a counter output that generates one pulse.
    I have a sample VI that triggers a digital pulse each time the analog trigger level is met and it works for what I am trying to do but I do not understand how the two channels are connected. I also can't figure out how to make the VI end after just one pulse.  In the VI the digital counter is supposedly triggered using the /Dev1/ai/StartTrigger slot on the DAQ but nothing is connected to this slot.
    I need to first figure out how to make the output_pulses_on_sine_wave.vi terminate after a single pulse is generated. Then I can try to incorporate it into the VI that I use to control the ignition and measure the temperature and pressure once the mixture is ignited.
    John
    Attachments:
    output_pulses_on_sine_wave.vi ‏27 KB

    I am using the USB-6259, sorry for the confusion.  I would be nice if I could trigger with an analog signal to the ignition system but it is controlled with a high voltage relay that operates when 12 volts are supplied to it. It really isn't a trigger as much as powering on the high voltage relay. To control it, I have a 12 V supply line that is switched closed using a SCC-RLY module.  Could I somehow connect the 12 V supply to one of the buses and use a digital trigger to supply the 12V on command to the high voltage relay?
    Thanks for the quick response. 

  • Analog input generating trigger on the counter gate to measure frequency

    Hello,
    I want to measure a frequency on the analog input but it doesn't seem to work.
    I'm trying to get it working using DAQmx with the use of ansi c.
    The
    first step I made was acquiring the information on the analog input.
    With the use of a simulated device this shows a sine wave on the input.
    My next step was to generate a trigger signal for the counter, but this doesn't seem to work.
    I don't see how it is possible to connect the trigger on the analog input to the counter.
    For the creation of the analog input and trigger I use the following code:   
        DAQmxErrChk (DAQmxCreateTask("",&taskHandle));
        DAQmxErrChk (DAQmxCreateAIVoltageChan(taskHandle,"Dev1/ai0","",DAQmx_Val_Cfg_Default,-3.0,3.0,DAQmx_Val_Volts,NULL));
        DAQmxErrChk (DAQmxCfgSampClkTiming(taskHandle,"",10000.0,DAQmx_Val_Rising,DAQmx_Val_FiniteSamps,1000));   
        DAQmxErrChk (DAQmxCfgAnlgEdgeStartTrig(taskHandle,"Dev1/ai0",DAQmx_Val_RisingSlope, 0));
    For the creation of the counter I am using the following code:   
    DAQmxErrChk(DAQmxCreateCIFreqChan(taskHandle1,"Dev1/ctr1",
    "",1,2000,DAQmx_Val_Hz ,DAQmx_Val_Rising ,DAQmx_Val_LowFreq1Ctr ,1,4,"");
    I hope some one could give me a hint.
    I have also tried the examples that come with DAQmx but far as I know this are only counter examples using digital inputs.
    Thanks in advance.
    Solved!
    Go to Solution.

    Hi,
    You have to use the comparison event output to the counter input. Change this property after the configure channel function.
    DAQmxSetChanAttribute (taskHandle1, "", DAQmx_CI_Freq_Term, Dev1/AnalogComparisonEvent);
    Regards,
    Bas

Maybe you are looking for

  • Error in ejbCreate using a Test Web Service

    Hi, I'm new to the Bea and j2ee worlds and I'm following the steps of "Getting Started: Enterprise JavaBeans" in "Tutorials". I've done "Step 4: Test the EJBs" but during the test (with a Test Web Service) these exceptions raised: Exception in hello

  • SQLJ in Applet: Open connection to 3rd machine?

    If a client machine download applet with sqlj from web server, is possible to open connection directly to database on 3rd machine? Or is prevented by java applet security? Rathu

  • (Windows) Premiere cs4 with Canon 5D Mark II

    I'm seriously considering buying Adobe's Production Premium, but I am extremely concerned about Premiere's support for the files outputted by my Canon 5D Mark II, h264 .mov 1920x1080p 30fps. I've done a lot of research and it seems as if a lot of fol

  • What is the URL for OWB 10g

    Can someone please provide me with the detail above? I have the URL for O9i

  • Dreamweaver accordion spry

    Hi all, Hoping someone can help me with this one. I have a drop down menu on one page which when I click a submenu item, opens a spry accordion panel on a different page. The panel item that opens depends on which sub menu item is selected on the afo