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

PCIe-6612 vs X-series multifunction DAQ

$
0
0

I'm doing what should be a pretty simple edge counting/event timestamping operation. I have some random events occurring at unknown times after an external trigger signal. I need to timestamp the time difference between the trigger and the random events, so I have a counter set up to count the 100 MHz internal timebase, and use the external events as a sample clock. Basically, whenever the external event happens, it reads a value from the counter and stores it. The trigger signal is used to reset the internal counter.

 

I wrote and tested this using a USB-6353 at the office, and my customer is using a PCIe-6612. Right now we're just doing some testing using function generators. As best as we can tell, the function generators are configured the same, but we're getting different values for the reads. The test setup is just a 10 kHz repeating trigger with a second pulse happening 5 µs after the first. As often the case, "it works fine for me" but I read this value as 5 µs and the customer sees it as ~6.3 µs. A 4 µs pulse reads as 4 µs for me, and ~5.3 µs for the customer on his 6612.

 

Is there a difference between the 6353 and 6612 when it comes to counter based tasks? Maybe some default edge direction I'm forgetting to set, or maybe a default "counter reset" value?

 

daqsetup.png


How can i use internal base clock when i count two inputs

$
0
0

Hi. I'm using a USB-6343 and there is a internal base clocks.

johndoe_student_0-1591755905826.png

I want to count two digital inputs and see in array, so i build a vi like below

johndoe_student_1-1591756103472.png

But it says "External sample clock source must be specified for this application."

 

isn't this board(USB-6343) support internal base clock, or do i miss understand about internal base clock, or do i miss something?

 

should i use a external clock for a hardware count?

 

 

Measuring duty cycle with NI-DAQmx Python on USB-6218

$
0
0

Hi everyone ! I am a student and very new to this and am still getting familiar with the basics. I am working on a project with an electronic card.

I have to send some commands on the serial link of the card to activate and deactivate some I/O in order to measure different voltages on the card and to validate some tests. I want to automate these tests using python and the NI-DAQmx Python API.

 

Currently, I have 28 analog voltages to measure and 2 analog voltages to send that's why I am using the DAQ USB-6218 with its 32 analog inputs and its 2 analog outputs. Also, the input range of 10 V suits me perfectly due to the fact that most of my voltages are between 0 and 10 V.

I need also to measure a current of 241 mA, but it would be better to measure its duty cycle which is at a frequency of 5 kHz, Pulse width = 111 μs, Period = 199 μs, so duty cycle = Pulse width / Period = 111/199 = 0.56.

 

Even if I managed to code the acquisition of my analog voltages and to send the analog voltages I wanted, I am currently struggling for the duty cyle part ...

 

For the voltage acquisition I am currently using this sample which is working very well :

################################################################## # imports ################################################################## import nidaqmx import time from builtins import input ################################################################## # Function definition ################################################################## def first_test(): #Function for first test voltage_ai0 = task_ai0.read() print("Voltage on port AI 0 : ", voltage_ai0) if 2.475 < voltage_ai0 and voltage_ai0 < 2.525: First_test = True else : First_test = False return First_test ################################################################## # main function ################################################################## if __name__ == '__main__': print("------------------------------------") print("Starting Voltage Acquisition..") print("------------------------------------") input("Press Enter to continue...") print("------------------------------------") #First test task_ai0 = nidaqmx.Task() task_ai0.ai_channels.add_ai_voltage_chan("Dev1/ai0",terminal_config=nidaqmx.constants.TerminalConfiguration.RSE) time.sleep(2.0) first_test()

For the duty cycle acquisition, I tried this :

import nidaqmx import pprint pp = pprint.PrettyPrinter(indent=4) with nidaqmx.Task() as task: task.ci_channels.add_ci_duty_cycle_chan("Dev1/ctr0") print('1 Channel 1 Sample Read: ') data = task.read() pp.pprint(data) print('1 Channel N Samples Read: ') data = task.read(number_of_samples_per_channel=8) pp.pprint(data)

 But I get this error ... :

error_duty_cycle.png

I read on this link : https://knowledge.ni.com/KnowledgeArticleDetails?id=kA00Z000000kHAPSA2&l=fr-FR that there are three new counter pulse measurements  available in DAQmx 9.0 and later that are only supported on X Series devices, 661x devices and newer cDAQ devices. If you attempt to create these tasks with unsupported hardware, you will receive the above error.

I tried to use the Task Type : "CI Pulse Freq" with the resulting measurement values :" Frequency and Duty Cycle" by testing this example : https://github.com/ni/nidaqmx-python/blob/master/nidaqmx_examples/ci_pulse_freq.py, but I get the same error message ...

 

