Quantcast
Channel: Counter/Timer topics
Viewing all 1271 articles
Browse latest View live

Adding delay to finite pulse generation generates error -200305

$
0
0

Hello,

 

Sorry I am relatively new to pulse generation. Please help me understand why I am getting an error -200305 in my example VI Test Pulse Generation.vi when specifying an initial delay. Other than creating a task first and giving it a name, the code looks the same to me as the code in the LabVIEW example Gen Dig Pulse Train-Finite-Dig Start.vi that shipped with LabVIEW. When I am entering the same parameters into Gen Dig Pulse Train-Finite-Dig Start.vi, I do not get this error. What might be going on?

 

I am using a DAQ board NI-PCI-6031E on a 64-bit Win7Pro and am running LabVIEW 2011(64-bit).

 

Thank you for your help and forgive me for a maybe trivial question.

 

Peter


6343 syncronizing 3 counter pulse generators

$
0
0

hi all, 

i am triying to pruduce 3 pulses useing the counter ports, i need the 3 pulsess to have a varable dealy from the first to second and from the first to third pulsees (delay in micro seconds).

i am using the ni daq 6343 and coding in matlab.

i thought to use the InitialDelay property but they dont start together.

 

please help me!!

 

this is my code:

 

pulsWidth=0.000001;

s= daq.createSession('ni');

ch=s.addCounterOutputChannel('dev1','ctr0','PulseGeneration');
ch.IdleState = 'Low';
ch.DutyCycle=pulsWidth;
ch.InitialDelay=0;

ch1=s.addCounterOutputChannel('dev1','ctr1','PulseGeneration');
ch1.IdleState = 'Low';
ch1.DutyCycle=pulsWidth;
ch1.InitialDelay=1E-6;

 

ch2=s.addCounterOutputChannel('dev1','ctr2','PulseGeneration');
ch2.IdleState = 'Low';
ch2.DutyCycle=pulsWidth;
ch2.InitialDelay=10E-6;

 

s.startForeground;

6602 6612 difference

$
0
0

While upgrading from 6602 to 6612 I noticed different results when I use the same functions with the same arguments..

 

While generating single retriggerable pulse, the initial delay of the first pulse depends on the board I use. With 6602 it is (low time+initial delay), with 6612 it is initial delay only.

LV 2011, WIn 7, Win xp, DAQmx 14.5.1.

 

6602 6612 difference.png

I was under impression that if the feature is supported on different devices, it should work the same way. Additional options of the feature are set using properties to not default values. For example Enable initial delay on retrigger modifies pulse generation, but only if it is set to true.

 

One more difference is that PCI-6602 allowed not to use Implicit daqmx timing for retriggerable single pulse generation, PCIe-6612 demands it - without it it works, but times are not set correctly. 

 

The question is what are other behaviour changes can I expect in the same functions with the same arguments? 

 

Capturing a time stamp train in .NET from a 6602

$
0
0

I am trying to use a 6602 PCI to collect an array of time stamps of pulses using DAQmx.dll i.e. .NET. c#

 

I have so far used the CountDigEventsBufContinuous_ExtClk.2010 example, and it works without error, but I am not sure what the array of doubles represetns.  All I get are 0s.  My real problem is that when I alter the code to capture what I would really like, an array CiDataTicks or time stamps, I get the following error : "Read cannot be performed because this version of DAQmx Read does not match the type of channels in the task.  \n\nUse the version of DAQmx Read that corresponds to the channel type.\n\nTask Name: _unnamedTask<0>\n\nStatus Code: -200525" when it gets to the following line: "data = myCounterReader.EndMemoryOptimizedReadMultiSamplePulseTicks(ar, out actualNumberOFSamplesRead);" in the AsyncCallback.  

 

First, am going about this wrong?  Second, if not, then what is wrong with my readers that they can't perform the reading of an array of times or ticks?

Synchronizing counter output write to digital output

$
0
0

Hi all,

 

I have a question regarding writing to the counter outputs on a cDAQ-9188 with a NI 9401 module and synchronizing them with a digital output on a NI 9403 module.

 

Currently I am accessing the four on-board counters of the 9188 through the 9401 module, which are being used to create a 5kHz pulse train with a variable duty cycle to control four independent voltage outputs through a PWM chip. Whenever my main program is executing, I have a sub vi looping in the background which reads the requested values of the 4 channels through a functional global and calculates the corresponding on and off times. Within the same loop, I'm also building a boolean array which controls the enabling of the voltage output, its polarity and a reference digital output if the requested voltage in the current loop iteration was different than the last iteration (value changed indication for an analog trigger). After all of these values are determined, the counter writes to all four counter outputs and the digital output array is written.

 

 

