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

Control Stepper Motor while Reading Encoder

$
0
0

Hello,

 

I'm attempting to generater a pulse train to control a stepper motor driver, and in parallel read in the pulses from the encoder of the motor. I've been able to create two seperate vi's that accomplish these taks individually, but when I bring them into one program (as seen below) is where I'm running into resource issues. I beleive I'm having issues setting up my timers correctly and that is why I'm encountering these issues. I'm using a NI 9401 to generate the pulse train to the controller and a NI 9402 to read in the pulses from the encoder. If possible I would like to consolidate down to just using the NI 9401 for both inputs and outputs if possible. Both are plugged into a NU cDAQ 9172 backplane. Any help and/or suggestions would be greatly appreciated on what I'm doing wrong. 

 

 

Code


Array with timed counter

$
0
0

I have this problem where my data comes from the cRIO in FPGA mode and sent to a cluster then converted to an array, the array has 4 values and I need to apply a timed counter so I can take wheel speed data instead of raw voltage data.

I have my timed counter set up but I don't how to add the array data to it then send it back to the array after editing the data.

I have been using a data logging example from labview that I tweaked to fit my project, can anyone help fix this problem?

Digital Input and Counter now working together

$
0
0

I'm working on a project that requires me to take in the inputs from an optical encoder and control the outputs of the DAQ that I am using (NI ELVIS). From what I can tell the NI ELVIS is incappable of using a quadature encoder input so I've simply used a edge counter to detect the rising edge for me. This code works fairly well for the purpose of this project, could use improvement, and functions fine on it's own. I tried to combine this LabVIEW code with my primary code first as a subvi, but it continued to get stuck in a loop and wouldn't exit. So I decided to directly put the code into the primary program, but it messes up the functionality of my whole program. There are no error messages and when looking at the code run step by step it seems to be doing everything correctly, but I'm unalbe to detect what is happening on the analog input.

 

I've attached the code and any assistance would be greatly appreciated.

 

Justin

NI USB-6351 X Series and encoder question

$
0
0

Hello, I read documents and threads about encoder integration with NI devices, however I would like to have a confirm. Can I connect a Line Driver encoder to a USB-6351 X Series board? The encoder is from Lika http://www.lika.it/eng/prodotti2.php?idprod=44&ID=1. Should I use the push-pull type? Still I've to buy the encoder so I can choose the proper one. Thanks in advance for any answeer. Franco.

Use NI USB-6211 to count TTL rising edge

$
0
0

Hello,

 

I am new to NI-DAQ cards, and so before buying anything would like to know if it is possible to use a NI USB-6211 device

to count and bin rising edges of an TTL signal.

 

What I want to do is count how many rising edges of an TTL signal I get in a period of 1ms; a sampling rate of 20 Mhz should be fine.

 

I would like to use Matlab to control and read from the USB-6211 the number of counted edges as well as in the meantime write and read additional digital I/O ports.

 

Is it maybe possible to let the external TTL signal trigger one of the 6211 counters, an then periodically ( after 1ms ) output and reset its counter value?

 

Is that possible, and if so, is it a good idea?

 

Thank you and regards,

Manuel

usb communication break problem

$
0
0

Hello,

 

I use CNT-90 timer/counter/analyzer. I communicite with usb port with NationalInsturements.VisaNS dll.You can see following c# code for usb communication.

 

string resourceName = "";

privateboolOpen_Device()

{

string[] resources = ResourceManager.GetLocalManager().FindResources("?*");

 

foreach (string s inresources)

{

if (s.IndexOf("USB") != -1)

{

resourceName = s;

break;

}

}

try

{

mbSession = (

MessageBasedSession)ResourceManager.GetLocalManager().Open(resourceName);

 

string query = "*IDN?";

 

stringresponseString = mbSession.Query(query);

 

if (string.IsNullOrEmpty(responseString))

 

returnfalse;

}

catch (InvalidCastException)

{

returnfalse;

 

//MessageBox.Show("Resource selected must be a message-based session");

}

catch (Exceptionexp)

{

returnfalse;

 

//MessageBox.Show(exp.Message);

}

returntrue;

}

 

