PCIe-1433: pulse train to CC1, in C++?

I'm sure this should be a simple question and there's a lot of good information from previous threads but I can't quite put it together.
I have a PCIe-1433 and a Point Grey Gazelle; everything works okay, and in the Camera File Generator, I can put the camera into bulb-shutter mode and correctly control the exposure. So, through the camera file, control of CC1 works well.
But now I want to programmaticaly generate a simple pulse train, to CC1 of this camera. CC1 is already set as "external" line 0 in MAX. I believe I am correctly putting the camera into external trigger mode because the frame rate drops to 0 (or the timeout rate). The commands are a bit confusing to me; currently I am using
imgPulseCreate2(PULSE_TIMEBASE_50MHZ, 50000, 50000, IMG_SIGNAL_STATUS, IMG_IMMEDIATE,
IMG_TRIG_POLAR_ACTIVEH,IMG_SIGNAL_EXTERNAL, 0, IMG_PULSE_POLAR_ACTIVEH,
 PULSE_MODE_TRAIN, &pulseId);
imgPulseStart(pulseId, sessionId);
No errors reported (after some trial and error), but I don't believe it's creating a pulse. I need to do this programmatically because I will need to vary the pulse rate to something the camera can support for different ROI's, although if there is a combination of using the camera file and code I would be happy to use that.
Any help would be greatly appreciated!

GREAT! Thank you Eric, starting with your tip and then some more trial and error, I've got it going now. A few things:
* The attribute I was trying to modify actually only involved a pulse width, but it still wanted me to stop the acquisition.
* The solution ended up being to code the camera mode (set by serial commands to first set the trigger source to CC1, then set the trigger mode to single) in the camera file.
For some reason that I'll figure out one day, sending these same codes with serial write just did not work at all. Even if I told the camera file not to send any serial codes at all, ever, sending the same two commands myself didn't seem to work (even though I got acknowledgement from the camera). I'd like to solve this because I believe that calling AcquisitionStart resends these codes (for example, when I set up for a sequence acquisition) but this is redundant and slows things down.
* So now I tell the camera file to send "trsrc line1\r" and "trm single\r", but with no pulse output. Then in the code, I use the commands below to set the pulse.
imgPulseCreate(PULSE_TIMEBASE_50MHZ, 70000, 70000, IMG_IMMEDIATE,
IMG_TRIG_POLAR_ACTIVEH,IMG_EXT_TRIG0, IMG_PULSE_POLAR_ACTIVEH,
PULSE_MODE_TRAIN, &pulseId);
imgPulseStart(pulseId, sessionId);
then, to change the exposure time:
imgPulseUpdate(pulseId, sessionId, delay, width);

