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

DMA Performance Improvements for TIO-based Devices


synchronize two counter outputs on 6071E card

$
0
0

Well, it's the usual how do I synchronize two counters problem.

 

I'm using the 6071E with DAQmx .NET 4.0. I define a Task and attach to it two counter output channels with implicit timing and zero initial delay . When running the program

I catch the first edge with a scope single trigger. There is always a delay between the first edge of ctr0 and the first edge of ctr1 of 16.3 microsecs. Is there a way, besides setting the initial delay of ctr0 to 16.3 microsecs, to make the counters to always start together? what is the source of the delay(software/hardware) and should it always stay constant.

 

any help is welcome

Two pulses with a delay lower than 1ms between them

$
0
0

I've been trying to setup a couple of programmes that will operate a fuel injector and a ccd camera for a university project.

 

Firstly, I need a programme that will generate two pulses of different width (I should be able to control the width) and a delay between them, ideally 1ms long.Both of the pulses will be generated by the same counter.I tried the simple solution of copying the existing vi I had for a single pulse (where I could control width and frequency of the pulse) and adding a wait function in between but I couldn't get the delay to go under 20ms.I have attached this attempt below (it's the ''Double Injection'' case).

 

Secondly, I need to create another programme -that I reckon will be very similar to the previous one- where I will generate two pulses (one for the injection and one for the camera), from two different counters,  but the delay needs to be even lower, around 70 microseconds and very accurate. I don't know the specific specs of the computer, other than that the OS is W7. The DAQ card is a NI PCI 6071E connected to a terminal which in turn triggers a solenoid box that sends the voltage to the injector.

 

I should note that in order to measure the delay I used an oscilloscope. Thanks in advance for any ideas and suggestions.

Changing the value setpoint at every 50s using elapsed time express

$
0
0

Hi. I am developing a tank level control system program using Neural Network based controller and trying to compare with PID based controller. I need to do experiment to compare results of these two controllers. In order to do that, I need to developed a scenario of changing the value of setpoint at every 50s. For example:

 

when t >= 50s    , Setpoint = 5

           t >= 100s  , Setpoint = 4

           t >= 150s  , Setpoint = 6

           t >= 200s  , Setpoint = 0

 

Can I use the Elapsed Time Express to execute this and how? I know that PID have the Setpoint Profile that can execute this, but for the Neural Network Controller can this be done using the Elapsed Time Express?

 

Thank you.

Retriggerable buffered counting edge task

$
0
0

Dear all,

 

I have been working on "Retriggerable buffered counting edge task" on a single counter input channel, let me describe what I want to achieve:

 

Create a CI to count finite rising edges with external sample clock (eg. Dev1/di/SampleClock) at certain sampling rate, and set CI.edge.Term at one PFI which is hardwired to another digital input channel. Furthermore, I'd like to set "retriggerable start trigger" to this CI by another PFI line.

 

It turns out that I can only set "arm start trigger" on this counter input channel, instead of "start trigger" since the error of 200452: attribute not supported in task context showed up at configuring digital edge start trigger. It seems that I can only set "retriggerable start trigger" on counter output task, and use two counters to achieve above, but I was wondering if there is a way to accomplish by single counter. Any suggestion is highly appreciated.

 

Duty Cycle Measuring with a 6211

$
0
0

I seem to be having a bit of an issue reading a duty cycle from a rotational sensor. The sensor that I am attempting to read from is putting out a 3.5% duty cycle, TTL wave of 0-5, at rest. The sensor can travel to almost 100% duty.

 

When I connect a function generator  (set to 3.5% and 0-5 TTL) to my USB 6211, the vi has no issues and will read the generated wave perfectly. When I connect the sensor to the USB 6211 the vi will read it correctly 80% of the time, but then all of a sudden it will throw out values much higher (i.e. 25% or 60%).

 

My first instinct was to assume that the sensor had an issue so I hooked it up to an O-scope, but it reads perfectly on the O-scope 100% of the time.

 

I have tried many of the example vi's online and in the help section of LV. I have included my VI, hopefully someone can see what I am doing incorrectly.

signal level for pulse width measurement

$
0
0

Hello,

I am measuring the pulse width with the M6251 by counter (CI Pulse Width)

CI-Pulse Width.png

 

I understand that the digital input is working on TTL levels (0,8V low 2,4V high).

Can it be exactly said at which signal level the pulse width is measured?

 

Thanks,

Ralf

buffered counter output in C

$
0
0

Hi everyone,

 

I am looking for a possibility to generate a finite buffered counter output with varying pulse widths, using the X-Series. I am working in C / Python.

 

I want to output two pulses triggered to an external signal. The first pulse should be short, the second pulse long. 

 

The following code outputs only two identical pulses. How can I modify it to output two different pulses?

 

CreateCOPulseChanTicks(channel,"","100MhzTimebase",DAQmx_Val_Low,0,300,300)

CfgImplicitTiming(DAQmx_Val_FiniteSamps,2) #output two pulses
CfgDigEdgeStartTrig(src,DAQmx_Val_Falling) #external signal
SetStartTrigRetriggerable(True) #retrigger

 