That's why I am wondering if I am using the good measurement type and if not, can you tell me which one should I use and how to program it please ...

 

Any help would be greatly appreciated!! Thank you.

How to control an external device with counter output channel?

$
0
0

Hi, I am learning to use NI multifunction I/O board to trigger an external stimulator. I use matlab to control the NI board and now can send 5v voltage output through an analog output channel to trigger a stimulator. The problem now is that I have 6 stimulators to be triggered but the NI board only has 2 analog output channels. The NI board does have more counter output channels. I am wondering if it's possible to trigger external stimulators with these counter output channels? And how to control the counter output through matlab?

I would appreciate any help. Thanks.

power supply of USB-6346

$
0
0

Hello Everyone,

 

I have to replace an old system, which uses a Daqcard 6062e (PCMCIA).

I was thinking about to chose the USB-6346 which has similar characteristics, but i have a doubt concerning the power supply og this device, especially after reading the manual : "The USB-6346 must be powered with an AC adapter offered by NI or a National Electric Code (NEC) Class 2 DC source that meets the power requirements for the device and has appropriate safety certification marks for country of use"

 

Does it mean that it's absolutely not possible to power the device only with the USB bus of a laptop? If answer is "Yes", I will have to choose an other device, cause the system will be used in a test environment without any external source of energy at some very specific moments (in a trainset, with main circuit breakers open and so, no energy excepted the battery of the laptop...

 

thanks in advance for you answers.

How to custom CAN Frame of checksum and rollcounter in VeriStand

$
0
0

calculate CAN Frame of checksum and rollcounter in simulink and mapping XNET CAN Frame,but occasional rollingcounter is inaccuracy. So I want  to consult  custom CAN Frame of checksum and rollcounter in VeriStand.Thank you.

Ardiuno opto interrupter RPM

$
0
0

Hi,

 

Pretty new to Labview and struggling to find a solution to this. I want to read the RPM of a DC motor. I have an opto interrupter attached to the axel of the DC motor which has 20 slots in it.

 

I am not sure where in Labview to start. I have Labview reading when the interrupt signal is being activated on a digital pin (7) from the arduino using LINX. So in my head what I would like to do is count how long it takes to activate that digital pin 7 times and then calculate that to RPM.

 

Any help would be greatly appreciated.

count for exact time

$
0
0

Hi

 

I made a counter with USB-6343 as following :

johndoe_student_0-1594268920212.png

Delay decides how much time does it count.

when I run this vi with 1000hz input for 1000ms, it counts not only 1000 but also 1001, 1002, 1003.

 

It seems to count for not 1000ms but 1001ms or something.

 

I found a document about Real-Time OS or FPGA, but I'm using a USB-6343 in window10, so It's not help for me.

 

is there any tip for measuring a count in exact time(about 0.1ms or less) with USB-6343 and window10 OS?

 

thanks.


How to specfy the terminal of USB 6210 with python ?

$
0
0

Dear all,

 

I am learning how to use the nidaq device with python.

we have USB 6210 and python module nidaqmx.

we want to use USB 6210 as counter.

 

i made python code below.
###################################

import nidaqmx

 

counter = nidaqmx.Task()

rate = 100000

co1 = counter.co_channels.add_co_pulse_chan_freq(

           counter = "Dev2/ctr0",

           units = FrequencyUnits.HZ,

           freq = rate)

 

# if terminal is selected, daq is not working.

co1.co_pulse_term = "Dev2/PFI7"

 

counter.start()

 

######################################

 

when terminal is not selected, counter is output from PFI4.

 

please help me if you know how to select.

 

actually, i made program for checking the bhavior this problem.

 

###################################

import nidaqmx

 

counter = nidaqmx.Task()

rate = 100000

co1 = counter.co_channels.add_co_pulse_chan_freq(

           counter = "Dev2/ctr0",

           units = FrequencyUnits.HZ,

           freq = rate)

 

counter.start()

 

with nidaqmx.Task() as counter1:

      rate = 50000

      co1 = counter1.co_channels.add_co_pulse_chan_freq(

      counter = "Dev2/ctr0",

      freq = rate)

      co1.co_pulse_term = "Dev2/PFI7"

      

      counter1.start()

      h = input("ok ? >>")

######################################

In this case, i can select terminal in next task.

if i write terminal in frist task, error is shown.

 

"DaqError: Destination terminal to be routed could not be found on the device.
Make sure the terminal name is valid for the specified device. Refer to Measurement & Automation Explorer or your hardware documentation for valid terminal names.
Property: DAQmx_CO_Pulse_Term
Destination Device: Dev2
Destination Terminal: Dev2/PFI7
Channel Name: Dev2/ctr0
Task Name: _unnamedTask<4E>"
 
