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

My LED blink 3 times before entering while loop??

$
0
0

Hi all

 

I want to be able to simply PWM my LED. So I created this VI. But it blinks 3 times before entering the loop, and it's like no matter what I do it insists on running 3 times the freequency with the given duty cycle on the channel creat VI before it continues. What do I miss??

 

Thank you.

 

 

dytbaat_0-1614244592963.png

 


NI 9361 Counter Input Duty Cycle Spikes

$
0
0

Hello all,

Currently I am facing an issue when measuring the PWM Duty Cycle of my signal input to my NI 9361 module.

The issue can be seen in the attached image Spikes in PWM Duty Cycle.


PWM Frequency (ctr6) and Duty Cycle (ctr7) are measured in the same task with virtual channels "PWM_Frequency" and "PWM_DC" respectively.

 

I was getting more or less the same spikes on PWM Frequency, but it was resolved when I applied the Min Pulse Width digital filter for PWM Frequency measurement. It can be seen in the below Spikes in PWM Duty Cycle image that I don't get any spikes in the PWM Freq waveform.

When I try to apply the Duty Cycle digital filter for the "PWM_DC" channel as shown in the image PWM Duty Cycle Digital Filter (Disabled) then I get error from DAQmx that this filter is not applicable for the channel "PWM_Frequency".

Is it possible to apply both Frequency digital filter and Duty Cycle digital filter in the same DAQmx task?
Why do I get error even when I apply digital filter for both virtual channels separately?

 

Any lead would be really helpful.

Thanks!
Rahul

 

 

 

Frequency measurement accuracy for NI-PCIe6351

$
0
0

Hello,

I have a problem with a frequency measurement accuracy of an 8MHz signal, using internal base clock, measurement is made using the counter section of a NI-PCIe6351 card. Frequency measurement acceptance limits are 8MHz +/-25ppm.

I am suspecting a problem with measurement accuracy due to internal base clock accuracy which device specifications indicates that is 50ppm.

I am looking for a formula to calculate absolute accuracy for frequency measurement, something similar with analog output accuracy equation described  on device specification document. Considering how well is documented accuracy calculation for the analog measurement / generation section, I was surprised to see how little official information is available in the same document regarding accuracy calculation for frequency measurement / generation using counters, in respect.

Any information on this topic would be appreciated. Thank you !

USB 6210 Frequency Measurement with DAQ Express

$
0
0

Hello,

 

I'm sorry for the dumb questions, but here goes anyway.  I am trying to measure wire-feed speed by measuring frequency of an encoder which is connected to a roll in contact with the wire.  Ultimately I want to compare different wire-feed mechanisms based on these speed measurements.  After a few initial tests I was shocked to see how much the measured speed varies.  There are variations due to mechanical inacuracies and probably the measurements are realistic, I just wasn't expecting to see such a jittery graph under no-load conditions.  The test mechanism has a PMDC motor driven in closed loop speed control.  The encoder on the roller offers 1024 cpr and varies in rotational speed up to 300 rpm.

 

After reading these two threads https://forums.ni.com/t5/LabVIEW/Reading-encoder-data/m-p/4094609/highlight/true#M1179300  https://forums.ni.com/t5/Counter-Timer/Reading-encoder-data-and-determining-the-RPM/td-p/4096116  I thought I should check my sample rate and timebase.  Can I do this with DAQ express?  I only see the loop cycle time as an input for sample rate.  The lowest possible input here is 1 ms which I believe is 1000 counts per second, right?  Can I adjust the timebase?

 

I guess I'm just looking for a reality check.  Performing the test from the other thread, I drove the roll at 5 rpm and measured a maximum deviation from average +/- 30%. This is pretty slow for the motor, so I also tried at 50 rpm which resulted in +/- 32% maximum deviation from average.  Both were using 10ms loop cycle, or 100 samples per second.

 

Thanks

Changing Duty Cycle from a PID controller output

$
0
0

Hello everyone,

 

