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

80 MHz timebase as counter source

$
0
0

I am translating a Traditional DAQ Counter application to DAQmx.  The old hardware was a PXI-6602, the new hardware is a PXIe-6614.  Both have 80 MHz clocks.  They are very similar hardware devices.

 

I'm not a counter expert, but I'm pretending for this application.

 

One of the counters is used for "gated event counting", where the counter counts down a specified number of 80MHz clock while the gate is high, and toggles the counter output when the counter reaches zero.  Here's a subset of the Traditional DAQ code.  (I didn't bother with a snippet, since most people don't have Traditional DAQ installed.)

 

Screen Shot 2020-11-28 at 9.13.14 PM.png

My understanding is that the "internal max timebase" will be 80M, which is then set as the "source selection".

Based on this post, I tried:

 

Simple Event Counting with TimeBaseRate.png

 

(Oops, I just now realized that these snippets left out the "Start", but the read autostarts, so it returns the same error.  This was a test VI that I derived from my actual code.)

 

 

This returns an error:

Error -200452 occurred at Property Node DAQmx Channel (arg 1) in Test GEC.vi Possible reason(s): Specified property is not supported by the device or is not applicable to the task. Property: CI.CtrTimebaseRate Channel Name: Dev1/ctr3 Task Name: _unnamedTask<52>

 

I've also read this post: Why Can't I Choose the Internal Clock in DAQmx Counter Input Example Programs?

I am using all 8 counters and don't have a spare counter to recreate the 80Mhz clock.

 

Here are a couple of other things I've tried, to no avail:

 

Calling the DAQmx Timing VI, which returns a similar error:

Error -200303 occurred at Test GEC.vi Possible reason(s): External sample clock source must be specified for this application. Unspecified Property: SampClk.Src Channel Name: Dev1/ctr3 Task Name: _unnamedTask<53>

 

Simple Event Counting with SampleClock.png

 

And also trying to use the CountEdges terminal to /Dev1/Ctr3SampleClock, which returns the error

Error -89136 occurred at Test GEC.vi Possible reason(s): Specified route cannot be satisfied, because the hardware does not support it. Property: CI.CountEdges.Term Property: CI.CountEdges.ActiveEdge Source Device: Dev1 Source Terminal: Ctr3SampleClock Task Name: _unnamedTask<55>

Simple Event Counting with CtrSampleClock.png

 

Given that this was possible with Traditional NI-DAQ, I assume that I'm just missing something obvious.

But given that there's a KB entry that implies that you have to use an extra counter, I'm worried.

 

Another part of my app needs to use "CI Two Edge Separation", and I think it will have the same problem.  I want to count the 80 MHz clock in between two pulses.

 

Any ideas?


Photon counting delay

$
0
0

Hi,

 

I'm using LabVIEW 2020, PCI-6602, BNC-2121, Hamamatsu 6420 photon counting module, and a Texas Instruments DLP4500 digital micromirror device (DMD) as a structured light detection system. Light from a microscope is reflected from the DMD onto a photon counting photomultiplier tube (PMT). I've combined IMAQ Create, IMAQ WindDraw, and Photon count with dwell time to create a VI which modulates the DMD by displaying an image (similar to how a projector operates as a second screen) and recording the photon counts of the reflection of light from that image. I am troubleshooting the device by alternating the DMD mirrors to all "ON" and then all "OFF" ( by displaying black and white images) and recording the photon counts. As you can see by the data, occasionally I get the PMT still reading from the previous loop (or a delay from IMAQ?), which creates a mixed reading of ON and OFF states. In this measurement I took 4 samples and threw the first one away at 100 ms per data point. I get fewer of these "hang ups" by taking and deleting more samples, but the issue persist and it is detrimental to image reconstruction and significantly increases measurement times. This shows that even after >400 ms that the counter is still counting the photons from the previous image or that there is a delay in the image swap with IMAQ. I would like to solve why I get an occasional lag from the DAQ system which throws off my readings. This might be my counter, VI, or Vision systems fault so I appreciate any suggestions.

 

Thank you,

Dillon Kopecky    

Digital filtering on Gate for Linear Encoder

$
0
0

Hi All

 

Using the C API for DAQmx 19.1 on a PCI-6601

 

I am trying to apply a digital filter on the gate input for my X1 counter task.

 

Linear encoder channel is created using DAQmxCreateCILinEncoderChan

