Counter/Timer

cancel
Showing results for 
Search instead for 
Did you mean: 

6601 output counter when use Simple event Counting Mode

I want to put the ouput counter in a high, while I count event. How to do that with set attribute?
0 Kudos
Message 1 of 6
(4,070 Views)
I've looked at your program and it appears that you have modified the example code for "Count Edges (NI-TIO).vi that appears in the LabVIEW example finder. The simple event counting that is occurring here is input. This example allows you to count the number of active edges that have arrived on the source of the counter by polling the count register with a software command. However, it appears in your question statement that you wish to output from your counter (your modifications to the example code also indicate this). I would suggest using the "Generate single pulse (NI-TIO)" or "Generate pulse train (NI-TIO)" example from the LabVIEW example finder.

Brian Spears
Applications Engineer
National Instruments
0 Kudos
Message 2 of 6
(4,069 Views)
It looks like you want this vi to count events until you reach some specified target value ('Pulsos'), then stop the counter. It sounds like you'd like the counter's output to toggle high the instant you start counting and toggle low as soon as a certain count is reached.

First off, I'm pretty sure you can't get hardware-timed behavior quite like that. That being said, your posted example appears to rely on software timing anyway -- attempting to call 'Counter Set Attribute' to toggle the output. Soooooo.... why not simply use a digital bit that you can also software time to turn on and off?

Here's a small modification of your example that toggles a digital bit high when the counter is started and toggles low when your target count is re
ached. In your real application, some of the config should probably be done outside this vi, but this'll give you the general idea.

-Kevin P.
ALERT! LabVIEW's subscription-only policy came to an end (finally!). Unfortunately, pricing favors the captured and committed over new adopters -- so tread carefully.
0 Kudos
Message 3 of 6
(4,070 Views)
OOps, just noticed that your posted example was in LV 6.0, so here's an image of the block diagram. The function in the lower right that acts on the DIO bit # is a "logical shift" which can be found in the palette Advanced/Data Manipulation/Logical Shift.

-Kevin P.
ALERT! LabVIEW's subscription-only policy came to an end (finally!). Unfortunately, pricing favors the captured and committed over new adopters -- so tread carefully.
0 Kudos
Message 4 of 6
(4,070 Views)
Thanks Kevin. Are you sure it´s impossible to get that by hardware? look at this answer from an National Engineer:

When doing event counting (count edges of signal), the counter output will pulse or toggle (determined by property node) when the counter reaches its maximum number and "rolls over." You can use this by setting the initial count to your defined number of events and set the direction to count down.
When the desired number of events have been counted, the counter will reach zero and toggle/pulse the output pin.

I believe this is what you are looking for.

Salvador Santolucito
Applications Engineer
National Instruments

Any way I´ve tried to do it unsuccessfully. I´think I don´t know to use well the order of the control cou
nter vi (program and count down) If I can use the two togheter.
0 Kudos
Message 5 of 6
(4,070 Views)
pasqui,

No, I'm not 100% sure. I'm also not sure that the NI recommendation will do quite what I think you want. Nor am I 100% sure that I understand exactly what you want. Let's start there:

1. At exactly what instant should the counter output first go high? When you give a 'program' input to 'Counter Control.vi'? Or not until the first source edge is actually counted?

2. Under what conditions should the output go low? The instant that source edge # 'Pulsos' is received? It should then remain low until the next time you start counting, right?

If you follow the NI recommendation, the counter output will go to its idle state when you program it, the output will toggle after a particular # of pulses,
then will return to its idle state when you reset it.
To make it pulse high while counting, you would need to configure it for negative output polarity. Then it will go high when you program it, and drop low after the right # of pulses. However, it will also then go back to high when you reset the counter. And then it will remain high when your app is done running. So the next time you run your app, the output will already be high even before you start the counter. Is that kind of behavior ok for your app?

-Kevin P.
ALERT! LabVIEW's subscription-only policy came to an end (finally!). Unfortunately, pricing favors the captured and committed over new adopters -- so tread carefully.
0 Kudos
Message 6 of 6
(4,070 Views)