Best Regards,

Stefan


Interrupts mode failure for counters on 6624

$
0
0

Hi everyone, 

I'm facing a problem with a counter board PCI-6624.

I have 5 flowmeters inputs in quadrature.

3 of them are in DMA and 2 in Interrupts mode for the edge count DAQmx read function. (6624 doesn't allow more DAM channels, and I cannot use multichannel task for counters)

After a while, we have the interrupts channels freezing and sending the last acquired data, but no error is displayed. The other channels are still working well.

I have tried to change the position of my DMA and Interrupts channels. It is always the Interrupts channels that freeze.

 

DAQmx v9.8

LV 2010

 

Do you have any idea or a solution.

Kind regards to all the NI community.

Interupts problem.png

RPM measurement

$
0
0

I want to measure RPM using 8-pin rotary encoder using PXI-6221. I am able to measure angular position but RPM is fluctuating.

DAQmxReadCounterF64() timeouts blocking program runtime

$
0
0

Hi,

 

 

I have a PCI-7342 board connected to a MID-7652 box that is being used to control a servo motor on a rotary axis with an encoder. I also have a PCIe-6323 board that is used to read a quadrature linear encoder on the counter using DAQmx and I am programming in C. As the axis rotates, it passes breakpoints and sends a trigger signal in order for the counter to latch a reading from the quadrature encoder.

 

The DAQmx is set up using the following functions:

     DAQmxCreateTask(, &thHandle);

     DAQmxCreateCILinEncoderChan(thHandle, "Dev1/ctr0", , , , , , , , , );

     DAQmxCfgSampClkTiming(thHandle, "/Dev1/PFI0", , , , );

     DAQmxStartTask(thHandle);

 

This sets up the counter to be latched every time a signal arrives at the PFI0 terminal. I have connected the breakpoint output from the MID-7652 box to PFI0.

 

 

The rotary axis is configured with modulo breakpoints using the following functions:

     flex_configure_breakpoint(, , NIMC_MODULO_BREAKPOINT, NIMC_RESET_BREAKPOINT, );

     flex_load_bp_modulus(, , 250, );

     flex_load_pos_bp(, , 0, );

     flex_enable_breakpoint(, , NIMC_TRUE);

 

Due to modulo breakpoints, I have to call flex_enable_breakpoint(, , NIMC_TRUE); every time a breakpoint occurs in order for the next breakpoint to be able to trigger.

 

 

 

The problem I have lies in the next stage. I want to call the read function which will wait for incoming trigger on PFI0. So I call the function:

     DAQmxReadCounterF64(thHandle, -1, dTimeOut, , , , );

 

Next in my code I start the motion of the rotary axis

     flex_start(, , );

     do

     {

          flex_read_axis_status_rtn(, , &usAxisStatus);

          usBPStatus = !((usAxisStatus & NIMC_POS_BREAKPOINT_BIT)==0);

          if (usBPStatus)
          {

               flex_enable_breakpoint(, , NIMC_TRUE);

          {

     } while ( !(usAxisStatus & (NIMC_MOVE_COMPLETE_BIT | NIMC_AXIS_OFF_BIT )));

 

But this line is never reached because the DAQmxReadCounterF64() function keeps waiting for an input at the PFI0 terminal and blocks the program from running and times out, returning an error.

 

I have tried rearranging the order of the functions by calling flex_start(); first and then DAQmxReadCounterF64() before the do-while loop.

The problem with this method is that the DAQmxReadCounterF64() function blocks the runtime and so the second breakpoint is never enabled. The function again times out and returns an error.

 

 

I don't want to set it to indefinite or my program will wait forever and not do anything. Is there a way around the DAQmxReadCounterF64() timeout? Or a way to re-enable the breakpoints?

 

6602 Synchronize 4 outputs by matlab

$
0
0

Hello,

 

I am trying to use PCI-6602 counters to generate 4 pulses that start together. The width of these 4 pulses are ms level. However, the delay between channels is ms level too. So how to synchronize trigger the start and stop of 4 channels (with different duty cycle) by matlab?  

 

I tried to use an external signal to trigger 4 channels together buy using 'addTriggerConnection', 'External' as source. But it didn't work. Matlab said Trigger and clock connections will not affect counter output channels.

 

And how to connect wires?

 

Thanks. 

pci 6602 external clock

$
0
0

Hello I'm a little bit a newb concerning the PCI-6602, and I need somenones help. I have a APD which delivers signals I want to count while an external gate is high. My code so far (this is just pseudo code since I have a wrapper in python): I have connected the signal I want to count to the PFI39 and the Gate to Gate - ctr7

 

DAQmxCreateTask('', task)

 

DAQmxCreateCIPulseWidthChan( task, "/dev1/ctr7", '', 0, MaxCounts*DutyCycle/f, DAQmx_Val_Ticks, DAQmx_Val_Rising)

 

DAQmxSetCIPulseWidthTerm( task, "/dev1/ctr7", "" ) 
DAQmxSetCICtrTimebaseSrc( task, "/dev1/ctr7", "/Dev1/PFI39" ) )

 

DAQmxSetCIDupCountPrevent(task, "/dev1/ctr7", True  )

 

DAQmxSetReadRelativeTo(task DAQmx_Val_CurrReadPos) )

DAQmxCfgImplicitTiming( task, DAQmx_Val_FiniteSamps, 1000)

DAQmxSetReadOffset(task, 0)

DAQmxSetReadOverWrite(task, DAQmx_Val_DoNotOverwriteUnreadSamps)

 

DAQmxStartTask(task)

 

DAQmxReadCounterU32(task
, 1000
, 0.008
, 285099872
, 1000
, ctypes.byref(self._CINread), None) 

 

DAQmxStopTask(task)

 

this is not actual code, this is just copied from a python file - thus not C Synthax, but the functions should be ok.

 

If I set the Gate to low however I still get counts, although the Gate is low. Can anyone help me? Did I connect the gate / src to the correct pins?

contador de pulsos de dos canales

$
0
0

Hola a todos¡

Consulto a uds. si es posible hacer un contador de pulsos que lea dos canales simultaneamente. Estoy usando Labview 8.6 , la placa NI-PCI-6221, la cual supuestamente posee dos canales que pueden usarse como contadores, (PFI8 y PFI9). 

Si uso el ejemplo Simple edge counter que viene con Labview, solo lee bien del canal PFI8 (o ctrl0), conectandole una señal TTL con un generador de señales, en cambio del PFI9 (o ctrl1) no lee nada ...

Desde ya muchas gracias por su ayuda,

Saludos cordiales¡¡

Gated pulse train from a 9401 gets stuck in a high state

$
0
0

I posted recently in the LabVIEW board and I am now running into an issue that I think would be more appropriate to discuss in this board. I am using the attached VI to generate a gated pulse train using an NI 9401 in a NI cDAQ-9171 chassis. I'm running into an error where at certain pulse settings, the gate will trip and be stuck in the high state for the entire duration of the pulse. Attached are photos of the output from the 9401 on a Tektronix 475A oscilloscope.

200us_Gate_a.jpg shows a 4.5 MHz, 50ns signal with a 10MHz, 200us gate. 200us_Gate_b.jpg shows the gate stuck in the high state for the remaining 99.8ms after the 200us gate. While the VI runs, the output on the oscilloscope switches back and forth between 200us_Gate_a.jpg and 200us_Gate_b.jpg with a regular frequency, it's not tripped randomly. I checked the output of the gate pulse on its own and didn't find anything wrong with it, so it looks like something is happening internaly after the signal is routed to the high frequency signal.


My goal is to run this VI with a variety of different gate widths. I've found that if I set the gate to 300us, 600us, or 900us, then the pulse looks fine. Any other value causes the gate to periodically trip and get stuck in the high state. I'd like to bring the gate as low as 100us. Has anyone seen this happen with their counters?


Laser pulse counter in FPGA

$
0
0

Dear guys,

 

i have a laser pulses that i wont to measure the time between the start and end pulse via FPGA.

 

i am not familiar with FPGA but because of the cost i am forced to use it. my fpga D70.

 

so if you guys got any info answer will be so greatful 

Quadrature Encoder USB-6215 glitch

$
0
0

I'm using the USB-6215 for a quadrature encoder. I'm trying this two ways, with the same results:

 I add encoder channels A/B to PF0 and PF1 (terminal 1 and 2), using counter 0.  Power is of course from the connector.

1) NI-Measurement and Automation Explorer

  I create a new virtual channel for Position->Angular.

 2) Matlab