publicbool Measure_Frequency_MessageBasedSession()

{

string measureKomut = ":MEASure:FREQuency?";

 

string buffer = mbSession.Query(measureKomut);

 

//other process...........

 

return true;

 

}

 

When I call my Measure_Frequency_MessageBasedSession function repeatedly (for examplemore than 100times) usbcommunication breaks with the device.Windows usb 2.0 warnin ballon shows on task bar(Warning message="This USB device can run faster than a high-speed USB 2.0 port is connected to") and usb communication breaks.I can access the device when I unplug and plug usb cable with above my code.

Why after a while usb communication break? and Why I have to unplug and plug cable? What can I dofor this error?

Thanks in advance.

 

Note(I use VISA 5.1.2. I reinstall driver but did not work.)

Counting pulses and measuring flow rate per second

$
0
0

Hi everyone

I am using a compactField Point (cFP-2220) controller to measure the flow rate. The flow sensor that i have, gives the output in terms of the pulses. I need to count the number of pulses for a particular interval and divide it by a K-factor( constant value) to get the flow rate. If i select the interval to be of a second, i would want to count number of pulses per second and divide it by K-factor to get flow rate ( per second). 

How do i count pulses per second and consequently measure flow rate using this count and K-factor.

 

Any kind of help would be highly appreciated.

Thanks in advance.

PCI 6602 card not able to generate frequency

$
0
0

Hi,

 

I have PCI 6602 counter/timer card installed in my system. I am able to detect the card my system in MAX.

I am also able to pass the sanity checks and get to test panels.

Whenever i generate a pulse of 1KHz, 50% duty cycle on ctr0 OUT, i am not getting anything on this pin. I tried on all channels but the result was same.
I have used D GND as reference to see the wave on oscilloscope. I am not able to see +5V on pin 1.


Is my card functional? What might be the reasons of this issue?

Please help me with this issue.

 

Regards,

Ashish Paralikar

 


Gate two retriggered counters using a seperate counter

$
0
0

Hi everybody,

 

please let me explain my setup (PCI 6602) in a few words:

I have a light barrier, a flash lamp and a spectrometer. The light barrier measures the frequency of my device continuously and works as some kind of a clock for the whole system.

 

A spectrometer counter (retriggered) is producing triggers continuously after some defined delay. This delay changes based on the frequency and some factors and is updated using CO.Pulse.LowTime.

 

The lamp trigger/counter is configured retriggerable as well and is armed (internal routing) with a defined delay on the spec trigger.

 

The data aquisition is done using the spectrometer drivers and an USB connection. The spectrometer is programmed to aquire a defined # of spectra on command.

 

This setup is based upon the Queued State Machine - Producer Consumerarchitecture and works perfectly. It is fast, stable and so on, BUT:

A lot of unnecessary triggers are produced because there is always some waiting time from aquisition to aquistion. This is not important for the spectrometer. Hence, for the flash lamp it might be a problem because its lifetime is very limited.

 

Therefore a thought about some kind of gating counter which turns on/off the output of the spectromter and lamp triggers. The state trigger could be turned on with the spectrometer DAQ-commad and turned off afterwards. By means of this almost every lamp flash could be utilized (some in the end might get lost).

 

Somebody has some idea how to realize this without loosing too much performance? The gating of the spec and lamp counters should be as fast as possible (it has to be less than 5ms).

 

Thank you so much for your support.

 

Johannes

Time stamping photon arrival times

$
0
0