My goal is to be able to change the duty cycle of a PWM signal using the output from a PID controller.

 

I am working with this example provided by NI:

Change Duty Cycle on a Continuous Pulse Train of NI-DAQmx Task 

questiond.png

 

This example works as was intended, I am able to change the duty cycle from the front panel. The problems begin when I substitute the Duty Cycle Control for the output of the PID controller. 

 

How can I adapt this code so that the Duty Cycle is changed according to the PID output instead of the Duty Cycle Control as it is now? My guess is that the problem lies with the Event Cases. I have tried changing the Duty Cycle Control to an indicator and wiring it to the PID output and then that to the input at Create Channel vi but no success.

 

Thanks,

Junekers

Use of counter NI 6612 to count no. of pulses per second

$
0
0

Hi,

I am using an MCP detector which detects molecular ions. For each ion falling on the detector it generates a bunch of electrons by its mechanism. Due to that it generates pulses which goes as input of a constant fraction discriminator with pulse amplifier. This pulse amplifier gives me LVTTL signal as output. Each pulse in this LVTTL signal corresponds to one electron. My aim is to count the LVTTL pulses that occur per second which will let me know the number of electrons collected on an anode plate per second.

I have PCIe-6612 and PCIe-6323 with BNC-2121 and BNC-2090A terminal block. Is it possible to use any of these two as my counter which will show me the counts/sec, that means counts will be reset after showing the value at every second. Finally I want to take those values of counts/sec to plot a graph. If it's possible please explain the hardware connections and shortly the steps of LabVIEW code also.

I am a new user of LabVIEW and trying to learn it. After reading the manuals of PCIe-6612 and BNC-2121, I connected the LVTTL signal to the source (pfi-39) of counter zero, and tried edge count. Counter couldn't detect the input signal and so it didn't start to count. One thing I noticed that counter zero can detect this input signal if I connect it to pfi-37 (counter 0 aux) then it starts counting. Could anyone please clarify this. I am using LabVIEW 2018 version.

Thanking you in advance.

Calculate the derivative of a function over time

$
0
0

Hello guys ! 

 

Sorry If I don't write well, It is my first question to the community.. and I am a newbie- Labview user.(neither a good enlish speaker 🤐)

 

I need for an universitary projet to calculate the derivative dY of a function as shown with the picture attached: dY

My calculation is very simple : dY=Y(t)-Y(t-dt).

 

I also have attached the Vi I created to do it.

It works well when it is the only Vi I call , but when I use it as a Sub-Vi  in a projet ...and you may know here is my issue ..

It stays in the while loop (that is kind obsious since I need to call it to stop😅)

 

I have first thought that I could create some kind of boolean waveform whom  stops the while-loop  every Tcycle, but I am afraid the data would not be saved in the appened array...

 

Here is my question : How can I simply get this derivative, with a Sub-Vi callable, from a big projet-vi  and maybe without using a while-loop?

 

 

I have also looked at other community questions, and a Timer-loop may be the solution, but I have never used it before.. 

 

 

Regards 😊

Victorin 

ConnectTerminals problem

$
0
0

Hello,

 

I have a NI DAQmx USB 6343mx

 

I use 3 counters with a CreatePulseChannelFrequency to create 3 PWM signals using ctr0, ctr1 and ctr2.  I create them in 1 Task, did it also in 3 different Task with the same result.

Counter 1 runs on 1000 HZ, counter 2 on 500 Hz and counter 3 on 250 HZ.

Works perfectly. With a logic analyzer i see the outputs on PFI12 (pin 89), PFI13 (pin 91) and on PFI14 (pin 93).

 

Then i want to connect the 3 PFI terminals to some other PFI terminals.

 

What i see is that the ConnectTerminals method works for PFI12 (ctr0) and for PFI14 (ctr2) but never for PFI13 (ctr1), i really dont know anymore what to do. I dont get errors just the PWM signal on PFI13 doesnt appear on the connected terminals PFI2 and PFI3

