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

Get counter port mapping

$
0
0

Hello.

I want to have a possibility to get the port and line number of the ports by a function in CVI.

So e.g. to know that counter 0 is port 2 line 4 and so on.

Thanks


Set non-periodical external sampling clock nidaqmx python package

$
0
0

Hello everyone ! I am new with the nidaqmx python package and acquisition measurement devices and have some problems to set a specific external sampling clock for the acquisition of data (NI cDAQ-9185 chassis with NI 9775 device). 

 

Until now, I have used the internal clock of my DAQ in order to configure the acquisition of the data for my three voltage channels and everything works without problem. In order to improve the setup, I tried to add on the 4-th channel a pulsed voltage signal with non-periodical behavior and try to define it as the new sampling clock for the data measurement. The goal is that the DAQ only acquires data on the three other channel when the 4-th channel detects a rising edge and stop after a certain number of data, which is known. The tricky part is that the pulsed signal begins when the script is launched and the number of pulses is known, but not the duration of the signal. For that, I used a simple python script like :

 

import nidaqmx sample_rate = #known_value num_data_points = #known_value with nidaqmx.Task() as task_1: #use voltage channel of acquisiton card task_1.ai_channels.add_ai_voltage_chan("cDAQ9185-1E47CA7Mod1/ai0") task_1.ai_channels.add_ai_voltage_chan("cDAQ9185-1E47CA7Mod1/ai1") task_1.ai_channels.add_ai_voltage_chan("cDAQ9185-1E47CA7Mod1/ai2") task_1.ai_channels.add_ai_voltage_chan("cDAQ9185-1E47CA7Mod1/ai3") task_1.timing.cfg_samp_clk_timing(sample_rate,source="cDAQ9185-1E47CA7Mod1/ai3", active_edge=nidaqmx.constants.Edge.RISING, sample_mode=nidaqmx.constants.AcquisitionType.FINITE, samps_per_chan=num_data_points) task_1.start()

 

Each time I run the script, I end up with an error like :

DaqError: Requested sample clock source is invalid. Property: DAQmx_SampClk_Src Corresponding Value: cDAQ9185-1E47CA7Mod1/ai3 Device: cDAQ9185-1E47CA7 Task Name: _unnamedTask<D> Status Code: -200414

 

I have also try to replace the task_1.timing.cfg_samp_clk_timing(...) function with :

task_1.timing.samp_clk_rate = 1e6 task_1.timing.samp_clk_active_edge = nidaqmx.constants.Edge.RISING task_1.timing.samp_timing_type = nidaqmx.constants.SampleTimingType.SAMPLE_CLOCK # 10388 task_1.timing.samp_clk_src="cDAQ9185-1E47CA7Mod1/ai3"

to define everything manually but end up with the same error.

 

But trying to look a bit in the documentation, I have found that it is normally possible to define a method like this one (using a specific pulsed signal as a sampling clock) but didn't find any answer for my problem. Does anybody have an idea if this method is possible and how to implement it in python ?

 

As I am new in the domain, it is clearly possible (a without contest probable) that I have made an error in the understanding of the package, or just miss something. So don't be afraid if something seem completely strange !

 

Thanks everybody for the future answer !

 

 - Adrien

external clock source(unequal frequency) problem

$
0
0

Hello, l have sampling problem which is using an unequal frequency clock source.

I made a vi that convert analog signal to digital signal. so I can use that digital signal for clock source.

If analog signal has an unequal frequency, the clock source will have same unequal frequency.   

So, using that unequal(variant) frequency source for sampling, the data could not have a equal dt (sampling)point.

but the result was data has a equal dt point. which is it doesn't work as real time sampling(single shot sampling).

I want real time sampling. can you tell me how? 

need help.

 

Thank you. image.pngimage.png

Counting non-TTL pulses

$
0
0

I'm need to count pulses having 2V amplitude, 15ns width (device spec sheet, pg2).  My DAQ board is similar to NI-6356. The NI 6356 spec sheet doesn't say what kind of signals it counts but I assume it's TTL. The 2V pulse amplitude I need to count is below TTL signal level I believe. Is it possible to count these pulses with the 6356? If not, what do I need?

