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

PWM with Low Frequency (less than 40 Hz)

$
0
0

i'm using myRio to generate PWM signal. how can I get PWM frequency lower than 40 Hz, I would like to reach 10, 20, 30, 40 Hz


PCI-6115を用いたパルスカウンタ

$
0
0

PCI-6115, BNC2110を用いてパルスカウントを試みているのですがうまくいきません.

アドバイスいただければ幸いです.

 

 

DAQmxを以下の設定で実行すると,エラーコード200141と表示されます.

信号を収録ーカウンタ入力ーエッジカウントーctr0を選択.

集録モード:Nサンプル

読み取るサンプル数:1M

レート:10MHz

測定対象のパルスシグナル:ctr0(PFI9)

外部クロック(10MHz TTL):PFI0

 

そもそもパルスカウンタとして機能させることはできないのでしょうか.

アナログ測定すべきでしょうか.

宜しくお願い致します.

generated pulse fall time with PIO16XE50 and SCB68 is wrong

$
0
0

I'm using a PCI MIO 16XE50 and an SCB68 with LV 8 to generate pulses signals to a stepper motor controller. I'm using the Labview generate pulse vi and the rise and fall time of the pulses is not correct. Information on the NI web site says that the rise and fall time should be less than 50 ns. My pulses drop from 5 V to 2.5 V, stay at 2.5 V for 250 ns, then fall. Same profile on the rising edge. This seems to happen either with the counters or the digital lines. I think this is causing the stepper controller to see two falling edges because it often makes two moves instead of one.

 

Is the 250 ns pause normal for this hardware? Is there some calibration or setting that needs to be adjusted?

How to sync Encoder Z signal with TDC (engine Top dean center)?

$
0
0

Hello guys,

I am trying to set up DAQ system for engine testing to measure pressure, temp, torque and etc.

I am currently using NI-6211, 6212(pressure and engine parameter), and 9213 (for temperature).

So far, I am able to measure mean values over cycle such as pressure and temperature. 

