Basic Counter Problems


jasontehman

Recommended Posts

I'm trying to look at the basic counter example (basiccounter.ctl) and I'm using a mechanical switch hooked up through a digital input on a LabJack U3-HV. However when I press the switch, it doesn't count just one, it counts what seems to be a random number between 1 and 80, and then adds it on to the total count. Why is it doing this and how can i fix it?

Link to comment
Share on other sites

This is because mechanical switches "bounce". This is very common and exists on any mechanical switch. You need to use a debounce circuit (see any basic electronics manual) or use the debounce Timer mode of the LabJack. I'd talk to the LabJack folks about it as they are more familiar with the hardware side of things.

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.