I would like to do a two-photon cross correlation measurement.  Hardware auto correlators and cross correlators are available but expensive.  It seems many other users have come up with the idea of using the 80 or 100 MHz clocks into the counter input for each desired channel, starting the counters simultaneously, and putting each photon channel into the gate of the corresponding counter.  Then each photon triggers the counter to store the clock count in its internal register, i.e., the time stamp for that photon. Since overflows on a 32 bit counter running at 100 MHz only occur every 42 seconds, and average photon rates will be at least 100 Hz, overflows should be easily recognized and corrected in post processing.  So let's assume all we have to do is get the counter readings into a memory buffer.  There can be bursts of photons with arrival separations as small as few clock cycles.  Average rates might be a few hundred kHz or more on each channel.  We can adjust this rate by turning the laser power up or down---the source for the scatterer that produces the correlated photon stream.  I suspect many others would like to know what system is better for these kinds of measurements, the 6602 or the X-Series.  If FPGA is a good solution, we should maybe start a new thread on that.  But for 6602 or X-Series: What is the fastest they can do this for short bursts (how fast for how long) and what is the sustainable rate?  I realize the sustained rate will depend on hardware.  I thought I saw that the PXI beats the PCI bus in this kind of application.  So are the PXI versions any better?  In particular, what are the effects of the 128 sample FIFO on the X-Series versus the 2 sample buffer on 6602.  And I saw something about the speed of the front end for these two choices might be an issue in this regard.  TTL (photon) pulses on the gate will have 10-50 nsec widths.

How can I read a counter value for two edge separation before counter is stopped by second edge (6602 board)?

$
0
0

I am using a 6602 counter timer/board with DAQmx. I am using the two-edge separation counting available through DAQmx. The counting between the two edges works properly, however I do not know how to read the value of the counter during the counting operation (i.e. after the first edge has triggered the start of counting but before the second edge has triggered the end of counting). I am having to wait until the second edge triggers the end of counting before I can get a counter value. I need to be able to access the current value of the count during the counting operation. This was possible in traditional DAQ. How can it be accomplished using DAQmx?

 

Time domain plots-problem with setting the time counter

$
0
0

Hi,

 

I need to control a signal generator and a vector network analyzer using labview. I am sending a signal from signal generator and measure transmission from VNA. I want to plot voltage vs time at the input and at the output. My problem is how to set the time counter at the input and output.

 

I really appreciate you help. Thank you in advance.

 

How to count the pulses of an incremental encoder with PCI-6010?

$
0
0

Hi everyone,

 

I am trying to use an incremental encoder and PCI-6010 card to measure the speed of a rotary shaft in Labview 2011. I need to use the counter to count the numbers of the pulses that the encoder generates but I have some problems there to do so.

 

I connected the encoder signal to the counter source (PFI0) and built a daq assistant block in the Labview (Acquire signals -> Counter Input -> Edge Count -> ctr0) and it is set as shown in the figure. The problem is that no matter how I turn the shaft the measured value will always be 0 although the pulses can be seen very clearly on the O-scope. 

1111.jpg

I suppose I must have made a very simple mistake. Could anyone help me on that please?

 

Thank you.

python DAQmxReadCounterScalarU32 error -200230

$
0
0

Hi all,

I'm using Python 3.2 and NI-6521 board.

I try to count the number of rising edges of my signal when i click on a start button but i always have the error code -200230.

My program is the following:

 

#Variables

DAQmx_Val_Rising=int32(10280)

InitialCount=uInt32(0)

DAQmx_Val_CountUp=int32(10128)

timeout=float64(10)

null=ctypes.POINTER(ctypes.c_int)()

value=uInt32()

 

#Source Channel

chan_count=ctypes.create_string_buffer(b'1/ctr0')

 

#Create a task

TaskHandle=uInt32

TaskCount=TaskHandle(0)

nidaq.DAQmxCreateTask("",ctypes.byref(TaskCount))

 

#Create a counter input

nidaq.DAQmxCreateCICountEdgesChan(TaskCount,chan_count,"",DAQmx_Val_Rising,InitialCount,DAQmx_Val_CountUp)

 

#Start the task

nidaq.DAQmxStartTask(TaskCount)

 

#Read the number of rising edges when click on GUI button

nidaq.DAQmxReadCounterScalarU32(TaskCount,timeout,value,null)

 

I think my error is in the declaration of value but i don't understand why.

Does somebody have an answer? It is very urgent.

Thanks

 

9401 counting erroneously from quadrature encoder

$
0
0

I'm using a 9401 module in a 9188 chassis to measure position of a shaft in 1E6 count/rev. The signal is an emulated AQuadB out from a Kollmorgen AKD servo drive. My problem is that when the drive is enabled, the noise it makes it being picked up as extra positive counts by the 9401. The drive has RS485 outputs, but my cable length is short and well shielded, so I thought it would work okay. It's wired like this:

 

