n00b question - best way to see if circuit is complete
tbare
Posts: 13
First post - be nice
Also, first microcontroller programming - be real nice.
I'm working on a simple project that takes a signal from a piece of machinery, and captures it in a VB .net app.
basically, the machine closes a circuit when i want to capture the counter.
I've got everything working, but want to know if there's a better way to capture a simple "circuit closed" event.
here's what i've got:
Thanks!
Also, first microcontroller programming - be real nice.
I'm working on a simple project that takes a signal from a piece of machinery, and captures it in a VB .net app.
basically, the machine closes a circuit when i want to capture the counter.
I've got everything working, but want to know if there's a better way to capture a simple "circuit closed" event.
here's what i've got:
' {$STAMP BS2} ' {$PBASIC 2.5} btnwrk VAR Byte Btn PIN 3 counter VAR Byte Main: BUTTON Btn, 1, 255, 20, btnwrk, 0, No_Press : counter=counter+1 'Add One to variable counter DEBUG DEC counter ' Display positive count in the debug window No_Press: GOTO Main 'Start back at the beginningIs there a better way than using "BUTTON" to do what i want? (i was using a button for my testing, but now i'm literally just touching wires, and it's working...)
Thanks!
Comments
Try this code and see if this works for
One thing nice about this code routine is that if the input dose not stay HIGH for the hole count then the routine is not run
OR
One thing nice about this code routine is that if the input dose not stay LOW for the hole count then the routine is not run
OR
This might work for you as far as what BOLD type
I hope this help
unfortunately, I'm not sure how long the circuit stays closed, so putting a timer in there is a potential issue (unless i'm missing something...)
admittedly, i'm not an electrician, and this is my first bout with bread boards, resistors, etc... gotta learn sometime, though... may as well get paid for it
But alot of the time I use
IF (cntr = 50) THEN EXIT <.........or less 10 maybe
One thing you can use is an optic sensor like a 4N25 and then you may not need this routine at all but I still you the routine any way my self