LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Counting events using a USB-6008

Hi,

I am using a USB 6008 as a simple counter.

I am using a relay to pull the counter input to gnd.

However I cant seem to get it to count just one time, ie sometimes it increases the count by one sometimes by 100.

What am I doing wrong, I am using the VI from the example folder and I have attached it below.

Thanks

Tony

0 Kudos
Message 1 of 5
(4,137 Views)

Tony,

 

Relay contacts bounce.  That bounce may result in multiple openings and closings of the contacts over a few milliseconds for each operation of the relay.  The counter can count 100 ns wide pulses at up to 5 MHz so it may see all of the bounces as extra counts.  I think the 6008 counter circuit does not include any internal debounce options. So you will need to debounce with external circuits.  A simple resistor/capacitor low pass fitler might work, although the counter input circuit may not like the slow rise time.  A multivibrator configured as a pulse stretcher is another option.  There are many others.  Search the web for contact debounce circuits.

 

Lynn

Message 2 of 5
(4,122 Views)

Thanks Johnsold,

I think I have solved it by taking the signal from my daqassist and putting it through a index array to trigger a case structure.

Within the case structure I have placed a delay, which allow time for the contacts to settle before incrementing the counter.

Thanks again.

Tony.

Message 3 of 5
(4,103 Views)

Tony,

 

That is an interesting idea!  Always good to have multiple ways to solve a problem.

 

Lynn

0 Kudos
Message 4 of 5
(4,099 Views)

Could you please attach example of your solution.  How did you manage to make a delay for counter? You used ordinary DI and increment instead of counter input PFI0?

0 Kudos
Message 5 of 5
(4,066 Views)