Any help would be kind.

 

My code below.

 

 

task = new Task("");
task.COChannels.CreatePulseChannelFrequency($"/Dev1/ctr0", "", COPulseFrequencyUnits.Hertz, COPulseIdleState.Low, 0, 1000, 50 / 100.0);
dtask.COChannels.CreatePulseChannelFrequency($"/Dev1/ctr1", "", COPulseFrequencyUnits.Hertz, COPulseIdleState.Low, 0, 500, 50 / 100.0);
task.COChannels.CreatePulseChannelFrequency($"/Dev1/ctr2", "", COPulseFrequencyUnits.Hertz, COPulseIdleState.Low, 0, 250, 50 / 100.0);
task.Timing.ReferenceClockSource = "OnboardClock";
task.Timing.ConfigureSampleClock("OnboardClock", 1000, SampleClockActiveEdge.Rising, SampleQuantityMode.ContinuousSamples);
task.Timing.ConfigureImplicit(NationalInstruments.DAQmx.SampleQuantityMode.ContinuousSamples, 1000);
digpwm1.Start();

 

DaqSystem.Local.ConnectTerminals($"/Dev1/pfi12", $"/Dev1/pfi0");
DaqSystem.Local.ConnectTerminals($"/Dev1/pfi12", $"/Dev1/pfi1");

DaqSystem.Local.ConnectTerminals($"/Dev1/pfi13", $"/Dev1/pfi2");
DaqSystem.Local.ConnectTerminals($"/Dev1/pfi13", $"/Dev1/pfi3");

DaqSystem.Local.ConnectTerminals($"/Dev1/pfi14", $"/Dev1/pfi4");
DaqSystem.Local.ConnectTerminals($"/Dev1/pfi14", $"/Dev1/pfi5");

 

VeH_0-1616066403804.png

 

 

Regards,

 Herbert Veldhuis


Counter Wiring

$
0
0

Hello,

 

I am not sure if I am using the right pins for counter.

 