The sample clock source (gate) is set to PFI30 using DAQmxCfgSampClkTiming

Filtering is setup for A and B inputs using:

DAQmxSetCIEncoderAInputDigFltrEnable

DAQmxSetCIEncoderAInputDigFltrMinPulseWidth

DAQmxSetCIEncoderBInputDigFltrEnable

DAQmxSetCIEncoderBInputDigFltrMinPulseWidth

 

I then want to setup filtering on the gate, but there is not specific method or property for this, for CountEdges there is DAQmxSetCICountEdgesGateDigFltrEnable but this returns error -200452 when I set it to true.

 

Is it possible to simply setup a filter on the physicl input PFI30 without linking it to a specific channel or task?

 

Thanks,

 

Simon

 

How do I setup digital filtering on the Gate signal (PFI30) for this task/channel?

Photon counting delay

$
0
0

Hi,

 

I'm using LabVIEW 2020, PCI-6602, BNC-2121, Hamamatsu 6420 photon counting module, and a Texas Instruments DLP4500 digital micromirror device (DMD) as a structured light detection system. Light from a microscope is reflected from the DMD onto a photon counting photomultiplier tube (PMT). I've combined IMAQ Create, IMAQ WindDraw, and Photon count with dwell time to create a VI which modulates the DMD by displaying an image (similar to how a projector operates as a second screen) and recording the photon counts of the reflection of light from that image. I am troubleshooting the device by alternating the DMD mirrors to all "ON" and then all "OFF" ( by displaying black and white images) and recording the photon counts. As you can see by the data, occasionally I get the PMT still reading from the previous loop (or a delay from IMAQ?), which creates a mixed reading of ON and OFF states. In this measurement I took 4 samples and threw the first one away at 100 ms per data point. I get fewer of these "hang ups" by taking and deleting more samples, but the issue persist and it is detrimental to image reconstruction and significantly increases measurement times. This shows that even after >400 ms that the counter is still counting the photons from the previous image or that there is a delay in the image swap with IMAQ. I would like to solve why I get an occasional lag from the DAQ system which throws off my readings. This might be my counter, VI, or Vision systems fault so I appreciate any suggestions.

 

Thank you,

Dillon Kopecky    

Counter output appearing on multiple PFI lines

$
0
0

I am trying to use the counter to output a digital pulse (continuous) on a select PFI channel.  This is easy enough, but I am observing some strange behavior.  If I select PFI0, then it outputs as expected.  But now, if I select PFI1, then both PFI0 and PFI1 output the same digital signal.  What I want to do is control which line outputs the signal, not have multiple signals going out at the same time.  I tried resetting my USB-6212 device, but that didn't seem to help.  

Photon count synchronization

$
0
0

Hi,

 

In my attempt to create a VI which synchronizes the image displayed on a second monitor with the photon counts from a photomultiplier module via an event structure, I've noticed that the photons and images aren't correlating and instead the photon counts are building a back log. Can someone take a look at my code and help me to improve it?

 

I'm using LabVIEW 2020 with a PCI-6602 counter and a BNC-2121.

 

Thank you,

Dillon Kopecky

Reset counts trigger

$
0
0

Hi,

 

I've Constructed a VI which displays an image on a second screen and cycles through images via an event structure. I would like to generate a trigger upon completion of the loop which would be used to trigger the count reset of the Counter- Count Edges VI. Is this something I can do with my current hardware? If so, what do you suggest?

 

I am using LabVIEW 2020 with a PCI-6602 and BNC-2121.

 

Thank you,

Dillon Kopecky

 

 

Onboard device memory overflow

$
0
0

I have a USB-6343, X series DAQ device with BNC termination that I am using to collect counts from an avalanche photodiode connected to the ctr1 channel in a counter task. I am timing the task using a pulse streamer connected to the PFI0 channel. The task is triggered automatically and reads the samples into a buffer with pre-allocated size at every rising edge detected from the external clock (which is connected to PFI0).

 

The pulse streamer produces 10 ns pulses in the following sequence:

100 ns off - 10ns pulse - 390ns off - 10ns pulse - 4us off - 10 ns pulse - 390ns off- 10 ns pulse- 1 us off

 

This means that the shortest time between two ticks of the external clock is 400ns, corresponding to 2.5 MHz, which is the value I set the DAQ sampling rate. The sequence runs n times (typically ~10,000) and total tick number is 4*n, which is the size of my counter buffer. 