i have any strange things,
for exsample, can not specify terminal at PFI2 as using counter input with task.timming.

 

please help me if you have solution.


best regards

PXI 6608

$
0
0

Hello guys,

i'm working on project using PXI 6608 as counter that count event. I'm using CVI  to run this device , but when I run the program it gave me nothing to count even though I have created the device in NI MAX . 

My second is , are all the PXI'S working in CVI as well as in LABVIEW  ? 

 

THANK YOU.

数据采集时每个数据点的持续时间问题

$
0
0

现在我有一个在时间上进行复用的模拟信号,如图所示,每种颜色代表其中一路信号,如果我只想采集黄色的信号,利用一个与黄色信号同步的时钟进行采集可行吗?其他颜色的数据是丢失了还是被积分了?

liuchi96_0-1595848518297.png

 

PXI-6602 Clock (PXI and cPCI)

$
0
0

Why does the calibration procedure for the PXI-6602 instruct to use a PCI slot?  The PXI-6602 that I have has an EMPTY 10 MHz Osc silkscreened slot with several places for parts around it that have no parts installed.  Does it even have an onboard oscillator that will work without connecting it to a PXI chassis?  Where can I get a short cPCI to cPCI extender (that I can use in my PXI chassis)?

Thanks.

Use DAQmx Timing and Trigger Property Node together

$
0
0

Hello,

 

I was trying to do edge counting on my NI 6602 DAQ device and wanted to place both DAQmx Timing Property Node (to read the "Sample Rate") and DAQmx Trigger Property Node (to set up the trigger) after the DAQmx Timing Vi.

 

I tried to put two Property Nodes one after another. But then DAQ device stops performing the counting task. So I am wondering if there is a way to specify both properties (Timing and Trigger) at the same time?

 

Thank you,

Hiriam

Counting with Arm Start Trigger with Python - NI-DAQmx

$
0
0

We are trying to arm start trigger with the DAQ board to acquire data from a single photon counter. We developed the code like this: 

 

# Create a counter task: readTask = nidaqmx.Task() channel = readTask.ci_channels.add_ci_count_edges_chan("Dev1/ctr0","", initial_count=0, edge=Edge.RISING, count_direction=CountDirection.COUNT_UP) channel.ci_count_edges_term = "PFI0" #Configure start trigger readArmTrig = readTask.triggers.arm_start_trigger readArmTrig.trig_type = TriggerType.DIGITAL_EDGE readArmTrig.dig_edge_src="PFI4"

 

However I don't think the program reads the ci_channel with the trigger we defined. Do anyone know how to enable the arm trigger for a digital counter? Thanks. 

 

Jon

PXI 6608 always report error

$
0
0

I use PXI6608 as counter, to measure the frequency of 50M, but always report error, seems have problem to get the frequency.

I use scope manually check, the waveform is there, just a little distortion in the peak, i guess this is not the case.

 

So i am not quite sure, need any additional setting, driver or config, the VIs works in another test station.

Thanks.

 

NI MAXNI MAXVIVI


USB-6211: edge counting within externally defined window

$
0
0

pulses.png

 

I am attempting to use a USB-6211 to edge count pulses within an externally defined window, as diagrammed above. I'll call blue my gate and orange my signal---I wish to know how many signal pulses appear within each gate pulse (positive excursion). Importantly, I might get zero signal pulses during particular gates. Ideally I would ignore any signal pulses that appear outside of the gate window. I have tried two strategies and need help understanding what I've seen. I am wondering if what I want is possible with USB-6211. Any guidance would be appreciated.

 

I'm using PyDAQmx on Windows 10 with daqmx version 20.1---scripts attached

 

strategy 1: edge count measurement

 

I can successfully read the number of signal pulses between gate rising edges by using a count edges channel with my gate defined as the external sample clock. However this also counts signal pulses in the period between gates. I tried two solutions to ignore the signal pulses that arrive while the gate is low.

 

I tried using the counter gate that I see documented in the USB-6211 pinout (CI.CountEdges.Gate.Enable), but daqmx tells me: "Specified property is not supported by the device or is not applicable to the task".

 

I tried using a pause trigger, but daqmx tells me: "Pause trigger is only valid for event counting if sample clock is not used".

 

strategy 2: pulse width measurement

 

From reading similar questions on NI community, I learned that it is possible to back out this information by doing a pulse width measurement using your pulsed signal source as an external time base. I have tried this, but daqmx tells me: "Device does not support this property". If I use an internal timer I get back the pulse width that I expect, but obviously that doesn't tell me anything about my signal.