encoder_in_ch = sess.addCounterInputChannel(deviceID, 'ctr0', 'Position');
encoder_in_ch.EncoderType = 'X4';

 

However, when counting down below '0', the values stored jump to 4.295x10^9 (4294967294), which is 32-bits (2^32). Eg "15, 14, 13...1,0, 4.295e9,"

Then back to 0,1,...55, etc when moving back above zero.

Why is this not stored as a negative number, but a 32 bit values?

 

I see this in NI-MAX as well, and in the data that matlab stores for the encoder position.

 

digital waveform frequency measurment

$
0
0

Hi,
i have Motor driver can give me the speed as feedback "digital waveform"
the frequency is proporational with the speed
i have Cdaq 9188
also i have ni9401
1. at which slot i have to connect the cmodule 9401 to be able to reach the counters ?
2. how i have to connect the speed feedback to module ?
3. can i have guide about this issue ?
thanks alot

frequency measurement keep reading value when stop rotation

$
0
0

Hi,
i am doing the program in the attachment 
in this program i am using ni9401 and cDAQ 9188 to measure frequency from motor driver 
but i am facing some problems 
1. the reading sometimes different than osciliscpe.
2. when i stop the motor the program still read values and not going to zero |
Note my driver send the feed back as a signal"Pulses" with difference frequencies depend on my speed . i send digital values to the driver pins 111 to make it rotrate forward and 100 to make it stop rotating + analog value to change the speed 
can i have help in that ?
thanks 

elapsed time

$
0
0

Hi,

I am using two Elapsed time and I want to synchronize the two. Is there any method how I can do it??

Viewing all 1243 articles
Browse latest View live


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