From a reason I don't understand, I get the following error at random times (everything will work most times, but every now and then when I try to run the code it produced this error):

 

nidaqmx.errors.DaqError: Onboard device memory overflow. Because of system and/or bus-bandwidth limitations, the driver could not read data from the device fast enough to keep up with the device throughput.
Reduce your sample rate. If your data transfer method is interrupts, try using DMA or USB Bulk. You can also use a product with more onboard memory or reduce the number of programs your computer is executing concurrently.

Status Code: -200361

I tried reducing the sampling rate, running the sequence for fewer times, and closing all programs on my computer, but the error still comes up pretty randomly. It happens less often when I run the sequence fewer times, but it still happen with no apparent pattern.

I would really appreciated your help in this matter. 

It is important to note I am using the python API with the following code:

for timing
timing.cfg_samp_clk_timing(
sampling_rate,
source= self.clk_channel, #PFI0
sample_mode=AcquisitionType.CONTINUOUS)

 

for reading

read_many_sample_uint32(
self.ni_ctr_sample_buffer, 
number_of_samples_per_channel= self.buffer_size)


Using NI 9205 or NI 9403 DIO module for encoder measurement

$
0
0

Hello,

 

Is it possible to measure angular position by counting pulses from a quadrature encoder using NI DIO 9403 or NI 9205 modules coupled with cDAQ 9174. I do not have access to other modules which have inbuilt counters. If possible, can someone please guide me on how to do that?

cDAQ-9191 Synchronization

$
0
0

Hello,

 

I have two NI-9191 cDaqs each with an NI-9234 modules and I would like to know how to synchronize both chassis so that I can simultaneously acquire data from them. I am currently using Matlab to configure the daqs and I have looked into the option of creating a trigger, however, I haven't been successful in doing it. I have tried all of the Matlab examples online and none seems to work for me. How should I proceed? Is there a tutorial for me to follow? Any help would be highly appreciated!

 

TDMS Write Function slowing loop

$
0
0

Hi,

 

I'm counting edges of TTL pulses coming from a photon counting photomultiplier tube module on my PCI-6602. I'm trying to sample at 4 kHz, but at 2 kHz my consumer loop starts to lag behind. Without the TDMS Write Function I can sample at > 4 kHz, so I believe that to be the issue. Is there a more efficient way to write the data or have I reached a limit for writing my data?

 

Thanks,

Dillon Kopecky 

Synchronize cDAQ-9174 with PXIe-1082?

$
0
0

Hi,

 

I have a cDAQ-9174 using a ni-9401 module to read position of an angular encoder. I have a PXIe-1082 chassis with PXIe-6365 Multifunction I/O module reading other analog inputs. I want to synchronize these two chassis but I'm not sure what hardware I need to make this happen. The 1082 backplane has BNC connections for 10MHz ref clock. It seems like I need an NI-9469 for the cDAQ with CAT5 cables, but it only  connects to other NI-9469 modules. I understand a cDAQ-9178 would have BNC connections on the chassis but is there a workaround for a cDAQ-9174?

 

This is an attempted solution to an issue I've been having the angular encoder being on the PXIe-6365 module. If the encoder is connected to the PXIe and powered on, the other signals on the module become extremely noisy, such that the data is unusable. So I disconnected the encoder from the PXIe and connected it to a cDAQ-9174, the only other daq device I have. This dramatically reduced noise in the other signals, however the data is no longer synchronized.

 

Thanks in advance!

Timer - Air solenoid

$
0
0

Hello all, first post here "nice" to meet you;

 

So, I have been working on learning more about labview over the past couple weeks and I thought that I might be able to use it to build a touchscreen interface(gui) for a project I am working on. First an foremost, the main function is to run a while loop type function to cycle a low voltage solenoid(~3V) used for air pressure delivery to a pump with the on/off times adjusted by user. The only other sensor/device would be a pressure transducer to provide a value for a digital screen readout of the psi. I have a few other animations I want to add, but those are of no concern until I have the main systems working and should simply be a swapping out of images as far as I have read.

 