Ideally, I would like "the value changed indication" to line up exactly with the counter write, but doing a millisecond timer outside my digital and counter writes showed the counter write took 20 ms to execute and the digital write took 2 ms to execute.  Is there any way to synchronize these two writes to they occur at the exact same time?

 

Thank you,

Cannot synchronize counters on PCI-6602

$
0
0

My experimental situation employs pulsed laser micromachining. The laser is externally trriggered with TTL pulses, but sometimes pulses are not triggered because the external TTL trigger is not synchronized to the laser controller's internal clock signal. The missing pulses can be observed by focusing into a sensitive photoresist translated on a nanopositioning stage such that individual pulses are well-separated, and gaps between holes are readily apparent when pulses are skipped. Using internal triggering of the laser there are no gaps, so it is not a problem with the laser itself.

 

For my application I need to synchronize the fast (38 MHz) reference TTL signal from the laser and the external TTL trigger at a user-defined frequency from 0-250 kHz. The user-defined TTL signal is generated by the nanopostioning stage controller, which does not have an input for the TTL reference signal from the laser, so the signal synchronization must be handled separately.

 

I have already thoroughly searched the posts on the forum and example VIs for solutions and tried numerous approaches pursuant to those posts, but I cannot get the signals synchronized. I am running the most current LabVIEW 15 SP1 f1 and DAQmx 15.5 with a PCI-6602 as in the attached block diagram image, with an SB-68 connector block. RegA is the laser reference signal at 38 MHz (CTR1 GATE on PFI34), A3200 is the nanopositioning stage controller signal (0-250 kHz) generated only when machining and idle otherwise (CTR2 GATE on PFI30), and Pulse Out is the TTL signal output to be synchronized with the RegA clock (CTR0 OUT on PFI36). I have verified with the test panels in NI MAX that both counter inputs work on the correct PFI lines, and the retriggerable output also behaves properly. My test case is using a 10 kHz generated signal (50 microseconds low, 50 microseconds high, 50% duty cycle), but the actual working version will input the same user-defined frequency as the A3200.

 

I first constructed this synchronization VI several months ago. In that early version I wired the 80 MHZ timebase into the RegA's counter terminal instead of PFI9, and ran one photoresist test that had no gaps. Thinking that I had a working solution, I perhaps naively stopped there without conducting further tests. Since that time I have patched LabVIEW (f1) and updated DAQmx from 15.0 to 15.5, and tried to replace the PCI-6602 with a new PCIe-6320. However, the 6320 yields the same result.

 

From what I have read, using the RegA signal as the sample clock should allow the PCI-6602 output signal to synchronize to it. However, tests with the photoresist always show gaps, and it does not appear that having the RegA signal even connected makes any difference. I am at a loss as to why the synchronization is not working and would appreciate any advice.

10V 100ns pulse counter

$
0
0

Hi everybody,

 

Maybe someone can help me with this; I am looking for a piece of hardware that is able to count pulses from 0 to 10V with a duration of 100ns. Is there a compactRIO module that can do this? There is one with an update range of 100ns but that is probably too slow? I need one with 50ns right?

 

Thanks in advance and regards,

D

two encoders with 9361

$
0
0

Hello All,

 

This might seem like a very simplistic question, but I've come to the end of my knowledge and require expert assistance.  I'm trying to get two quadrature encoders (single ended) working by modifying the Counter - Read Encoder example, however when I add them both to the same task, only the second added channel is read, and the results are displayed for both channels.  Individually they work fine, and if I create separate tasks for each encoder, then I run into the reserved error and it won't work either.

 

I know it's simple, the answer just eludes me a present.  I've attached my VI as it stands, any input is greatly appreciated.

 

Thanks!

Steve


programming pcie6251 DAQ in c++

$
0
0

I am using pcie6251 DAQ. I want to use this DAQ for counting the rising edges of a digital input signal applied as the source signal. I have DAQ M Series user manual which mentions about this functionality. But I am not able to find any c++ source code for implementing this functionality. Can some one please tell me where to find help documents for programming the pcie6251 in c++?

implicit clock overwriting wired sample clock rate

$
0
0

I have one implicit clock and two sample clocks in a VI code.  The top section of the code creates a line of square pulses at a “rate of trigger” (implicit clock), the middle section reads APD pulses from an input channel at a “rate of voltage” (sample clock) and the bottom section creates triangular waves at a “rate of voltage” (from “pattern”, also sample clock).  To get all of these processes to terminate correctly and at the same time, I connect “Terminal name with device prefix” – which is associated with the implicit clock, to the “source” of all the sample clocks.  (see pictures “Allsourceconneted_1” and 2)

 