Three tasks with high frequency with 2 counters methods, 50103 error

$
0
0

I will try to be simple:

 

We have one chassis 9189 with 8 modules, two of them are used to take frequency mesurements (9401), let's say module 6 and module 7.

 

I need mesuring frequency on three encoders, so I configured module 6 ctr 0/1 for frequency 1, module 6 ctr 2/3 for frequency 2, as i'm using 2 counters methods, in that case it works fine.

 

The problem is that when i added the third mesurement on module 7 ctr 0/1, i got 50103 error as the system considered the ctr 0/1 are reserved even it is on module 6.

 

What i should do in such configuration?

 

Thanks a lots

Frequency Measurement with NI-9361 not stable

$
0
0

Hello,

I am playing around with a cDAQ-9185 system with a NI-9361 to measure a 60kHz frequency signal.

 

But the read data abnormal occur periodic. I have tried to changed every parameters even the channel but not work.

 

As the attached picture show, the normal situation keep 13 sec and the  abnormal keep 18 sec.The waveforms changed periodically.

 

I have used the Gantner Instruments measured the signal with same sampling rate, the waveform were stable.

 

Can anybody tell me how to measure frequency with NI-9361 ?

Thanks!

Counter Output *only* on non-default line and *not* on the default line

$
0
0

Dear all,

 

I've read through many related posts. None have solved my problem. I am aware of the "lazy uncommit" issue of digital routing.

 

But my post is about something else (I think).

 

I use a USB-6211 and want to use e.g. PFI 6 for a counter output (Pulse Train), but the default line of e.g. ctr0 is PFI 4. No problem via Export signal. Works perfectly.

However, the Ctr0 Output will be still duplicate on the default line (PFI 4) . This is a problem as I have to use this particular line for another DO task.

 

1) Resetting or tristating PFI 4 doesn't work while the counter is still running

2) Stopping the counter, then resetting is no option, as PFI 4 is again reserved when the Counter is resumed

3) Starting to DO task on PFI 4 work, but it is overwritten without error by the Counter task once it launches.

 

So, how can I release PFI 4 while the counter keeps outputting over another line?

Ideas ? Thank you all in advance.

Frequency divider circuit for simultaion in LabView

$
0
0

I want to simulate a frequency divider that divides the input signal by 4. I am using a signal generator with a square wave output and feeding this as a clock to the D flip flop circuit (using logic gate). I don't know whether I am doing it right or not. Can you please help me with the frequency division circuit? to check whether the output signal frequency is divided 04 times to the input signal or not. It is urgent, kindly help in this simulation as I am new to Labview.


CO: Requested vs. actual frequency

$
0
0

Hi,

 

I am using a PCIe-6353 DAQ card and try to figure out what the 'allowed' frequencies are. I found some threads about it but I am not sure I understood everything correctly. This article comes pretty close:

https://knowledge.ni.com/KnowledgeArticleDetails?id=kA00Z000000P83OSAS&l=en-US

 

As far as I understand, the CO can only generate signals at multiples of its internal clock. For the PCIe-6353 that should be 100 MHz (I think; the datasheet has different values for "Sample clock timebase"), 10 ns respectively. So let's say I want to generate a clock at 140 kHz (period 7142.86 ns). With a time base of 10 ns, an integer no, of ticks is therefore not possible. Following the linked article, the device will actually output the closest frequency that can be represented by an integer No. of ticks. In this case 139.86 kHz or 140.056 kHz, depending if one rounds up or down.

 

My question is:

1)  Did I understand it correctly?

2) The article above says one can use the DAQmx timing property node "SampleClk.Rate" to read the actual frequency. WHen I do that with a simulated device, I get exactly 140 kHz, which should not be (see above). Is that because of the simulated device?