So, main goals:

  • Build a loop timer to allow a user to change two different values; solenoid closed and solenoid open times(seconds).
  • User can pause and play the time with either one button that changes to the other(press play changes icon to pause and vice versa) or two completely different buttons for "simplicity". Pausing the "time" would therefor hold the solenoid open or closed according to current state.
  • Reset button to take times back to default,{15s:5s | off:on}.
  • During cycling, have an animation of a vertical bar or animate a bar to move/fill up  during discharge and down to 0 when cycling back off.  (or just an led or simplicity)
  • Read a transducer to simply show constant psi where ever its connected.

So really only two output signals to a solenoid and one input from the transducer, along with tft functions that will be addressed later.

 

The GUI well allow user to interact with the on and off value, pause, play and reset buttons. If I can figure out how to get the pop upmenu to work, would like to give my self the ability to be able to tap the number display to have a popup display with 0-9 show up for quick set up instead of having to hold down the up or down arrows.

 

Now my question(s):

  1. I am currently planning on using an arduino uno or mega with a 2.8 tft(may go up in size). I wouldnt be apposed to using a PI, but I need low power consumption; UNO at 16MHz uses ~4V so I may use a 9V to compensate for draw from solenoid. Does anyone know which would be more reliable and easier to set up with a TFT when using LabView?
  2. From my goals above, please help me understand what may or may not be feasible and suggest anything in place? Visual aids would be awesome since this is all still new to me.

Ill upload my files and images I have made when I get back to my desktop at home to update this; really just the GUI part of things in LV. I'm currently watching vids and reading on timers, so my update might show a lot more progress than currently mentioned.

 

Thanks for any help, I hope to learn a lot from all of you. If you need anything specific before I update, Ill try and address it before I post again.

 

Skol

Using digital edge counting as a time source for a timed loop

$
0
0

Hi Friends,

 

I have a USB 6002, a multifunctional device having analog output (AO) and counter input , and would like to use it as a time source (via edge counting) for a timed loop to avoid Windows OS interruption to a while loop. I found that such OS interruption to a while loop occurs occasionally when a while loop runs  at 20-50 iterations/s, the loop contains a VISA reading data from a device register.  The interruption is normally approximately less then 2 seconds, posing the reading data for the short time, and then the reading data can resume by itself. The VI with the loop is set at the highest priority to ensure the data acquisition. It is a annoying issue to my project. 

 

My point is to send a square wave signal via a USB 6002's analog output to the counter PFI0 or PFI1, the counter then sends edge counting bits to a DAQmx time source for a timed loop so that the loop can run at specified number of iteration.

 

I tried around and obtained an error. A simplified VI is attached, which included the error message and the USB 6002 channel description for your reference.

 

edmonton_0-1610489310631.png

 

 

Can some one help me with the settings?

 

I will post this at different location for a broader exposure, e.g. LabView and counter/timer

 

Thanks,

Gu

 

 

   

 

Simple DAQ to generate 2 external triggers

$
0
0

Hi!

 

Please excuse my naïveté, I am new to all this!

I'm looking for the simplest DAQ to generate two external TTL triggers for two cameras, at different frequencies (10 Hz and 200 Hz).

 

Initially I was looking at the USB-600x line as their docs mention hardware-timed Analog Output channels.

 

But it seems that for this application it is generally recommended to use more expensive DAQs like the USB-6210 which support counters/timers for pulse generation. Is this necessary or can I just use the hardware-timed Analog Output channels in the simpler models?

Thanks so much!


Read counter in python

$
0
0

Hello i have this configuration in DAQ Express:

Slayer72_0-1611595835061.png

How can i read the same value with python??

SSI Encoder with NI USB

$
0
0

I'm a LabVIEW beginner. I have aplication with two absolute SSI 14bit encoders. I would like to measure an angular position with encoders, and use LabVIEW aplication on my PC. Could you halp me in choosing NI USB measure card? 

Is theinterface ready to communication by SSI protocol? 

 

Thank you for any help.

 

 

read a counter in python

$
0
0

hello i have created a task the read the counter

with nidaqmx.Task() as task:
      task.ci_channels.add_ci_count_edges_chan('Dev1/ctr0', initial_count=0, edge=Edge.RISING, count_direction=CountDirection.COUNT_UP)

      tsk = task.read()

      print(tsk)

every time i read the task the counter start from 0

how i can have a continuos reading in order to display it continuosly?

 

Thanks

 

Synchronizing analog output and counter input in USB-6211(OEM) using Python

$
0
0

Hi all,

 

I am developing a python code to scan a laser beam over a transparent material and measure the transmitted intensity using a photodetector, which sends the intensity as counts.

 

