LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

daq bnc2120

Solved!
Go to solution

I have NI's BNC-2120 with me. I have configured a counter that counts the signal at CTR0Source.

I have displayed the count every second implementing a timer in a while loop.

 

Now i need to input another source of input (pulses) let's say at CTR1 Source input and then output the value of the previous counter at certain specified pulse number of the new input.

 

E.g. measure the count of the old signal until every 50 pulses of the new input signal.

 

I am not able to do that.

 

I am using NI 8.2. I would be happy if someone could help me on this.

 

Thanks in advance.

0 Kudos
Message 1 of 16
(3,182 Views)

Hello fhs_dur,

I'd like to clarify a few things.

Basically, you have two counters, you want the value of ctr0 to be outputted every 50 pulses of ctr1?

What device is the BNC-2120 connected to and was that LabVIEW 8.2?

Thank you,

Jacob R. | Applications Engineer | National Instruments

0 Kudos
Message 2 of 16
(3,168 Views)

Yes, you are right.

I have NI 8.2 and the way you understood is right.

 

thank you for your reply.

I look forward to hear from you.

0 Kudos
Message 3 of 16
(3,155 Views)

Hello fhs_dur,

Could you not just do this programmatically as shown below?

 

2 counters offset.png

 

Thanks,

Jacob R. | Applications Engineer | National Instruments

0 Kudos
Message 4 of 16
(3,143 Views)

Sorry for very late reply,

Actually the problem is not with the programming but the count.

The count for two counters put in the same program displays the same count.

Both of the counters count only cnt 0 value.

User1 input of the BNC 2120 is connected to CTR0 Source and User2 is connected to CTR1 Source.

 

If only one counter is used in the program the count is displayed for the corresponding counter input but if both of the counter are used, then both of them count the same value and the same counter value i.e. cnt 0.

 

I have attached a very simple diagram for the explanation.

The first picture is the snap of the program and the second one is the result.

I have two different input signals fed into the two inputs.

Regards,

Download All
0 Kudos
Message 5 of 16
(3,117 Views)

Hey there,

It is hard to tell what your program is doing since the majority of the code is in the sub VIs. Usually, you won't see the best behavior if you perform multiple DAQmx calls inside a while loop and open and close the references each iteration. I would recommend to architect the program like one of the counter examples in the the example finder.

Jacob R. | Applications Engineer | National Instruments

0 Kudos
Message 6 of 16
(3,089 Views)

Yes the new program looks like the one shown in the figure.

The purpose is to count the value of counter count0 (above) for every 45 pulses of count1 (below) counter.

Both of the counters are normally increased and with the case structure, the subtraction should normally display the count for count0 for every 45 pulses of count1, but display always 0.

 

I was not able to debug because the value shifted on each loop when the condition is false is the same as the value when it is true, i.e. the subration inside the case structure is always 0.

The requirment is that when it is true the new current value has to be shifted and when the condition is false the same previous shifted value has to be shifted with the shift register.

 

I would be happy if some1 can help me on this.

 

Regards,

Download All
0 Kudos
Message 7 of 16
(3,075 Views)

Hello,

It looks like the code you provided would achieve that functionality. I created the attached simple program which has that functionality.

Is it the attribute value number 2 that is displaying a zero?

What happens when you run the program in highlight execution?

 

 

Jacob R. | Applications Engineer | National Instruments

0 Kudos
Message 8 of 16
(3,061 Views)

The attached Code is provided As Is. It has not been tested or validated as a product, for use in a deployed application or system, or for use in hazardous environments. You assume all risks for use of the Code and use of the Code is subject to the Sample Code License Terms which can be found at: http://ni.com/samplecodelicense

Jacob R. | Applications Engineer | National Instruments

0 Kudos
Message 9 of 16
(3,060 Views)

Thank you for the reply.

The display with 'x-y 2' which should display the count for every 45 count of the counter 1 is the value which is always zero.

This is ('attribute value 2' - 'attribute value 3' ) is the value which is zero.

 

The value of count 0 is shifted when case structure is true and when it is false the previous value should have been shifted.

The problem seems that even in the false case, the current value of the counter is shifted and so always the difference is zero.

This is what i don't understand.

 

Rgrds,

 

0 Kudos
Message 10 of 16
(3,052 Views)