Then, I want to see instantaneous value by crank angle rotation (let's say every 1 CAD or 0.5 CAD). 

I have encoder installed at the free end of the crank shaft which has 1024 ppr.

So, theoretically, I can measure it every 0.35 CAD.

Then, I need reference signal to define exact crank rotation angle that is TDC.

So, how to sync TDC with Encoder Z signal?

Is there any simple and accurate way to sync TDC with encoder Z signal?

Thank you for assistance in advance.

 

 

 

 

How to count internal clock edges?

$
0
0

Hello,

 

I am working on an application using a NI USB-6218 BNC device that is going to drive a pair of digital IO lines high or low depending on the number of edges counted on one of the counters. I would like to use the counter0 (ctr0) and the internal device clock as the counter's source. However, I am having trouble getting this to work when I create a count edges channel as follows...

 

_myTask.CIChannels.CreateCountEdgesChannel("Dev1/ctr0", "ctr0", CICountEdgesActiveEdge.Rising, 0, CICountEdgesCountDirection.Up);

 

I suspect that the line of code above creates a channel and sets the source to my devices default ctr0 source terminal (P0.0). If I want to count internal edges, do I have to explicitly tell the created channel to use the internal clock as its source?

How to drive a digital output high when counter reaches a value?

$
0
0

Hello,

 

I have found a few examples addressing this problem but they are VIs and I am implementing this solution in C# so they are not entirely applicable. I would like to drive a digital output terminal high when my counter reaches an arbitrary value. How can I do this?

Generate trigger after every N counts from a single counter

$
0
0

How to generate a trigger after every, say N counts from a counter? I want to use only one counter for this application. when the count reaches N it should generate a trigger and then start from 0 again to count till N and generate a trigger.

How to route a start trigger to a counter?

$
0
0

Hello,

 

I would like to use a start trigger to generate single pulse on my device using it's counter. The following code snippet generates the pulse I want when I comment out all trigger related code. But when it is not commented out and I apply a high signal to the PFI8 terminal, the pulse is not generated. What am I missing?

 

_counter0Task = new Task();
_counter0Task.COChannels.CreatePulseChannelTicks("Dev1/ctr0", "ctr0", "/Dev1/20MHzTimebase", COPulseIdleState.Low, 0, 100000, 400000);    // 100000 = 5ms worth of time.
_counter0Task.COChannels[0].CounterTimebaseActiveEdge = COCounterTimebaseActiveEdge.Rising;
 _counter0Task.Triggers.StartTrigger.Type = StartTriggerType.DigitalEdge;
_counter0Task.Triggers.StartTrigger.DigitalEdge.Edge = DigitalEdgeStartTriggerEdge.Rising;
_counter0Task.Triggers.StartTrigger.DigitalEdge.Source = "/Dev1/PFI8";
_counter0Task.Control(TaskAction.Verify);
CounterSingleChannelWriter counter0MultiChannelWriter = new CounterSingleChannelWriter(_counter0Task.Stream);
_counter0Task.Start();

Syncronization of two counters

$
0
0

I am trying to synchronize two counters to collect data from a rotational and linear encoder. I have followed several examples on how to do this however I am having trouble triggering the counters. I am using a dummy voltage input to set the clock source and I set the source of the sample clock to ai/sampleclock. When I run the vi it collects no data and gives me a 200284 error. I assume it is due to the external clock not being routed to the counter sample clocks. I can not figure out how to make the route beyond changing the timing engine to ai. I change the sample timing engine to ai (option 2) by setting the DAQmx timing property.

 

I also have a random 201133 error stating that one of the counters can not be configured for I/o because it is being used by another task. I have reset the tasks at the beginning of the code and I still get the error. I assume it is because the task is not cleared after a fault but the reset device vi should fix this.

 

I am using Labview 2013 with a cdaq-9174 with a Ni-9401, NI-9263 and b-9201.

Note: this was previously posted in the Labview board but I think this is a better location.

 

Thank you,

 

Chris

Multiple Frequencies measurements

$
0
0

Hello... I am just a beginner in using labview and daq... can any help me out in measuring the feedback of 3 motors encoder ( i.e frequency).... basically I have to measure three different frequncies in real-time.

I am using usb_6009.

Missing/duplicate readings in a 6602?

$
0
0

I have a 6602 and I have it collecting 2 trains of edge time stamps (ticks) simultaneously.  I have 2,500 line encoders, running 100 RPM.  4.1666kHz or .24ms period.  4 rotations, so 10,000 ticks per encoder.  I have synchronized the channels to both have the same start trigger.  The routine I use is the BeginMemoryOptimizedReadMultiSampleDouble in c#.

 

I am measuring the difference between the 2 encoders.  I have been chasing an error in the data I have been getting for a while and realized today what I am seeing... To find the problem I put both NI channels to the same encoder.  The expected output is to have 2 identical pulse trains.  What  I see is identical readings (+/-1 tick) for the first ~180 rows, but after 180 readings they get offset by 1 period (2,400 ticks)  and then later around row 356, the offset increases.  Just before, during, or right after these transitions, I see repeating time stamp/ticks (example: instead of 12,000, 14,400, 16,800 I see something like 12,000, 12,001, 12,002).  At the end of the data, row 10,000 the offset has increased to 126,000 ticks.

 

What I think is happening is one of the channels is using the same tick at the end of one buffer as the start of another.  Then, at the end instead of 2 sets of 10,000 points, it has one of 10,000 and one of 10,200 and then truncates it to return 2 sets of 10,000.

 

How can I stop this?

 

Thanks for reading, you guys have been life savers in the past.

Quadrature Encoders and NI-MAX

$
0
0

I am using the NI 6259 DAQ to read a quadrature encoder.  The datasheet for the 6259 states that any PFI designated channel can be used as a counter/timer; however, there are only two channels that seem to work.  When I set up one of the other PFI channels, the encoder read out on NI MAX changes from 0 to 36m, but nothing in between.  It appears to be set up exactly the same as with the two channels that work.  Any suggestions on what I could be missing?  Are not all PFI channels created equal?

Synchronize counter outputs with second one inverter from the first

$
0
0

I am using a NI USB-6363 and need to synchronize counter outputs with second one inverter from the first. This seems like a trivial thing for the powerful DAQMX libraries. I found a help file topic and forum thread content that give some hint it is possible but still the functions to use elude me.  Sorry for the cross post but only discovered this more specific forum after posting in LabVIEW general forum

The DAQ-Mx help under Counter Sychronization say "share the CO Counter Timebase and Start Trigger signal". I can't find an example of how to do this? Also, I need to have the second counter output (PFI1) be the inverse of the first counter output (PFI0). 

I found this forum thread https://forums.ni.com/t5/Counter-Timer/synchronize-two-counter-outputs-on-6071E-card/m-p/2772312#M12030
that says "Trigger one counter with the internal output of the other", but I am not clear on how to do that

Hardware connection between NI 9215 and 9361

$
0
0

Hello to all,

 

Please I have one question maybe it would appear a little bit "weird".

This my first real project with NI DaQmx.

I need to acquire voltage measurements Through NI 9215 (BNC), and using The NI 9361 counter, I should measure the frequency and the period of these measurements according the counting edge.

Here my first question is the hardware connection and the communication between the  NI 9215 and 9361, how can I wire the channels. I thought that through the NI MAX I can really manage that... but I seems to be not feasible..

 

Sorry, maybe this is trivial for most of you... but I am really stocked at this point.

Hope that someone could help..

Many thanks in advance..

Greetings...

 

Youkou..

 

 

PCI 6602 counter card: time lag between roll over and reset to zero?

$
0
0

Hi,

 

I was using PCI6602 to perform some photon counting task. As the 32-bit counter will roll over, it is able to count up to 2^32/80M = 53.68 seconds (when 80MHz timebase is used) before roll over. My question is, is there any preset time lag between the terminal count and the first count of the next round after roll over? Or it is still 12.5 ns? As shown in the attached pic where I measured the photon arrival time for 5~10 mins, it will be good if the lag after the 53.6870 could be known accurately. Any help will be appreciated!

 

 


how to stop Counter output when a condition mets from Digital or analog input in LV

$
0
0

I am using Daq Assistant to generate pulses on a counter to drive a stepper motor. Counter pulses are correct when using without while loop and setting the "samples" on the daq Assistant in advance.

        In contrast, when i want to stop the counter when a certain condition is met from checking analog/digital input. In this case the period is not consistent and not exact. for this i put the daq assistant inside a Timed Loop and modified the samples  to read to 1.HI/Lo time is 250us, Loop dt =500 , clock 1MHz selected on timed loop.

please see whether this approach is fine or suggest alternate one so that we can stop counter when a certain digital input becomes HI.

Thanks

synchronizing AI task with counter task

$
0
0

I have written a standalone script to try troubleshooting why I can't get a counter synchronized with an analog input task. After searching NI discussion boards and white papers I can't find much discussion on this, which is surprising.

 

So, how do I get a counter input synchronized in a general way to an analog input task? I say "in a general way" because it seems like many of the other discussion board posts are very specific to some hardware or measurement application and they usually are able to get by with some way of doing it that's specific to their setup. I want a labview/daqmx algorithm/implementation that I can utilize across multiple hardware systems, cdaq chassis with modules, PXI chassis, PXIe. We have a general purpose data acquisition script that will ^we want^ to run with all of the above technologies. So before I try to tackle a more general case, I just want to understand a specific case of Cdaq-9178 with 9402, 9234 cards.

 

I have two Daqmx tasks that will run in MAX fine, an analog input task with 1 voltage on the 9234 card. A 1 counter input measurement frequency on the 9402 digital card setup for implicitly sampled.

 

My frequency measurement could be slower than the sampling rate of the analog input or faster than the AI sample rate. It may be measuring anything from 10 Hz up to 50 kHz. I don't want to average out the speed either, I want to catch every incoming pulse. So, more or less, I cannot use sample clock based setup for the counter. I have to use an implicitly timed counter input.

 

This seems to indicate that if I use a trigger pulse to the start trigger of the AI task and the same trigger to the armed start trigger of the Counter task then they are in sync? Maybe I'm not understanding the hardware right but they are not sync'd up when I record data.

 

I test this out by connecting a frequency generator square wave to the 9234 AI task and the same square wave to the 9402 counter task. I then say (in labview) that the AI start trigger is cdaq PFI0 and the armed start trigger of the counter task is PFI0 as well (I’ve also used ai/start trigger as the terminal too). I start both tasks and both tasks work as expected; they don't begin acquiring data until I connect the start trigger to the PFI0 line, but when I plot the data the two tasks are not synchronized. The frequency channel is always delayed by different times, but .3 seconds seems to come up a lot as the delay on the frequency channel measurement. I change the frequency on the generator while recording data so the counter frequency channel should match up to when the pulses change on the voltage channel. See my attached diagram from Diadem showing what I get.

 

I plot the data in Diadem. The AI voltage is a waveform so has built in timestamps. I compute the time stamps for each sample of the frequency by timestamp = sum(1/freq samples). When I plot, they just aren't in sync.

Is the triggering not working the way I expect? Am I not thinking about the plotting the right way?

 

I can't imagine someone hasn't tried this before. This just seems like a common thing that test engineers would want to do - synchronize frequency data with AI data. I see this commonly done on other data acquisition systems from other manufacturers.

 

Thanks for any help. 

Adam

Cummins Inc.

Counting Edges and Frequency from the Same Measurement Device

$
0
0

Hi, I have a LED open collector tied to my gas meter that sends out pulses as my gas meter dial turns. I then convert the number of pulses into a gas reading. This gives me the total amount of gas that I have used, but I also need to measure the frequency of the pulses to determine a gas flow rate. I am running at a very low firing rate so my frequency from the open collector is very low (less than 1 Hz).

 

I am using a cDAQ-9178 with a NI-9401 module inserted into slot 8. The open collector sends pulses of 5VDC, and I am putting the 5V+ wire into terminal 14 and the 5V- wire into terminal 1. I am also counting pulses on a WattNode Pulse meter for my power draw. It sends out pulses of 5VDC, and  those wires are inserted into 16 (+) and 3 (-) of the 9401 module. If I only set up my code to count the number of pulses for each measuring device then everything works fine. Once I try and also measure the frequency of the open collector I run into issues.

 

I was initially trying to read my frequency from the same physical channel, but that didn't seem to work because the counter was first in line and hogging up the resources for the frequency signal. My next step was to daisy chain the signal from the open collector in terminals 14 and 1 to 17 and 4. After doing this I couldn't read a signal at all, edge counting or frequency. So now I am asking for guidance here. When I tried daisy chaining the wires I used ctrl0 & PFI0 for my counter and ctrl2 & PFI2 for my frequency measurement. 

Getting measurements after a digital input rising edge

$
0
0

Hello to all,

 

For my project I am trying to record a small amount of measurements

using a digital trigger.

At first I am using an analog module for the measurements, and I would like

that my software start recording (or maybe also acquiring), when a rising digital event occur, on a Terminal of a digital input Counter (here I am using here the NI 9361)

So, I programmed my Software basing on the Simulation devices on my cDAQ, and it seems to be working very well.

Then When I've changed the different controls on the front panel to those of the real project (you will find the different controls labelled in yellow)... The SW didn't work, or let me saying didn't display any measurement till the end of the iteration time.

 

Please if someone could help me, I 'll be very thankful. 

I am attaching below my VI.

 

 

 

 

 

Example of dynamic averaging for frequency measurment with NI 9361

$
0
0

Hi all,

 

I am playing around with a cdaq system wth a NI 9361 module. In the past I did my frequency measurements with an x-series board and used the sample clocked measurement method with an external signal which I generated on the board itself and used this to sync all my tasks together. I now have the problem that the 9361 does not seem to support signal generation and in fact only supports the dynamic averaging method. This would not be a problem but unfortunately I cannot find any examples on how to configure this mode properly. Does someone have a minimal working example on the functions involved? c/c++ would be nice, but I think a screenshot of an VI would also work.

 

Thanks!

Viewing all 1271 articles
Browse latest View live


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