I am using two analog outputs to control two galvanometers (one for x-direction control and one for y-direction control of laser). I am able to successfully control the galvanometers using the analog output channels of the usb-6211, and the following code is the short description of how I am scanning the sample.

 

from nidaqmx import stream_writers, Task

from nidaqmx.constants import AcquisitionType

import numpy as np

 

taskxy = Task()

taskxy.ao_channels.add_ao_voltage_chan('Dev1/ao0:1')

scanrate = 100  # the maximum scan rate I would be using is about 250

 

xarr = np.linspace(-3,3,50)

yarr = np.linspace(-3,3,9)

# xarr contains array of points to scan along x-direction (fast scan direction)

# yarr contains array of points to scan along y-direction (slow scan direction)

# scanning takes place by going through all values of xarr for fixed y-position of yarr[0] (line 1)

# then again scan over all x of fixed y-position yarr[1] (line 2), and so on...

def scanxy(xarr,yarr): 
   t = 10 # default timeout = 10 seconds
   sample = getxyarray(xarr,yarr)  # this function returns the full 2xn array of points, to scan the whole X*Y area
   sam_pc = np.shape(sample)[1]
   total_time = sam_pc*len(sample)/scanrate
   if t < total_time + 1:
       t = total_time + 2  # make sure that wait_until_done() works even when scanning takes more than 10 seconds
   taskxy.timing.cfg_samp_clk_timing(rate = scanrate+1, sample_mode = AcquisitionType.FINITE, samps_per_chan = sam_pc)
   taskxy.timing.cfg_samp_clk_timing(rate = scanrate, sample_mode = AcquisitionType.FINITE, samps_per_chan = sam_pc) 

 

"""Note: I need to do the above step step twice due to some hardware glitch, which results in wait_until_done() function useless if the function is called second time with the same scan parameters. So here, I change the scanrate to scanrate+1, and then again change it back to scanrate, so that the system thinks that I have changed the scan parameters. With this hack, I am able to run the function any number of times with or without changing the scan parameters"""
   

   writer = stream_writers.AnalogMultiChannelWriter(taskxy.out_stream,auto_start=False)   
   writer.write_many_sample(sample,timeout=t)
   taskxy.start()
   taskxy.wait_until_done(timeout = t)
   taskxy.stop()

Now, I need to configure the counter input, to collect the intensity of the transmitted beam over each position of the material. I just started reading about using counters, and currently, I am only able to collect the counts from the photodetector as on-demand edge-counting.

However, I need to synchronize the scanning of the laser with collection of the intensity from each point on the material.

After reading many topics in this forum, I realize that I need to use a buffered counting method. I think the best approach would be to collect the intensities of all points in one line and then collect the intensities from next line, and so on.. 

However, I am not sure how to synchronize the analog output and the counter input. 

The whole deal about sample clock, gate, etc. is making me very confused. I my current code, the analog output is using internal timing, but I read that I cannot use the same internal timer for the counter input. Is this correct? If this is true, then I need to use an external sample clock for analog output and also use the same sample clock for the counter as well. But I am not sure how to do this. Can anyone please guide me how to do it correctly?

 

Thanks in advance!

Badari

Python frequency counter NI 9402

$
0
0

Hi all,

 

I m trying to get support from NI services, but it seems that this is a complicated task. So, finally I leave here my question to see if anybody can help me. It is not a strange question, and I m sure that this is just easy and common problem.

 

So, I adquired the NI 9402 TTL digital input/output module with the CDAQ-9171 chassis. I would like to include these for APDs conting, and connect it to QUDI python software (https://github.com/Ulm-IQO/qudi), for frequency counter (i.e. counts/second).

 

After some searching I ve found the PyDAQmx python package, that with a task i can use, for example the counting edges tool, following for example this scheme:

 

 

Example_counter.JPG

 

However, this is not returning me correct values of the reading. So, here my questions:

 

1) Do any of you have experience with python coding for counting coding (particularly with frequency counting, i.e. counts/sec) with the NI 9402?

 

2) Have you any experience integrating this NI device into QUDI?

 

3) Do you know any place to see script examples of NI counting with python? I m sure that this is super easy task, but I can not get any support or direction, which in fact is not a great performance from this big company.

 

Thanks a lot in advance,

 

 

 

 

 

Viewing all 1252 articles
Browse latest View live


Latest Images

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