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

No pulses generated!

$
0
0

Hey!

I am having trouble with generating a PWM signal using a counter channel on our NI-6733 card.

I use the DAQmx VIs to: Create a task (frequency = 50 Hz, duty cycle = 0.07) - set the task to finite samples with a certain number of samples - start the task - wait until they've been written - stop the task (is that actually necessary?) and delete the task.

 

I check the output with an oscilloscope. If I run the VI, only some times the pulse train is generated and sometimes nothing happens.

 

The same happens when I use MAX and create a pulse train with the "test panels" dialog.

 

It seems to me like there's a hardware problem, how can I investigate what's the problem?

 

Does anybody know this issue? Am I doing something wring? Thanks for any help!

Best,

Steve


generating two synchronized, finite and retriggerable pulses with different frequencies

$
0
0

Hi,

I am using a PCI 6031E card with SCB-100. I am working on generating a pulse train for a camera used in optically accessible test engine. The engine has a crank angle encoder producing pulses with freq 30-60 kHz (0.2 deg resolution, range 1000RPM - 2000RPM, is working in the attached program as source of ticks). The spark time pulse is a trigger for the camera pulse train. The pulse train should be generated for specified number of cycles (or number of trigger events). The camera should obtain a pulse train that after trigger has 20 pulses with very high frequency and after that 4 pulses with low frequency. When the engine cycle ends, the program is retriggered for next cycle. I was thinking about generating the pulses on two ctr outputs and then multiplexing it by simply joining the cables (If it would be possible to generate such a pulse on one line I would be very happy). I managed to generate the 20 initial pulses but unfortunately it is not possible to generate second pulse due to this. I was also thinking about generating the second pulse on digital output, but the card does not allow due to this. I was also trying to use a pause trigger, but the program showed error, that there cannot be a start and stop trigger (also tried with reference digital edge trigger).

 

 

Somebody have idea how to solve this problem ? I would appreciate any help.

 

In the program the trigger is attached both to PFI and digital input line. Source of ticks is the encoder

 

Thank you for support

Greg

PFI channel crosstalk, Error Code: -201314

$
0
0

Hi everyone,

 

I would like to perform multiple externally synced edge counting tasks on an NI PCIe-6353.

The problem is that I get crosstalk of the pulses between the PFI channels, leading to misinterpreted sample clock pulses and eventually to the error -201314:

'Multiple Sample Clock pulses were detected within one period of the input signal. Use a Sample Clock rate that is slower than the input signal. If you are using an external Sample Clock, ensure that clock signal is within the jitter and voltage level specifications and without glitches.'

 

I am counting pulses from APDs, they have a height of 5V, width of 20ns and a  rate of approximately 1MHz. My sync Signal has a repetition rate of 10kHz, the pulses are 5V high and 50µs long. When I start the measurement, it takes only a couple of seconds until the mentioned error appears. I can also validate it with the NI-MAX, by 'counting' pulses in my sample clock input channel even if there is nothing attached to it (only the APD to the counter channel).

I have tried the following combinations:

 

sample clock connected to: PFI 0, PFI 5, PFI 1

counter connected to: PFI0, PFI 5, PFI 8, PFI 3

 

they all fail except when I use the PFI8 as only counter source.

Also, damping the pulse edges with a lowpass or adding a 50 Ohms resistor to the connecor does not work.

The connection cable to the breakout box is 0.5m long. I have tried the SCB-68A and BNC 2110 Breakout box without much change in the behaviour.

 

Is there a way to better isolate the PFI channels, or are there channels that are isolated better from each other?

 

Thanks for the help

Fabian

 

quadrature encoder counter with 8 channels

$
0
0

Hi,

 

I need to acquire the signals (A and B) of four quadrature encoders. The signals have a maximum frequency of about 5kHz and should be read out with about 100 Hz. Is there a device that fulfils these requirements? It seems that a frequency of 5kHz is no problem since e.g. the USB-6008 has a counter for frequencies up to 1 MHz. However, I can't find a simple low-cost device that provides several counters. Does anyone know such a device with 4 or 8 counters?

 

No other analog or digital channels are necessary, but a USB connection and Matlab support would be ideal.

 