USB-6211 count edges during gate

$
0
0

pulses.png

 

I'm attempting to use a USB-6211 to count signal pulses within an external gate, as shown above. I'll refer to my blue pulses as my gate and orange pulses as my signal. I want to count how many orange rising edges there are during the positive excursion of each blue pulse. I've tried several approaches and need help understanding what I've seen.

 

I'm wondering if perhaps my goal isn't possible with the USB-6211---if somebody could just confirm that this IS possible with my hardware I would feel better about sinking more time into trying to figure out how to configure the task.

 

Any response would be appreciated!

 

I'm using PyDAQmx on Windows 10 with DAQmx version 20.1---scripts attached.

 

APPROACH ONE: edge counting

 

I can setup a count edges channel using my blue gate pulses as an external sample clock. This gives me the number of orange signal pulses between rising edges of my gate, but tells me nothing about how many orange signal pulses appeared during the positive excursion. I have tried two strategies to stop counting while my blue gate is low, but both have failed.

 

I have tried activating the hardware counting gate that's documented in the USB-6211 manual (CI.CountEdges.Gate.Enable), but DAQmx tells me "Specified property is not supported by the device or is not applicable to the task".

 

I have tried adding a pause trigger, but DAQmx tells me "Pause trigger is only valid for event counting if sample clock is not used"

 

APPROACH TWO: pulse width measurement

 

From reading other community posts, I have seen that it's possible to back-out the value that I want by doing a pulse width measurement using my signal as an external time-base. I have tried this, but DAQmx tells me "Device does not support this property"

 

Create output trigger relative to two input triggers?

$
0
0

I'm updating a Traditional DAQ application to NI-DAQmx.

The old system uses PXI-6602 boards.  The new one uses PXIe-6614 boards.

Because of limitations of DAQmx, I don't think a straight port is going to be possible. (Details below.)

 

The problem I'm trying to solve:

I need to measure the time between two input pulses.  Let's call them t0 and t1, and their difference is n ticks.

I need to generate an output pulse at a fixed offset in time before t1 + 2n ticks.

 

The old application took advantage of a feature in Traditional DAQ that I don't think is present in DAQmx.

The program uses three counters.  One counter is set up to divide the 80MHz clock base depending on the gate.  It is programmed to give a 40MHz clock when the gate is low, and a 20MHz clock when the gate is high.

In Traditional DAQ, you could set up the counter in FSK (Frequency Shift Keying) mode, setting up one duty cycle for gate low, and another for gate high.  That's the part that I don't think can be done in DAQmx.

 

The output of that counter becomes the source of another counter which counts down at 40MHz and then up at 20MHz.  When you get back up to zero, you've computed the "2n ticks".  You can account for the fixed offset by doing some simple offset of the count of this second counter. (I know that's confusing; I can provide more detail, but I'm not sure it's relevant if I can't shift the clock frequency for the counting.)  You can take the output of the second counter and feed it to a third counter to generate the output pulse when the second counter gets back up to zero.

 

Any ideas on how to tackle this problem with DAQmx?  I'm open to using other hardware if necessary, or different approaches to my problem.  I like the 6614 because it's pin-compatible with the 6602, and I'm using a bunch of the DIO lines for other purposes.

Sample clock for linear encoder on NI 9402 board

$
0
0

Hi,

I'm facing an issue with the sample clock settings for a linear encoder.

I have a NI 9402 module attached to a NI 9191 cDAQ module. The signals A+ and B+ are connected to the PFI0 and PFI2 terminals of the NI 9402, respectively. The encoder delivers signals with a frequency of up to 50 kHz (0.0006 m spacing at a velocity of up to 30m/s), so I guess also my sample rate should be >=50 kHz to detect any movement (or am I wrong?).

 

For testing purposes I'm using NI-MAX to visualize the signals for now.

Whenever I want to measure in continuous mode, I have to define an EXTERNAL sample clock source. In the drop-down menu in the advanced timing tab of the linear position task I can choose between several channels of the cDAQ module, none of them is working, though (e.g., I'm getting a signal routing error -89136).

I've also been trying to use the PFI0 channel itzself as sample clock, however, apparently I am missing data points in this case as the measured length is wrong.

 

According to the data sheet the NI 9191 cDAQ module has 4 internal counters. Is it possible to use one of these timers for my linear encoder task programmatically (in LabVIEW) somehow?

All four digital IO ports of my NI 9402 are in use, so there is no chance to make an external signal routing.

 

I've searched the entire internet (😉) for days now without finding a solution for my specific problem.

Any help is highly appreciated...

DSI3 Bus supportive NI hardware

Viewing all 1243 articles
Browse latest View live


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