3) Isn't it better to calculate the allowed frequency myself and use this as input? This way I know exactly what is actually happening. imagine I have another external device but can only synchronize the start, not the clocks itself.  In that case it will make a difference if I set the NI card to 140 kHz (running at 140.056 kHz) and the other device running at exactly 140 kHz. If i would just set it to a value that can actually followed exactly, the synchronization should be better - assuming the other device can actually run at exactly 140 kHz)

 

Thank you

External Clock for DAQmx Sampling when using Sigma Delta ADCs

$
0
0

 

As stated in PXIe-4302 User Manual (NI Document 377003a):

External Clock
The NI PXIe-4302/4303 ADCs cannot be clocked from external sources such as encoders or
tachometers. However, signal processing features in the Sound and Vibration Measurement
Suite often provide an excellent alternative to external clocking in encoder and tachometer
applications. Visit ni.com/soundandvibration for more information about the Sound and
Vibration Measurement Suite.

 

Is this true of all Sigma Delta ADCs?

 

If this is true, are there any other hardware methods one can use have an encoder be the external clock the AI sampling?

Counters Terminals on PXIe-6341

Count rising edges of counter with Python

$
0
0

Hey there,

 

I am trying to count the rising edges of an internal timer of our USB-6366 (X-Series) device with Python via nidaqmx.

I found the following example to do that in the git repository ni/nidaqmx-python:

https://github.com/ni/nidaqmx-python/blob/master/nidaqmx_examples/ci_count_edges.py

 

This example doesn't work for me. I am always getting 0 as the count.

Therefore I tried these lines of code:

 

with nidaqmx.Task() as task:

     task.ci_channels.add_ci_count_edges_chan("Dev1/ctr0")
     task.timimng.cfg_samp_clk_timing(10000000, "10MHzRefClock")

     task.start()

     print("data:", task.read(1000))

 

I really don't have a clue if that's the right approach, but it makes (at least a little bit) sense to me.

If there are any better solutions, I will appreciate some hints!

 

Please keep in mind, that my program should be as simple as it sounds: just counting.

 

 

Thanks in advance. 🙂

NI USB-6001 Counting Edges to Pulse Time

$
0
0

Hi all,

 

I made a counter with NI USB 6001 as following:

kellytran_1-1602259740611.png

 

From counting edges, I can get the frequency.

Is there any way I can get PW (Pulse Width) or Duty Cycle from counting edges or from this device?

 

 

Thank you.

计数

$
0
0

请问如何实现每隔5秒内有FTFTFT若干个计数为1然后跳转到其它事件

Changing hardware from PCI 6603 to CDAQ 9361

$
0
0

I currently have a LabVIEW application using PCI 6602 counters. I want to change the hardware and start using cDAQ 9361 and replace PCI 6602.

Do I need to keep anything in mind while doing this conversion or is it as easy as just changing aliases in LabVIEW.

 

Any feedback is appreciated.


Reading encoder data and determining the RPM

$
0
0

Hi,

 

I am Abbishek and I am a graduate student in the Department of Aerospace Engineering in Auburn University. I am using a stepper motor to rotate a shaft and a rotary encoder to measure the position of the shaft and hence determine the RPM. The encoder I am using is a quadrature encoder (REV-11-1271). Initially, I was using the "Measure Angular Position - modKP.vi" program to get the position of the shaft from the encoder and then determine the RPM of the shaft from that. The DAQ system I am using is the NI-6218. When I run the program and use the X4 decoding, I observed a lot of fluctuations. So, I used an X1 decoding, and the fluctuations reduced a bit. But I observed something peculiar in the RPM measurement. It was seen that the fluctuations about the mean RPM were always about 0.3 RPM, irrespective of the motor rotation rate, the acquisition rate or the microstepping. To check further, I changed the program and used the other VI which has been uploaded here. In that VI, I counted the edges over 1 second to determine the frequency of the pulses and got the RPM from there (our encoder has 2048 pulses per revolution). But, there I observed that the encoder is outputting varying frequencies due to which the RPM is varying as well.

 

I wanted to know that why am I getting this kind of fluctuations (only 0.3 RPM magnitude). Does it have something to do with the acquisition parameters or how we are acquiring the data? Please help me out with this issue.

 