Thanks in advance.

NIDAQ (Legacy) Counter GPCTR_Control() status error -10033[invalidWinhandleerror]

$
0
0

Hi,

 

I'm trying to duplicate an XP installation of some custom software that uses a compiled C-code to manage the driver for our PCI6602 board (w/ BNC-2121 block). When I run the code, I get the status error -10033. This apparently corresponds to the invalidWinHandleError in the function reference manual. Unfortunately there isn't much to explain what it really means and how I might fix it.

 

I am not very experienced in C and only took some C++ several years back. We use Matlab to compile the C-code in mex. I've managed to pseudo-debug the code to find that the first thing(hopefully the only thing) wrong is in the GPCTR_Control function wherein it generates the -10033 status. I've attached the C-code we use for reference. I've already worked with a support tech at Mathworks to make sure the error is not in the compilation end of things, which is how we found this status error.

 

Any help that can be provided would be greatly appreciated.

 

Thanks,
Mike

Speeding up quadrature encoder read out

$
0
0

Hi,

I`m using a quadrature encoder together with a 6259 DAQ Card and BNC2110 Terminal Block.

I managed to have it working with the DAQ-Assistent at 80Mhz using the Counters and reading one value at a time. Before the DAQ-Assistent I used a DAQmx command to connect PFI10 and PFI9 as the BNC2110 Terminal only outputs PFI0-9. This works but it is really slow, the distance between each measurement point is around 6 us. The VI is in the attachement (AquadB_one_value.vi)

So I thought I might use the n-values version with the DAQ-Assistent but this does not work and I dont see any reason why, it is complaining about that connection between PFI10 and PFI9 which it didnt do before in the one-value-version. The VI is also in the attachement (AquadB_n_values.vi)

I also tried another method using a VI I was given some time ago and modified it but here the distance between each measurement point is also around 6us. This VI is also in the attachement (Counter - Read Encoder.vi)

 

Or am I missunderstanding something? The minimum achievable time distance between measurement points should be 1/80.000.000 s where of course the value can only differ 1/0/-1 because it has only calculated one new change in the A and B Signals right? I thought with using the n-values it is storing all the calculated values in the memory and I am transferring them afterwards for doing all the "post-processing"?

 

If I am wrong, how can I spped up the read-out of the calculated values any other way?

 

Best regards

 

 

MP5S to NI DAQ6002

$
0
0

Hi!

 

A have no instrumentation background and wants to try my luck here.

 

Has anyone use Autonics MP5S counter? Here is the manual 

I want to connect it to my NI DAQ 6002 and use the counter options.

Can someone help me?

 

specified timeout expired

$
0
0

I'm running into an issue with NI 6601 card throwing an exception.

 

The exception is:

Specified operation did not complete, because the specified timeout expired.

Task Name: _unnamedTask<6F>

Status Code: -200474

 

It happens after I configure the counter as such: 

 

///////////////////////////////////////////////////////////
// Setup and start CWCounter1
CWCounter1Task = new Task();
CWCounter1FirstEdge = CITwoEdgeSeparationFirstEdge.Rising;
CWCounter1SecondEdge = CITwoEdgeSeparationSecondEdge.Rising;
CWCounter1Task.CIChannels.CreateTwoEdgeSeparationChannel("Dev1/Ctr1", "Inbound",
minVal, maxVal, CWCounter1FirstEdge, CWCounter1SecondEdge,
NationalInstruments.DAQmx.CITwoEdgeSeparationUnits.Seconds);

CWCounter1Reader = new CounterReader(CWCounter1Task.Stream);
bCounter1Configured = true;

 

This is in C# and I have the latest NI DAQMx drivers as of this writing.

 

The issue is that it doesn't happen all of the time.  I'll get through 100 cycles of setting up the counter and reading the value before I'll get one.

 

I have another machine with PCI-6601 and it doesn't exihibit this issue.  I may get one every once in a while, but nowhere nearly as much.

 

What would cause this exception?  Is the PCI-6601 not supported properly in the latest version of the NI DaqMx driver?

 

Thanks in advance


synchronize 6602 4472

$
0
0

I have some problem to synchronize my NI hardware.

I start reading the daqmx introduction and the synchronize examples but still found no solution.

Attached is the "working" approach.

With that it is possible to continously read the voltage and the position but the values do not correlate to each other.

After every 1000 positions read there is a huge step between.

As a first approach it would be really great if it would possible to read 1000 samples per channel from my ai card and correlate the read 1000 samples from the ctr.

But it would be really great if it would be possible to read n samples from the ctr and correlate them with the samples from the ai.

As an example 2 positions per voltage should be acquired, so only every second value should be at the same time measured compared to the position. (It would be really nice if could say something about the realtime ability from this approach)

It must be possible to read at least 10kHz from both (per channel for the ai).

 

What did I wrong and what would be the right approach?

 

Hardware:

PXI-6602 for the linear encoder

PXI-4472 for the n channels voltage

Edit: OS: W7Pro

how to execute a loop for every 15 minutes

$
0
0

how to execute a loop for every 15 minutes or 30 minutes constantly...

Gated count edges cDAQ-9188 with NI-9402

$
0
0

Hi! This discussion is a branch from this one.

 

Shortly, I want to count random pulses from a photon counter, which emits pulses only when its gate is activated (and this should be done in HW-timed manner), only when the gate is active.

 

I separated this task in two: to HW-timed emit gate pulses and to count edges when the gate is active. For the second task I created a VI:

 

gated CI duplicate count prevention.PNG

could anyone who is more experienced please tell me, if I am doing it in a right manner? I am a little bit confused about how to wire my device: random TTL from the photon counter should go to PFI0 of ctr0 (in NI-9402 this is the 0 pin) and what I generte from the first task (actually, HW-timed gate pulses) then should be wired both to the gate terminal of my counter (left unwired above) and to the gate input of the photon counter... There must be a mistake in this, I guess (otherwise I must split a wire giving my output from the first task and connect it to the PFI1 and to the photon counter gate input).

NIDAQBase Counter (NI-6008)

$
0
0

OS: Mac OSX Yosemite 10.10.1

NIDAQ: USB-6008

Driver: NI-DAQmx_Base 14.0.0

Environment: Xcode 6.1.1

 

I'm trying to get the frequency measurement function to work on my mac, and I'm running into endless problems:

(Note: I've developed the same code on a Windows machine where everything work as expected.) 

 

First of all, I can get only a single example from the "Examples" directory to run, but only using it exactly as it is. If I change anything, it doesn't work. For example,

 

changing DAQmx_Val_Falling --> DAQmx_Val_Rising I get the error code: -200077: <err>Requested value is not a supported value for this property.

 

If I change: 

DAQmxBaseReadCounterScalarU32 --> DAQmxBaseReadCounterU32 I get the error code: -200428: Value passed to the Task/Channels In control is invalid.

 

If I copy and paste the example code: (and run with and without the minor modifications shown below)

 

staticint gRunning=0;

void main(int argc, char *argv[])

{

    // Task parameters

    int32      error = 0;

    TaskHandle  taskHandle = 0;

    char        errBuff[2048]={'\0'};

    time_t      startTime;

    

    // Channel parameters

    char        chan[] = "Dev1/ctr0";

    

    // Timing parameters

#define     bufferSize 100

    

    // Data read parameters

    uInt32      data[bufferSize];

    int32      samplesToRead = 100;

    float64    timeout = 10.0;

    int32      read;

    

    

    DAQmxErrChk (DAQmxBaseCreateTask("",&taskHandle));

    DAQmxErrChk (DAQmxBaseCreateCICountEdgesChan(taskHandle,chan,"",DAQmx_Val_RisingFalling,0,DAQmx_Val_CountUp));

    //DAQmxErrChk (DAQmxBaseCfgSampClkTiming(taskHandle,clockSource,sampleRate,DAQmx_Val_Falling,DAQmx_Val_ContSamps,samplesPerChan));

    

    DAQmxErrChk (DAQmxBaseStartTask(taskHandle));

    gRunning = 1;

    // The loop will quit after 10 seconds

    startTime = time(NULL);

    while( gRunning&& time(NULL)<startTime+10 ) {

        DAQmxErrChk (DAQmxBaseReadCounterU32(taskHandle,samplesToRead,timeout,data,samplesToRead10,&read,NULL));

        printf("Acquired %ld samples\n",read);

    }

    

Error:

    if( DAQmxFailed(error) )

        DAQmxBaseGetExtendedErrorInfo(errBuff,2048);

    if( taskHandle!=0 ) {

        DAQmxBaseStopTask(taskHandle);

        DAQmxBaseClearTask(taskHandle);

    }

    if( DAQmxFailed(error) )

        printf ("DAQmxBase Error %ld: %s\n", (int long)error, errBuff);

    return0;

}

 

I get the error code. -200428

 

Summary: 

DAQmx_Val_Fallingdoesn't work

DAQmxBaseReadCounterU32 doesn'twork

 

Any help would be greatly appreciated.  

 

 

PWM pulse generation 6211

$
0
0

Hi all,

I’m quite a newbie with Ni meas. I wanted to make a signal generation/meas application and the NI 6211 USB came in hand. No need to say that the chance to use it would facilitate the task incredibly by integrating signal generation, meas. and data processing

 

My application is quite easy: I wanna generate a PWM pulse, this pulse consists of two parts, the first 10ms with a 80% duty cycle and the second part that is 20 ms with a 50% duty cycle.

 

Initially I thought about using a microcontroller, that is, to program a timer with the first pulse length and a second to generate a PWM, the end of the first part would trigger an interrupt and in there I would program the second pulse length and the second duty cycle. This reprogramming would take microseconds, there would be no delay and both pulses would be connected seamlessly.

Since the NI 6211 USB has two timers, I thought that maybe this behavior would be also possible (through interrupts or combinatory logic). If not, the variables should be changed via software and USB, increasing the time between pulses and making it less predictable.

 

My question is: Would be the microcontroller-like (real time)  behavior possible? How?

 

Thank You Very Much

Joox

Counter Output/Counter Input PXI Signals Behaving Erratically

$
0
0

Question for all your LabVIEW guru's out there,

 

I am running a frequency loopback test using the NI PXI 6229 MIO DAQ card.  I am generating a "Counter Output" pulse train signal which feeds through my device under test and then back out of my device under test and back into the PXI 6229 for a "Counter Input" frequency measurement.  Both the "Counter Output" and the "Counter Input" are assigned different PFI lines using DAQmx in LabVIEW.

 

I have 4 lines to test on my DUT.  All four lines run this same frequency measurement but with different PFI lines on the PXI 6229.  Each line is test independently.

 

This is my setup for the 4 lines:

Path 1: P2.0 (Counter Output - Pulse Train) -> DUT (Device Under Test) -> P2.1 (Counter Input - Frequency Measurement)
Path 2: P2.2 (Counter Output - Pulse Train) -> DUT (Device Under Test) -> P2.3 (Counter Input - Frequency Measurement)
Path 3: P2.4 (Counter Output - Pulse Train) -> DUT (Device Under Test) -> P2.5 (Counter Input - Frequency Measurement)
Path 4: P2.6 (Counter Output - Pulse Train) -> DUT (Device Under Test) -> P2.7 (Counter Input - Frequency Measurement)


where:
P2.0 = PFI8
P2.1 = PFI9
P2.2 = PFI10
P2.3 = PFI11
P2.4 = PFI12
P2.5 = PFI13
P2.6 = PFI14
P2.7 = PFI15

 

I have a LabVIEW VI which generates the "Counter Output" and reads the "Counter Input" frequency.  I am seeing weird behavior from the PXI 6229 card. I can test "Path 1" and "Path 2" and the frequency I read is what I generated. No issue there. However, when I test "Path 3" and "Path 4" the frequency measurement is erratic.  The readings are two different frequencies repeated over and over again and none of those frequencies are the expected frequency which was generated out of the "Counter Output."  If I reset the card, and start by testing "Path 3" and "Path 4" the frequency readings are correct and the erratic behavior is gone.  However, when I try to then test "Path 2" and "Path 1" now those lines have the erratic frequency issue. I can continue resetting the card and see same issue. The PFI lines that I test first will always pass.

 

To summarize:

 

Steps Taken:
1. Test Path 1 = SUCCESS
2. Test Path 2 = SUCCESS
3. Test Path 3 = Erratic Frequency (Two Frequencies repeated over and over again in my frequency results array)
4. Test Path 4 = Erratic Frequency (Two Frequencies repeated over and over again in my frequency results array)
5. Reset the PXI 6229 Card
6. Test Path 3 = SUCCESS
7. Test Path 4 = SUCCESS
8. Test Path 3 = Erratic Frequency (Two Frequencies repeated over and over again in my frequency results array)
9. Test Path 4 = Erratic Frequency (Two Frequencies repeated over and over again in my frequency results array)

 

I am wondering if Port 2 (P2.0-P2.7) on the 6229 card has certain dependecies and this is why I am seeing issues.  I am trying to get around this issue so that I don't have to always reset the card.

Are P2.0-P2.3 (PFI8-PFI11) and P2.4-P2.7 (PFI12-PFI15) treated differently or require different setup?  How do I resolve this issue?

 

Thanks so much!

adjustable DI threshold

$
0
0
Hello,

I have a 9402 DI card I'm using in a 9139 cDAQ. I'd like to take some PWM voltage measurements and do some sort of counter scheme to back out RMS values, harmonics, etc. However, the voltage is (nominally) 220 V (on), and all I have are 100x attenuation probes, knocking my "on" voltage to ~2.2V (well below the "on" level for traditional 5V TTL). Does anyone know if there's a way to adjust the on/off threshold voltage for a 9402 card (or just general LabVIEW tricks with DI/DO)?

Thanks!

How to Plot number and string in one row (data logger counter) ?

$
0
0

hi all i made data log quantity using Digital Counter via modbus to monitoring quantity and reject that has and Name Operator, Machine and Part Number.

i have problem about plot the number & string in one row, as shown on the picture below :

Tabel.jpg

how to move that string on one row ? i attach my vi.

Thanks~

how can we change output pin for counter in X series daq

$
0
0

hello every one...

If this question is repeated then forgive me and direct me to that.

 

I am using X series DAQ USB-6343. In specific instant i want counter output at specific pin and then agian for other requirement i want it to other pin. plz so me some path. i try to find thing but i was not luck...

 

thanks & regards,

multiple waveforms with different start triggers

$
0
0

I have four waveforms, AO0, AO1, AO2, AO3 - I want to have each waveform start with a different start trigger, PFI3, PFI4, PFI5, PFI6 respectively.  When I attempt it, it says the clock resource is already in use.  How do I share the clock for the different waveforms?

 

Can this be done on the NI-6722?

 

Thanks

Bill

Encoder signal processed by DI or AI only (without using HW Counter)

$
0
0

Hello,

we have no free Counter on NI PXI card and don't want to buy another only due to adding 1 encoder signal (no high speed).

 

Do you know some reliable common ways how to acquire and process encoder signal by digital or analog input only (without using HW Counter) + LabVIEW software?

 

Thank you for your advices.

trigger N times

$
0
0

I am using a 6363. I would like to trigger off an incoming synchronization pulse exactly N times. These pulses are coming in the ~dozen kHz range.

 

My first idea was to make a count ticks CO task on the same pulses and hook it up a pause trigger, but pause triggers only apply to continuous acquisiton.

 

My next idea was to hook up the count ticks CO task as an arm trigger set to 'Good to go if it's high' and not 'arm on rising edge', but it seems that's not in the cards either.

 

Another idea was to use the incoming sync pulses as a sample clock on a binary waveform of 10101010101 (N repeats) and use that as the trigger set instead. But it appears the binary waveform can't be made to advance to its next value on either a rising or a falling edge, so that would trigger every other pulse.

 

Do I need to use a transistor outside the board to do this (with the count ticks CO)? That would definitely do it, but it seems kludgy.

 

SO... Are there nifty efficient ways of doing this? Failing that, is there a way to get the binary waveform to advance on both rising or falling edges?

Viewing all 1271 articles
Browse latest View live