anyone can program a simple 8 pin micro controller ic to push switch single push on and push off

Thread Starter

rftechnologies

Joined Feb 1, 2018
5
any one have program of sigle push on and single push off program ,
for any 8 pin mcu,

Ie,
need to get a program for 0v and 5v for every push,
we are using momentary tactile push button,
the ic on time starting time required 5v output , then we press the button the five volt goes to 0v , again we push the button 0v goes to 5v
process repeated every push.

the same process we done with a 555 ic, but it is not stable, and again we used with another ic 4013, it is also not stable,


4013_sch.gif4013_basic.gif 555.png


these 3 circuit are not stable, so we need to do same circuit with a programmer ic, anyone have better subjection,

the programmer ic starting time required output is high at 5v and after pressing the push button output is 0v , and after press 5v out put, repeatedly ..



anyone have better circuits with small 8 pin mcu, pic ic , and program

waiting for a better discussion.


Mods Note:
Please don't show your Email address on the forum that it could be bring the spambot to our forum and your Email account.
 
Last edited by a moderator:

philba

Joined Aug 17, 2017
959
You switch is bouncing and causing your FF to do a random number of transitions. A low pass filter may fix the problem. A 100nF cap may work though I would use a 10K resistor and 100 nF cap between the switch and the FF's CP inputs to be really sure. See the second image. If 10K is too much, use 1K and and 1 uF. You could also try 10K and 1 uF for a more aggressive LPF.

simple lpf.png
 
Last edited:

Thread Starter

rftechnologies

Joined Feb 1, 2018
5
I tried many, need to switch in membrane panel, so switch is caring with wire, some frequencies affected.


So preferred the digital circuit
 
Last edited by a moderator:

Threeneurons

Joined Jul 12, 2016
30
From Don Lancaster's CMOS Cookbook:


Or,

Since you're using a microcontroller, its probably time to learn how to write a "debounce" routine. That's part of the magic of microcontrollers ... saving component count, and doing it in software. Also time to learn about timers, and timer interrupts. Set up a timer to interrupt between 10 to 40 milliseconds. Hook up the switch, so it presents a logic one (high, or 5V if 5V supply), when its pushed, to a uC input port. Every timer interrupt, read this pin. If it reads low, and the last_switch, is also low, set the Idle flag, and save "0" into last_switch variable, and exit the interrupt routine. If it reads high, compare it to the last_switch variable. If last_switch is low, save high to it and exit. If both are high, and Idle is also high, toggle your output port bit, clear the Idle flag. It won't toggle again until you release the button, getting a good "idle", then being depressed again. This should be an early lesson, when learning how to use microcontrollers. It was, when I was taught to code an 8085, when dinosaurs roamed the earth.
 
Top