Even though the bottom sample clock has its own frequency (rate of voltage), it still produces triangular waves at a rate of “rate of trigger”, due to, I am assuming, the connection to the implicit clock.  If I terminate the connection between “Terminal name with device prefix” and “source” for the bottom sample clock (see picture “disconnectbottom”), then it will produce the correct “rate of voltage”. However, the problem is that this bottom section will continue indefinitely and will never terminate the code, even after the “number of samples” exceeds “data” (see the while loop). 

 

How can I get everything to terminate at the same time, but still have different rates between my implicit clock and my two sample clocks?  Why does the bottom sample clock not follow the wired rate of "rate of voltage"?

Problem with frequency measurement using NI 9401 module

$
0
0

I am trying to measure the rpm of a dc motor by installing a hall sensor across a wheel connected to the motor. The wheel has four small gaps at equal intervals; the hall sensor gets demagnetized when it is across these gaps and gets magnetized again as it is away from these gaps. Meaning, the sensor is sending digital highs and lows (switching from 0V to around 5V) signal.

 

For measurement, I am using NI 9401 module placed at slot 6 on NI cDAQ-9178 chassis and the sensor is connected to pin 16 (PFI1) of the module.

 

When I check these signals using DAQ Assistant > Acquire Signals> Digital Input, I can see that the program is showing me the highs and lows correctly and results are given in the form of a ‘1D array of booleans’ in LabVIEW.

 

Now, when I use ‘counter input’ instead in the DAQ Assistant so that I can measure the frequency of these digital signals, the test run always gives me rapidly changing numbers around a certain value and this value does not change as expected if I speed up or down the dc motor. Additionally, the waveform chart also does not give a true representation of frequency as you can see in the picture below. The range of my frequency is 1-300 Hz and I am using 1 counter low frequency method. I am wondering how I can get correct frequency reading by this method, or alternatively, if I can somehow convert the ‘1D array of Booleans’ result into a frequency reading if I use the ‘Digital Input’ method. I am new to programming in LabVIEW and apologize if I have not worded the problem properly.

voltage pulse outputted by inductive sensor lowered when plugged to NI 9401 for counters

$
0
0

Hi,

We have tested the voltage output the sensor XS618B1PAM12 with module 9401. When unplugged from 9401 the voltage output is approximately 5V and it is indicated by LED light on inductive sensor (see Pic).

When plugged to 9401 module the voltage output is around 0.46V and the indicating light on LED sensor is so weak. (see pic below). How can we resolve this issue, we actually need the inductive sensor to output the 5V voltage pulses?

Thanks.

Kodjo

when_9401_unplunged_to_sensor.jpgwhen_9401_unplunged_to_sensor.jpg

Need Recomendation for project

$
0
0

I need 7 Counters, 7 Timers, 16 Digital Inputs, and 2 Digital Outputs. 

The count rate will not exceed 1,000 per hour. 

Counts may exceed 10,000 before resetting. 

Will need software to display counts and rate per hour, then record final numbers at end of shift.

 

Can someone help me?

 

Thanks

Patrick

alternating inputs using timed loop

$
0
0

Hi,

 

I am trying to supply alternating inputs to an instrument using Labview 2011.

 

I need to supply a value of 1 volt for 10 ms, then a value of 2 volts for 10 ms (then 1 volt and then 2 volts again) and the pattern should repeat continously.

 

How do I implement this alternating sequence in Labview using a time delay or timed loop?

 

I need to avoid using a square waveform because the instrument does not recognize it.

 

Hardware timing would be preferable because it needs to be precise.

 

Thanks.

Does DAQmx allow the counting of edges for multiple PFIs on same Counter?

$
0
0

I'm trying to get an encoder angle measurement.  I'm currently having an issue with the built in DAQmx angle measurement channel type, but simply counting edges appears to work.  I don't see a way to count the edges of multiple PFIs on the same counter though, as would be done to get an angle measurement.  The reason I want to do this is to manually convert to edge counts to an angle as I don't have much time to figure out why the native angle measurement isn't working.


Encoder keep resetting if Z phase enabled

$
0
0

Dear all,

 

I'm using NI USB-6341 USB DAQ with Labview 2015. I'm  OMRON open collect incremental encoder with 720pulse/rev.

I have all Phase A, Phase B, and Phase Z connected to 5V pull-up resistor. I checked the connection with ordinary counter. All the signal a counted correctly. All the ticks matched 720 pulse/rev. The index phase z triggers once every full rotation.

 

By using NI-DAQmx assistant, i'm able to get angular positions. All X1, X2, X4 decoding if working find without phase Z. But whenever Phase Z is enable for reset back to 0, the measured position keeps resetting at every count of Phase A and B (even slightest rotation, way before a complete rotation, or even close to indexing location).  like 0.25 -> 0, 0.25 -> 0, 0.25 -> 0. It keeps returning to 0 before measuring anything.

 