Thank you

 

Regards,

 

Abbishek

Synchonisation of multipe different I/O modules inside a CompactDAQ Chassis

$
0
0

Hello,

 

I´m currently using various different I/O-modules (e.g. NI9229, NI9203) inside the cDAQ-9184 chassis.

For setting it up and creating tasks im using the NI MAX software. These tasks are then used in DASYLab 13.0.

 

The problem im experiencing is a constant time delay between signals from different I/O-modules. No matter what sample-rate type I´m using, there seems to be an issue with the synronisation between those modules. From my understandings, the chassis should synchronise the modules via internal clocks but with different tests I got a constant delay of 1.6ms between the same rising or falling edge, measured from different I/O-modules at the same time.

 

Is there something I got wrong or should the chassis indeed synchonise the signals on its own?

 

Thanks in advance!

T.Meyer

Signal detection in NI9411

$
0
0

I do have a NI9411 device connected in CDaq 9174. It is wired with an encoder. The signal detection was good at first and all pulses were picked up. Just until few days back there are no pulses being picked up. I tried monitor the pulses in NI Max. Nothing is detected. I tried again with a simple proximity sensor to see if any pulses are being picked up. Still no pulses in all counter inputs. Is it possible the device is damaged? The device is detected in NI Max, and the self test and self calibration are successful. Is there any other way I could test the device.

Confused about CO Pulse output.

$
0
0

I'm converting a Traditional DAQ application that used "Single Triggered Pulse Generation".  It seems like the appropriate DAQmx solution is to use a "CO Pulse Ticks" task.

 

I'm using a PXIe-6614 board, and have a signal wired to Counter 1 Source (PFI35 on the 6614).  When I see the second pulse on the Source, I want to generate a single pulse on the Counter 1 Output.  Here's what I wrote:

 

Simple CO.png

 

(Ignore the fact that I am stopping immediately after starting; this is just a test VI.)

 

When I run this, I get the following error. I'm not sure what to do with it.

 

Screen Shot 2020-11-06 at 10.29.31 AM.png

 

Any advice?

Need to control 4 counters using cDAQ-9189 and NI-9401

$
0
0

I really just need some help to know where to start.  This is my first time using cDAQ hardware.

 

My application requires 4 counter pulse outputs.  Lets call them W, X, Y, Z.  These will map to the 9401 W=PFI3, X=PFI7, Y=PFI1, Z=PFI5 CTR OUT pins.

 

These outputs will serve as triggers for 4 independent light sources.  The sources require precision sync.  They will have a period of 100ms.  The pulses that trigger the source must be 50ns wide for the test case.

 

I create 4 DAQmx vchans, Led_W, Led_X, Led_Y, and Led_Z.

 

I create 4 Tasks, T_Led_W,  T_Led_X, T_Led_Y, and T_Led_Z.

 

I want the application to be able to produce a pulse train on any one or 2 of the trigger lines.

 

For one line it is easy, just configure T_Led_W, and let it go.

 

The Problem is that I need to generate pulses synchronized to the nanosecond on 2 triggers at the same time, for example, W and X.  

 

I cant use Channel Expansion, because when I do that, the two tasks start a few microseconds apart.  

 

I only have 4 counters on this chassis, so I cant use another counter to start the tasks on an edge.

 

I might be able to do something with Time based triggering, that actually worked. I was able to create a task with outputs W and X, and setup a time trigger, and I can get W and X to output 50ns wide pulses  every 100ms syncd exactly.

 

This kind of stuff might work for me, but really what i want to do is  produce the following output where every letter in the sequence below happens at an exact 100ms time, producing a 50ns wide pulse:

 

W, W, W, W, W, W, W, WX, WX, WX, WX, X, X, X, X, XY, XY, XY, XY...

 

Without the availability of of a 5th counter to keep track of the 100ms tick, I don't see how time triggering will help.

 

Is this possible with the hardware I have to work with?

 

Viewing all 1243 articles
Browse latest View live


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