Similar Messages

  • PCI 6602:How can I use the digital lines of the board and in the same time to generate pulse train using a counter?

    Hello!
    My problem appeared when I tried to update my code from Traditional NI-DAQ Legacy to DAQmx.
    I am using 2 counters (counter 5 and counter 7)  from PCI-6602, to generate pulse train, and also the Digital I/O lines of the port 0 (the lines form 0 to 7). What I do in my application is that I am starting to generate the pulse train on the output of the 2 counters, and after that I am playing with the state of the digital lines.
    In traditional there was no problem using the counters and the digital lines in the same time, everything was going perfectly, but in DAQmx this is not possible.
    What happens: I start to generate pulse train on the output of the counters,  no errors encountered, but when I try to modify the state of one line of the digital port the generation of the pulse train is stopped. This is happening when I start the task associated to the digital port.
    My question is: it is possible to create a channel on the digital lines without altered the channels created for the counters?
    Another thing what I manage to see using the  "Measurement & Automation Explorer" and Test panels for PCI-6602, basically is the same thing, I generate pulse train on the output of the counter 7 and try to start a task on the digital line, but I get one error :
    "Error -200022 occurred at Test Panel
    Possible Reason(s):
    Measurements: Resource requested by this task has already been reserved by a different task.
    Device: Dev4
    Terminal: PFI8"
    Instead if I use the counter 0 or counter 1 to generate pulse train I don't encounter the same problem.
    Which resources are used by the counters 2 to 7 from the PCI-6602 board and the counters 0 and 1 do not use?
    Thank in advance for any replies!
    Ciprian
    Solved!
    Go to Solution.

    Hello Jordan, thank you for your reply.
    I am sorry but I can not see or run your example, I don't use LabView, I use Visual C++ for developing.
    Here is the code for generating the pulse train:
    GeneratePulseTrain(unsigned long ulCount1, unsigned long ulCount2)
        short nStatus = 0;
        nStatus = DAQmxCreateTask("",&m_taskHandle);
        nStatus = DAQmxCreateCOPulseChanTicks (m_taskHandle, "Dev4/count5", "", NULL, DAQmx_Val_Low, 0.0, ulCount1,ulCount2);
        if( bTriggerMode == true) // if hardware trigger is enabled
            nStatus = DAQmxSetTrigAttribute (m_taskHandle, DAQmx_ArmStartTrig_Type, DAQmx_Val_DigEdge);
            nStatus = DAQmxSetTrigAttribute (m_taskHandle, DAQmx_DigEdge_ArmStartTrig_Edge, DAQmx_Val_Rising);
            nStatus = DAQmxSetTrigAttribute (m_taskHandle, DAQmx_DigEdge_ArmStartTrig_Src,"Dev4/PFI17" );
        //set the internal timebase
        nStatus = DAQmxSetCOCtrTimebaseSrc(m_taskHandle,"Dev4/count5","20MHzTimeBase" );
        nStatus = DAQmxStartTask(m_taskHandle);
        return nStatus;
    And the code where I try to set the digital line:
    SetChannelState(short nState)
        short nStatus = 0;
        uInt8 wrtBuf0[1]={0};
        nStatus = DAQmxCreateTask("",&m_taskHandle);
        // Configure line as output 
        nStatus = DAQmxCreateDOChan (m_taskHandle, "Dev4/port0/line0", "", DAQmx_Val_ChanPerLine);
        nStatus = DAQmxStartTask(m_taskHandle);
        wrtBuf0[0] = nState;
        nStatus =DAQmxWriteDigitalLines (m_taskHandle, 1, 0, 0, DAQmx_Val_GroupByScanNumber , wrtBuf0, NULL, NULL);
        nStatus = DAQmxWaitUntilTaskDone(m_taskHandle,10);
        nStatus = DAQmxStopTask(m_taskHandle);
        nStatus = DAQmxClearTask(m_taskHandle);
        m_taskHandle = 0;
        return nStatus;      

  • Continuous pulse train generation on my PCI 6602 takes up too much of my system resources.

    I am using a PCI 6602 to generate a clock signal that is to synchronize pattern generation on two PCI 6534's. I have done this by generating a pulse train at a user defined frequency on the PCI 6602. My problem is when I generate this pulse train, the program uses all of the computer's CPU, and slows the rest of the processes down. Just to let you know, I have isolated this program to ensure it is the only thing running, and it still has the same result. The CPU usage soars to 100%(and remains constant) and the memory consumption increases (and remains constant) as well. Also, if it helps at all, the CPU consumption is completely independent of the frequency that is being gene
    rated, but the memory usage increases a little with an increase in frequency. Does anyone have any insite as to how to fix this, for I have noticed that all of the posted examples like this behave in the same manner.
    Thanks,
    Dave

    Russell,
    Thanks for the reply. Just about five minutes ago I came to the realization that the card itself was not causing this to happen. When I took a closer look, I found that my C program and all of the example programs were using the NIDAQWaitForKey() function to enable countinuous generation. So what was happening was that function was constantly polling the CPU to find a key to be pressed. So lets just say I found a way around this problem, and so everything is well. There are a handfull of things that i need to work on now, but at least I know my clock generation program is correct and I can stop banging my head against a wall trying to solve a problem that does not exist and for which there is no solution.
    Thanks Again,
    Dave

  • Pulse Train Generation using PCI-MIO-16E-4

    I need to generate pulse trains of changing pulse widths using PCI-MIO-16E-4 daq card using Igor Pro.
    I have tried to use the CTR functions (but always keep getting errors and it doesn't work). I also used the general purpose counters (GPCTR functions) but cannot visualise them on a CRO. If someone can help in regards to the programming aspect, it will be greatly appreciated.
    Thanks
    Vakul

    Hi Vakul,
    Some questions that might help me to get you a solution.
    Are you using Traditional DAQ, or DAQmx and which versions are you using?
    What operating system are you running?
    When you say you can't visualize them on CRO, I assume that you are hooking the counter out to a cathode ray oscilloscope and can't see the pulse train?
    Are you going to need more than two different pulse widths for your pulse train?
    There are several online knowledge bases describing how to change the frequency of a pulse train on the fly.
    This link explains how to use software to create a new pulse width.
    http://digital.ni.com/public.nsf/websearch/7B1B0427C39FE33086256CEE00752133?OpenDocument
    This link discusses using frequency shift keying, which will only allow you to have 2 different pulse widths.
    http://digital.ni.com/public.nsf/websearch/EC1F089252F33B248625696E006FB6FC?OpenDocument
    I assume that you are writing this program to compile in Igor Pro using C. I can help you with the C code development, but don't know anything about the Igor Pro API.
    Please get back to me about those questions and let me know if you need further help.
    Michael Denton

  • Software Trigger from CC1 on PCIe-1433

    Dear Sir or Madam,
    Now I am getting into trouble about NI Measurement Automation explore with my PCIe-1433. I like to make software trigger from this software into my cameralink camera. However I am not so familiar with this software. Is it possible to make software trigger ? If it is possible, I like to know how to generate it.
    Best regards,

    Hello,
    Check out this forum post. It goes through the steps necessary to set up triggering in MAX.
    -Erik S
    Applications Engineer
    National Instruments

  • Comment faire pour que mon "finite pulse train" commence par COUNT 2 plutôt que COUNT 1 (pci-6602)?

    Bonjour,
    je génère un train de pulses fini (j'utilise donc 2 compteurs : un pour générer la gate, un autre pour générer le train de pulses).
    Concernant le compteur générant le "finite pulse train", la polarité de mon signal de sortie est négative : ND_COUNT_1 correspond donc à la portion "high" de mon signal, et ND_COUNT_2 à la portion "low".
    Je voudrais que, lorsque la gate démarre, le compteur commence par générer la portion "low" du signal (qui correspond donc à ND_COUNT_2). Comment dois-je m'y prendre ?
    Merci de votre aide.
    Julien

    Bonjour,
    je me suis probablement mal exprimé, l'inversion de polarité n'était pas l'objet de ma question. Mais j'ai réussi à régler mon problème seul, finalement.
    Il n'en reste pas moins que je vous remercie pour votre aide.
    Bonne continuation à vous aussi.
    Julien

  • How to connect external trigger PCI-1433

    Hi all:
    I met the same problem as this old post: https://forums.ni.com/t5/Machine-Vision/How-to-connect-external-trigger-PCIe-1433/m-p/1677560/highli...
    however the post did not give solution.
    I am having an issue getting the external trigger( from PCI 6259) to work with a cameralink camera, a PCIe-1433 card . The PCI 6259 is connected to BNC 2111, the output trigger signal from CTR0 is connected to the SMB connector on the 1433 card and is providing pulse train at TTL voltages (0-5V).  Using the MAX SOFTWARE and under the Acquisition tab I have CC1 set to external 0, however the camera is not receiving this external trigger. The camera is Basler 4096-140km.
    I measured the ouiput signal from CTL0, the sigal seems good.
    I tried RTSI trigger before, failded. I thought SMB should be more straight forward, seems I was wrong.
    Looking forward to reply!
    Attachments:
    camera configuration.jpg ‏168 KB
    External Camera Trigger(SMB).vi ‏57 KB

    Bobjojo,
    You will actually need to affect the properties of both the camera and the frame grabber to take advantage of this triggering mode. I found a document that contains a good run down of the process to acquire in this mode (linked below). As far as the programming for the acquisition is concerned, the frames will be built at the driver level for the specified frame height. This means that the IMAQ driver will composite the line scans for you, and any simple acquisition (the document shows using the Vision Acquisition Express VI) will be able to pull the image into LabVIEW.
    www.ni.com/white-paper/13786/en/pdf
    Karl G.
    Applications Engineer
    ni.com/support

  • How to connect external trigger PCIe-1433?

    I am having an issue getting the external trigger to work using a cameralink camera, a PCIe-1433 card and a signal generator.  The signal generator is connected to the SMB connector on the 1433 card and is providing a 20 Hz signal with a 20ms pulse width at TTL voltages (0-4V).  From memory, we are using the MAX software and under the Acquisition tab I have CC1 set to external, however the camera is not receiving this external trigger.
    I've attached a rough diagram of our setup.
    What could my issues be?  My thoughts are:
    1) Are there other settings in MAX I need to ensure?  I know the SMB connector can be an input or an output.  How can I make sure this is set to input?
    2) My input signal is 0-4V which is TTL, but does the signal need to be 0-5V?
    Any thoughts would be greatly appreciated.  Thank you.
    Attachments:
    ExternalTrigger.jpg ‏29 KB

    Hello tuckturn
    Thank you very much for getting in touch with us. 
    1)  In Measurement and Automation Explorer, the default is an input.  You would need to use LabVIEW to change the SMB connector to be an output. Can you please show me a screenshot of your camera attributes in Measurement and Automation Explorer.
    2)  Where does this input signal come from?  Do you have a 5V TTL compliant output to test this?  Can you please provide me the specification for whatever device is outputting the voltage?
    Thanks again.
    Sincerely,
    Greg S.

  • RTSI cable configuration with PCIe 1433 card

    Hi All:
    I tried to trigger my line camera with RTSI signal.
    The layout is: trigerr signal  is generated from one PCI card 6259 (Dev2/ctr0). The line camera is connected with one PCIe 1433 card, and the two cards were connected with RTSI cable.
    The problem is that how to register or configure PCIe 1433 with RTSI cable in MAX, it seems I can only configure PCI card within RTSI cable ......
    If it is true, how should I do to rout the trigger signal to the camera, such as "route Dev2/ctr0 to Trigger line 0"?
    Below is printscreen of MAX Configuration. Attached is my VI.
    thanks a lot.
    Bob
    Attachments:
    Triggered with RTSI from DAQ.vi ‏63 KB
    camera configuration.jpg ‏218 KB

    Thanks a lot, the post helped.
    But I am still confused with the details:
    To camera and PCIe 1433 configruaration, as the attached pictures shows: RTSI is configurerd as Camera Control Line as number "2"; the exposure control of camera is defined as "triggered".
    In previous attached VI, you may find that the IMAQ configurer trigger is applied to define trigger  type as "RTSI", trigger number as "2".
    About ttrigger signal from PCI 6259 (Dev2), digital pulse is generated and output terminal is defined as ctr0 ( seems only ctr0 or ctr1 is option).
    So I still do not know how to route signal from "Dev2/ctr0" to "Imag0 CCL 2" in labview.
    By the way, I read  the online example "LL Triggered Ring using DAQmx Pulse Train", http://www.ni.com/example/29476/en/.  Within this VI,  the DAQmx Connect Terminals VI is applied to route the counter's output to a RTSI pin so the signal can be used by the IMAQ device. However Dev2/ctro is not recognized as scour terminal, only other items such as PFI, APFI or RTSI are avaible, and output signal source is also limited with similar things, sounds like just internal connectrion with Dev2.
    thanks a lot.

  • USB-6009 pulse train generation with digital output....

    Hello!
    I've bought a new USB NI-Card (USB-6009) and now I'm trying to adopt an old vi that uses traditional DAQ drivers. I wrote that vi for a PCI NI-Card (PCI-6024E), which has two counters to generate two pulse trains simultaneously. Now I've only one counter and that's why I'm searching for a good way to create pulse trains using a digital output! The pulse trains are both ranging between 100 Hz and 100 kHz.
    I'm sure somebody has an idea how I can solve the probem in the best way
    Kind regards,
    Peter

    You can't do it with this low cost board. Both digital and analog outputs are software timed only. The analog out is rated at only 150  samples/sec and the digital is about the same. You can't even use one of the counters because it is not a hardware timed counter output. It is an event counter only as an input.

  • Can I generate pulse trains on more than one counter output at the same time?

    I have a PCI 6601 card with a BNC 2121 to connect the signals to two devices. The card is used as a trigger for both devices and I want to be able to generate pulse trains on two output channels at the same time, with a time delay between the two. How do I do that in Labview 7.1 Development with DAQmx?

    I feel foolish for not being able to figure this out, but it still doesn't work. Attached is the VI I use now. Counter 0 generates a finite pulse train and I programmed Counter 1 to generate a retriggerable single pulse triggered by CtrOinternaloutput. I still get the same error message: -50103 The specified resource is reserved. The operation could not be completed as specified.
    The same happens if I set the trigger for counter 1 at PFI36 (default output of counter 0) or any other PFI line. If I try a pulse train generation on only one of the counters, both work fine.
    If I try the example in traditional DAQ for multiple counter outputs with phase delay, it works fine.
    Can you tell me what I'm doing wrong?
    Attachments:
    Shutter_AND_lamp_trigger.vi ‏103 KB

  • Need to unreserve a counter in a finite pulse train generation

    Hi. Let´s introduce my application first: I´m trying to generate a N-pulse train with the M series PCI-6221, in order to achieve a high frequency clock for an SSI transducer. That´s why i can´t use a software generation (because of the high frequency) and i have to use a finite pulse train. Besides, I would need to use another counter for a variable and finite count (but not simultaneously). The problem is that, as i think i have understood, this finite pulse train involves the two counters working together, so I can´t programm another task with that resources.
    My question is, Is there any way to do the finite pulse train generation, unreserve the counters, wait for a finite count to finish and so on?
    Thanks.

    Hello,
    My knowledges tell me that you need two counter to generate a finite pulse train.
    The first counter generates a pulsed of desired width and the second counter generates the pulse train which is gated by the pulse of the first counter (Counter 0=Pulse Generation, Counter 1=Pulse train generation).
    However, the finite pulse train generation and the continuous pulse train generation seem similar. The key difference is the generation mode from continuous to finite and the use fo a DAQmx Wait Until Done vi instead of a loop to monitor user input. From a point of view of the hardware there is a difference between the two. Continuous pulse train generation requires only 1 COUNTER.
    Maybe you can try with a continuous pulse train generation and with this method you have another counter to do a finite count.
    Regards
    DiegoM.

  • Generating a pulse train

    Hello everyone,
    I'm using one counter timer from the DAQ card PCI-6014. I want to generate a pulse train with this output where I can control the number of pulses and the frequency of the pulse. The duty cycle is not important, I want to use the default value, i.e. 50%.
    I have used the vi called "train_impulsion2.vi" with the following values:
    -number of pulses = 10
    -frequency = 1 Hz
    -duty cycle = 0.5
    When I connect the output from the counter timer 0 to an oscilloscope (pin 2 and pin 53), what I see is a constant 5 V for the 10 sec. I don't see the 10 changes from 5 V to 0 V as it would be expected.  No falling or rising edges are observed.
    However by using the DAQ assistant with the vi "daq_assistant_pulse_train.vi", with the following numbers:
    -time high = 500 ms
    -time low = 500 ms
    -generation mode = N samples
    -number of samples= 10
    I'm able to observed what I want, i.e. 10 changes from 5 V to 0 V on the oscilloscope.
    How can "train_impulsion2.vi" works like "daq_assistant_pulse_train.vi"? Thanks a lot
    Marc  
    Attachments:
    train_impulsion2.vi ‏21 KB
    daq_assitant_pulse_train.vi ‏101 KB

    Hello everyone,
    Everything is now ok. I didn't put the correct leads inside the oscilloscope. That's why I wasn't measuring any rising or falling edges. Doh!!!!!!!!!!!!!
    Marc

  • How to get delayed pulse train

    hello,
    i am using Labview 7 and a PCI 6014 interface card. i want to generate delayed pulse train. for this purpose i am generating a analog waveform using 'function generator.vi'. i supply this waveform to a counter and to generate delay i am using 'finite pulse train(daq-stc).vi'. when i set trigger mode to 'no trigger', the VI works fine. But if i supply generated waveform to the counter gate(i.e. setting trigger mode to external), i see for sometime pulses missing are missing. I have also tried several other VI's(like 'delayed pulse easy.vi' and 'cont pulse train easy.vi'), but facing same problem. Can you please tell me how can i solve this problem.
    regards,
    Abhijeet

    hello Alan,
    Ok! here i explain my code. My requirement is to supply contineous 5V pulses at around 10Hz to a camera. After some time of the rising edge of pulse to the camera, i want to trigger Laser-1 and after some time of rising edge of the pulse to the Laser-1, i want to trigger Laser-2. In PCI 6014 there are only two counters which i am using for two Lasers(for delay generation). For Pulse train generation i am using 'function generator.vi'which is basically a waveform generator, but to get pulse train i set offset equal to amplitude. I supply this pulse train to two counters. To generate delay from the counters i am using 'Delayed pulse easy(9513).vi' which i have put into while loop. To see the output i am using 2-channel oscilloscope vi where i see some pulses missing. Also I obsereved pulses missing when i supply the output to the Lasers(Lasers stops firing for moment).
    I am attaching a timing diagram which is explains my application and a labview code where i have combined three VIs (one 'function generator.vi' and two 'delayed pulse easy(9513).vi').
    Thank you,
    Abhijeet
    Attachments:
    camera+laser1+laser2.vi ‏188 KB

  • How to generate a pulse train with different pulse width and delay?

    How to generate a triggered pulse train with different pulse width. for example, after each trigger signal, let's say 2 ms, then the counter output a pulse with pulsewidth of 1 ms, and then after 3 ms delay after the first pulse, the second pulse was generated with a pulse width of 4 ms.  Next cycle when the trigger signal comes, the same two pulses will be generated and so on. Is it possible to achieve this by using 6601 counter card? and if yes, how to achieve this? Thanks!

    Unfortunately you can not create a hardware timed pulse train with different widths on each pulse from a counter. Whilst it can be changed on the fly using software, since you require a hardware triggered signal getting the software involved will not give a huge amount of accuracy when the pulse will actually change.
    So in short you can't use your 6601 card (or a counter timer) to achieve this
    There are three possible Alternative solutions
    1 You could use a high speed digital IO device such as the (6533/34) to generate your variable signal which would require setting up the pulse train as a series of states based around the burst transmission mode where the clock would give you your specific timing.
    2 A timed analogy output (for example on a MIO card with a clock (PCI-6220 / 62xx), i.e. Not the 6704 style static analogy output cards)
    3 A high speed digital waveform card such as the (, 656x , 655x, 654x, 6534, 6533 (http://www.ni.com/modularinstruments/find_right.ht​m) ) this could then be scripted to work with your triggering and also there is a digital waveform editor which will enable you to set up the pattern you wish to generate (http://sine.ni.com/nips/cds/view/p/lang/en/nid/135​55) 
    Hope that helps
    Tim Matthews
    NI (UK)

Maybe you are looking for