Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

The best way to free up some time on a pic 18F

Status
Not open for further replies.
Mike are you saying that RB.0 will set a flag RB1IF ? like 0 no change 1 you dropped a quarter that I just reset and add a coin to the coin counter.

That is exactly what I'm saying. You'll have to watch for bounce reseting it if you happen to clear it too quickly. A simple way would be to wait 40mS (timed using the display timing) before reseting RB0IF. Assuming your display is running at 100Hz increment a counter when RB0IF is set and when it reaches 4 reset RB0IF and inc coin count.

Mike.
 
Well here's asm code for multi switch debounce (up to 8) with edge transitioning , key press & hold (about a half sec press) AND key click (<1/2 sec press) detection. The method permits using any PORT /pin as an input, no restriction on all switches being in a single PORT.

https://www.electro-tech-online.com/threads/asm-16f-switch-debounce.125273/

For a single switch, u basically detect the contact then wait 20 to 40ms and test for contact again. If so then u have a good pulse. For edge transitioning, u continue to test until the contact is cleared, then wait 20-40mS and test again. If the contact is still cleared then u have a complete pulse cycle of close-open that is debounced.

Edge transitioning is important to be able to 1) detect a key press & hold vs a quick click, 2) Detect a stuck switch.
 
Coin ops in payphones just have a coil and a solenoid, the coil has a few khz ac accross it, as the coin passes the coil it generates its own signature, the software probably being some sort of fft recognizes the signature and the value of the coin, and if the coin is valid the solenoid fires and diverts it to the coin box, at the same time adding credit to the call time, if the coin is bad the solenoid doesnt fire and the coin is returned.
Probably a bit complex for our backyard labs, but you might be able to get a coin op like this with an rs232 o/p.
 
fft= fast fourier transform?

I believe the detector is a Colpitts oscillator which varies in frequency based on the metal and mass. Thus reading the frequency count via the T0CK can assess the coin. Nickels, dimes, quarters and pennies are quite different.
 
Man my counter went wild then i figured out why I had the dang thing reading a floating pin LOL
 
Figured I give a update I have liftoff

I set the timer faster but it settable for hours or minutes
 
Last edited by a moderator:
It works.
What happened to the lcd?
 
I never was going to use a lcd it was only for testing see it plugs in my test board with out hooking a bunch of wires.

But i would use one if I could find a good one the size I need.

See the seven segment handles data over one wire with no overhead.
 
Last edited:
I was thinking after my last post, if I was sat drying my cloths at the bagwash I wouldnt want to have to keep getting up to squint at a little 2x16 lcd, larger 7 segs are much better to read from a distance.
I have a really big 2x16 lcd (I only ever use it for testing as its not backlit), and they also make larger vfd ones, but you wouldnt want to pay for one, 100 quid plus.
I use my version of romans 1 wire lcd, very handy, and it doesnt restrict the processor time slot or speed wise, I adapted it for one project where there was just 2 wires (bell wire) from the board to the lcd.
 
Last edited:
Status
Not open for further replies.

Latest threads

Back
Top