I read a similar post (https://forums.ni.com/t5/Counter-Timer/Wiring-PXI-6624/m-p/855482#M7163) posted by another user, that helped me to understand but still I am not fully sure. So I am posting my issue below.

 

I want to measure the pulses produced by a Hall sensor.

The following connection diagram is the method by which we have wired the NI PXI6624 card via SCB-100 box. I want to know if this method is correct.

I am using CTR 0 Source+ and CTR 0 Source- as signal input points but not sure if we need to connect some trigger on CTR Gate , CTR AUX .... 

Manohar_Reddy_0-1616521743284.png

 

As per the datasheet:

Manohar_Reddy_1-1616521743297.png

 

 

We have used the reference of the following diagram/ method from the user manual of 6624 card.

Manohar_Reddy_2-1616521743304.png

 

Sensor specifications are as shown below:

Manohar_Reddy_3-1616521743322.png

 

Please let us know if the signal connections are done correctly. As per Fig 1.

 

Trouble with Counter Arduino isnt receiving data from LabView

$
0
0

Hello everybody, I am new to forum and ive been starting using labview for about a month (lol), and today made a reverse counter that woul send a number 1, to my arduino uno, when counter reached 0 or less, but for some reason it seems that labview isnt sending any data to it, the Rx led never lights up, and the outputs are for a buzzer and a led. I was searching through web, but nothing seems to match my problem, and the "similar" ones are way too complex compared to my problem, so i maybe did something wrong in the labview code or arduino, can you help me verifying it? Thanks.

Maximum clock frequency cRIO 9022

$
0
0

I recently wanted to read data from an SSI absolute encoder on a cRIO 9022 with NI9403 card. It turns out that I can only generate the clock signal at 12 kHz and the processor on cRIO is 40 MHz. Am I doing something wrong, or is there such a limit to the signal generated?

Configuring pulse output to trigger counter using C++

$
0
0

Nevermind!

 

Edit: how do I delete the thread =p

How do I using NI-9403 for quadrature decoder circuit?

$
0
0

Hi, all
Using 74HCT193, I get the required number of bits and reset on the z input, from some limit switches or from a digital output from the NI 9403, where the parallel lines from the counter go into digital inputs on the 9403. Is it possible to connect them to make a quadrature decoder circuit?

Anyone have ideas of it? I’m fairly new in all of this, so if possible a simple explanation would be nice. Thank u🙂

Arm Start Trigger for buffered events counting PCI 6602

$
0
0

Hello,

 

I am using a NI-6602 card and I am using 2 counters input channels to perform buffered event counting on each counter. The signals are TTL pulses arising from photon detectors.


Everything works fine except that the two counters do not start at the same time. And it is essential for my application that they do.

 

I tried to use the Arm Start Trigger property but it does not work. In a bit more details, here is what I did (in C#) :

 

// Sample Clock
myTaskSampleClock = new Task();
myTaskSampleClock.COChannels.CreatePulseChannelFrequency("Dev1/ctr3", "", COPulseFrequencyUnits.Hertz, idleState, 0.0, sampleClockFrequency, sampleClockDutyCycle);
myTaskSampleClock.Timing.ConfigureImplicit(SampleQuantityMode.ContinuousSamples, 1000);
myTaskSampleClock.Start();


// Counter 1
counterReadTask1 = new Task();
counterReadTask1.CIChannels.CreateCountEdgesChannel("Dev1/ctr1","", edgeType, initialCountValue, countDirection);
counterReadTask1.Timing.ConfigureSampleClock("/Dev1/PFI24", sampleClockFrequency, SampleClockActiveEdge.Rising, SampleQuantityMode.FiniteSamples, sampleClockFrequency);

counterReadTask1.Triggers.ArmStartTrigger.ConfigureDigitalEdgeTrigger("/Dev1/PFI0", DigitalEdgeArmStartTriggerEdge.Rising);

myCounterReader1 = new CounterReader(counterReadTask1.Stream)
myCounterReader1.BeginReadMultiSampleInt32(sampleClockFrequency, myCallBack1, counterReadTask1);

 

// Counter 2
counterReadTask2 = new Task();
counterReadTask2.CIChannels.CreateCountEdgesChannel("Dev1/ctr0", "", edgeType, initialCountValue, countDirection);
counterReadTask2.Timing.ConfigureSampleClock("/Dev1/PFI24", sampleClockFrequency, SampleClockActiveEdge.Rising, SampleQuantityMode.FiniteSamples, sampleClockFrequency);

counterReadTask2.Triggers.ArmStartTrigger.ConfigureDigitalEdgeTrigger("/Dev1/PFI0", DigitalEdgeArmStartTriggerEdge.Falling);

myCounterReader2 = new CounterReader(counterReadTask2.Stream);
myCounterReader2.BeginReadMultiSampleInt32(sampleClockFrequency, myCallBack2, counterReadTask2);


// Trigger task
Task triggerTask = new Task();
triggerTask.DOChannels.CreateChannel("/Dev1/port0/line0", "", ChannelLineGrouping.OneChannelForEachLine);

DigitalSingleChannelWriter StartTriggerWriter = new DigitalSingleChannelWriter(triggerTask.Stream);
triggerTask.Control(TaskAction.Verify);

 

// Write the digital edge
StartTriggerWriter.WriteSingleSampleSingleLine(true, false);
StartTriggerWriter.WriteSingleSampleSingleLine(true, true);
StartTriggerWriter.WriteSingleSampleSingleLine(true, false);

 

In words :
I define and set up my sample clock (used by the 2 counters)
Then I create my 2 readers and set up their ArmStartTrigger properties.
Finally, I define my arm trigger as a DOChannel and write an edge that should start both readers.

 

But this is not working. I get a timeout error saying that samples haven't been acquiered (er -200284), so it looks like the trigger is never activated. I looked at many forums but didn't find a solution in C#. Do you have any idea why it's not working ?

 

Any help would be very appreciated !

 

Thanks,

Add date and time stamp to continuously streaming data

$
0
0

Hi all,

 

I am new to the LabView Environment and I am trying to setup a program to perform the following:

1. Prompt users to select an experiment 

2. Display prompt messages to guide the users through an experiment

3. Collect Data from NI-DAQ in continuous mode.

 

I have completed task 1 and 2 but for task 3, I want to add time stamp adjacent to each data acquired. But I have not been able to do so. Please suggests what changes can I make to the attached VI to achieve my goals. 

 

PS: Any suggestions on making the VI better would be highly appreciated.

 

Thanks 

 


PCI-6601 - Shows no options in NI MAX

$
0
0

I have a PCI-6601 card connected over PCI. I've been battling trying to get it to work with some C# code for days now. I know I have the DaqMx drivers installed, along with NI Max, Labview and what else. However despite that, whenever trying to connect I get a DaqMx exception.

 

I've tried reconfiguring the database in NI MAX, and other common debugging methods. Part of me is now just wondering if I have defunct hardware.

 

When I see my PCI-6601 in the devices list in NI Max, there is no name and no ability to edit the name. 

Comparing to what I see here: https://www.ni.com/getting-started/set-up-hardware/data-acquisition/pci-pxi it seems like I do not have the same control.

Its a single pane, with a blank uneditable name field. Is this normal operation for this card?

 

Is there anything I can do? I have all the drivers as well I believe.

NI 9361 Pulse Width (FIFO Overflow)

$
0
0

Hello Everyone!

So I am trying to to measure Duty cycle of an incoming pulse train! I do that in LabView FPGA module (cRIO 9045) and the indicators on the front panel seem to indicate that the code is fine. However, I want to transfer each measurement to the real-time VI and display it on a graph. The problem I am running into is that the FIFO on the FPGA end overflows almost instantly when I run the code. I was able to get the code to display another set of measurement (from an ADC) on the real-time VI (transferred from the FPGA VI), but I cannot get this particular measurement to work. I have tried increasing the buffer size but it still overflows. Below is a picture of the code!

 

Chnkv_0-1619292574114.png

 

Frequency measurement

$
0
0

Hi all,

For a PCBA test fixture, I 'm looking for a solution to measure a clock frequency (XX Mhz).

I would like a standalone board connected to the PC via USB or ETH.

 

Thanks in advance for your help

 

PCI6034E with BNC-2110 trigger voltage

$
0
0

Hi,

 

I am working on using the PCI-6034E with BNC-2110 to count the number of pulses within a given period of time. the input pulse has 5V amplitude and ~20ns width. However, for each pulse, there were some tail signals with around 1V amplitude. Will the till signals also be counted? If yes, is it possible to set the trigger voltage of the counter? Any help will be greatly appreciated.

 

Thanks,

Sound Input and Sound Output with cRIO-9076 modules NI9234 and NI9263

$
0
0

Hello Labview Community,

i would like to make simple VI for the cRIO-9076 modules NI9234 and NI9263, which outputs an MLS signal, records the sound signal and then determines the impulse response using a cross-correlation.

In the attached LabVIEW VI this is easily implemented with the Sound Output VI and the Sound Input VI in LabVIEW Version 18.
Now I want to implement exactly the same output and input of the signal with the cRIO-9076 and the plugged-in modules NI9234 for microphone analog input and NI9263 for loudspeaker analog output (just replace the usb mikrofon and loudspeaker from Sound Input and Output Express VI)
Is there a simple way to implement this (with a time-controlled loop structure) in LabVIEW without FPGA, so that my sampling rate still remains 44100 Hz and the recording time of the microphone is 8.916 seconds?
Every attempt with the time-controlled loop runs way too quickly that no signal is output at the loudspeaker.

Many thanks for your help in advance!

Best regards
Takaroo

Viewing all 1252 articles
Browse latest View live


Latest Images

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