I wonder if phase Z enable captures the rising edge of a signal as high or the state of the input as high. Because if it's the latter, since it's pulled up, it's gonna be always high, and hence the immediate reset. If that's the case, is there any work around it? Removing the pull-up resistor doesn't return any values. What should I do to make crank position to work with open collector phase Z with NI-DAQmx assistant?

 

Regards

RJ

Photon Counting Using Single Photon Counting Module and PCI-6602

$
0
0

Hello all,

 

I am currently working on photon couting program using a single photon counting module (Excelitas) and PCI-6602 connected to BNC-2121.

 

I have taken a look other posts but I still could not solve my problem (or, still I am not so sure whether or not the problem is the hardware specification).

 

In the program, I am generating a trigger pulse at 1 MHz using one trigger in one separate loop.

 

Other than that, I have producer-consumer template based loops to acquire the data and do simple subtraction to calculate the number of photons in 1 microsecond.

 

Depending on the values connected to  'Input.BufSize' of DAQmx Buffer and 'Samples per channel' of DAQmx timing, I could change the looping number that the program does its job properly.

 

With the values, the program acquires 1 MHz photon counting signls for 139 times.

 

After that, the program stops and looping number increases very fast.

 

When I forcifully stop the program while the looping number is increasing very fast, the program pops up 'Error -200141'.

 

The error says 'Data was overwritten before it could be read by the system. If Data Transfer Mechanism is Interrupts, try using DMA or USB Bulk. Otherwise, divide the input signal before taking the measurement.', even though the counter explictly works in DMA mode when using sample clock.

 

I wonder there is any way that can solve my problem or still the only solution will be buying a better counter/timer board.

 

Thank you all for reading this.

 

I will be very happy with any clue Smiley Happy

 

Regards,

 

Myeongsu

 

 

PXI-6602 Generate Quadrature Signals A,B using DAQmx in CVI

$
0
0

Hi,

 

I want to know if it's possible to generate signals for a quadrature encoder...

 

I want to generate Signal A and then Signal B with a 90° of delay from the other and be able to define the number of pulses I want to generate.

I've been trying to generate the signals with DAQmxCreateCOPulseChanFreq, but I don't know to start Singal B with the 90° delay.

 

Does any one have any experience on this?

 

Thank you for your help,

 

 

How to use the function of "DAQmxCreateCIAngEncoderChan" to measure the angular velocity ??

$
0
0

hi all,

I hope to create an ANSI C program to measure the angular velocity of an electric motor by an normal encoder and a NI PCI card pci6251. However, I find that this card can't support the property of "DAQmx_Val_Velocity_AngEncoder" which seems means that the NI SDK only support the function "DAQmxCreateCIAngVelocityChan" but not the function of "DAQmxCreateCIAngEncoderChan" for this device. Oh,so bad...
I hope to use the function of "DAQmxCreateCIAngEncoderChan" to measure the velocity. Because it seems more better than using "edge count" directly. But I don't know how to do it...
Has anyone can give me any tips or advice?

Thanks a lot!
Best Regards

Keeping generated pulses in sync with an external clock

$
0
0

I am using a PCI-6602 card with Windows 7 and the ANSI C library.

 

I need a continous 100 HZ output to remain in sync with an external 1 HZ clock.

I started with the example at http://www.ni.com/example/27415/en/

If I send 99 pulses out I can retrigger each second without a problem

If I send 100 pulses out the next retrigger is missed and pulses go out every other second.

I there a way to get around this?

 

 

    TaskHandle  taskHandle=0;
    char *      chan           = "Dev1/ctr0";
    float64     duty           = 0.5;
    float64     freq           = 100;
    uInt32      idle           = DAQmx_Val_Low;
    float64     initDelay      = 0.0;
    uInt32      edge           = DAQmx_Val_Rising;
    char        *triggerSource = "/Dev1/PFI19";
    uInt32      numSamples     = 100; 

    DAQmxCreateTask("",&taskHandle);
    DAQmxCreateCOPulseChanFreq(taskHandle,chan,"",DAQmx_Val_Hz,idle,initDelay,freq,duty);
    DAQmxCfgDigEdgeStartTrig(taskHandle,triggerSource,edge);
    DAQmxCfgImplicitTiming(taskHandle,DAQmx_Val_FiniteSamps ,numSamples);
    DAQmxSetStartTrigRetriggerable(taskHandle, 1);
    DAQmxStartTask(taskHandle);

 

Viewing all 1271 articles
Browse latest View live


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>