9401 CTR1 channel

A+: 9401 pin 20

B+: 9401 pin 23

GND: 9401 common

Cable Shield: 9401 common

 

Is this occuring since the encoder signal is differential, or is my grounding/shielding not correct? If I disable the encoder entirely the 9401 picks up a solid zero. Should I use some sort of converter from the RS485 to TTL?


How can I use a 6341 to provide a hardware clock to a program (ie 1 Second ).

$
0
0

I want to acquire a temperature reading from a 6341, at a 1 second rates.

Does the accuracy of a PXI-6602 improve with a PXI-6608 in slot 2 driving 10MHz PXI backplane?

$
0
0

Can I improve the accuracy of a PXI-6602 module in slot 3 of my PXI chassis if I use the OCXO clock of a PXI-6608 in slot 2 to drive the 10MHz backplane clock of my PXI chassis?  If so, how is it improved?  The 660x instruction manual shows that the 10MHz backplane clock drives the Phase Lock Loop of the 6602, but I'm not sure how that affects the overall accuracy.

How To output the PXI-6608 OCXO to PXI_CLK10_IN

$
0
0

Hi!

I am trying to make high accuracy measurements with the PXI-6608.

I am using a 3rd party PXI backplane which has no StarTrigger slot that would override the PXI_CLK10 automatically with the PXI-6608 OCXO output PXI_CLK10_IN.

 

It appears that the PXI-6608's OCXO has no direct link to the time source of the counters but that instead the time source can "only" be PLL-synced to PXI_CLK10 signal of the backplane. Is this correct?

 

I tried to measure the high accuracy OCXO output on PXI_CLK10_IN but got nothing. What needs to have the PXI-6608 output its OCXO clock to PXI_CLK10_IN?

 

ThanXs for your help, Hezapeter

PWM with CompactDAQ 9174 on a DO-Module

$
0
0

Hi all
We did a regulation of peltier elements with PWM with a cRio over FPGA on a DO-Module 9477.
We have now a small project with a CompactDAQ 9174 where we would like to regulate such peltier elements. The Frequenze should be at least 5 kHz.
As I found in the forum and the examples, with the intern counter/timer of the cDAQ9174, it is possible to generate a digital pulse train and with the duty cycle  also a PWM.
e.g.:
http://forums.ni.com/t5/Counter-Timer/Counter-Output-with-NI-cDAQ-9188/m-p/2218208#M10898
http://digital.ni.com/public.nsf/allkb/ADFC4DD8C9690232862575B70079FBD4

What I could not found, is a way to get a generatet PWM-signal out of the intern cDAQ to a DO-Module (S-Serie) such as NI7477. And I do not see the way to do it.
I have to mention, that I'm not a top-programmer, and I'm sure, that there is somone out there, who already has done this.

Thanks in advance for help
Hannes Wydler

USB 6210 - how to divide down counter input for analog timing source

$
0
0

Hi all,

 

I've got a problem with my USB-6210 configuration.

I'm kind of new to DAQMX, thus I don't know how to handle this.

 

I've got a setup running, which uses CNT0 from the USB-6210 to read an encoder (A and B)

This Counter signal is used as the timing clock for reading two analog values. So I get two analog values each time the counter value changes.

 

This works fine till now.

 

Our new machine setup has a new very fine resolution encoder (now 1µm, it was 20µm) and is faster then the old one (nearly twice as fast).

 

That leads to problems, because the USB 6210 isn't fast enough to aquire analog values for each counter change.

 

My suggestion is to divide down the encoder signal by using the second (available) counter of the USB 6210.

 

As a result I would like to get the 2 analog values and the counter value each (lets say) 20µm.

 

Could someone point out what I have to do to get this running, please ?!?!

 

I attached my DAQ Handler as it is now. The missing VIs are:

1. a functional global containing the Command Queue

2. a functional global containing the Results Queue

3. an Errorhandler

 

the values recieved for init are stored as default values in the "setup values" control now.

 

Thanks in advance, best regards


Balze

 

Viewing all 1243 articles
Browse latest View live


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