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.

Swtch ON Reset

Status
Not open for further replies.

premkumar9

Member
Hi,
In one of my projects where I use 89C2051 microcontroller, I connect one O/P pin to a mechanical counter (through a driver). There is an RC network to reset the MC when switched ON. My problem is when reset during switch ON, my O/P pin goes high and come down thus generating a pulse which the counter counts. I want to avoid this unwanted counting till my program gets control.
Can anyone please suggest a solution? (preferably a tried out one)
 
not using the 89c2051 but I have somewhere in the back of my head that you can set initial states in config .. but this might be a whishfull thinking ( I might heard someone asking about it ) ...

when your uC is switched on, does all your pin's go high/low or only some ... if they all go high/low and you cannot change that in config, you can make a "delay" function in hardware that will "debounce" the uC start. some rc + and gate ... It's just an idea .. nothing proven .. but sounds doable ..
 
not using the 89c2051 but I have somewhere in the back of my head that you can set initial states in config .. but this might be a whishfull thinking ( I might heard someone asking about it ) ...

when your uC is switched on, does all your pin's go high/low or only some ...
All
if they all go high/low and you cannot change that in config, you can make a "delay" function in hardware that will "debounce" the uC start. some rc + and gate ... It's just an idea .. nothing proven .. but sounds doable ..
Delay with hardware may be a possible solution which I also thought of. But wished to know the possibility of
1. Doing with out adding any hardware OR
2. by simplest hardware modification like adding an RC etc.
 
If you cannot disable counter you have to add one AND gate and RC to delay 1 on the "second pin of the AND gate" (the first pin is from your uC, output go to counter).

If you can disable counter, then add a RC that will disable counter until the uC is up and running.

With regards to "without adding hardware" the only possible solution is that you set the initial pin state to input or 0 in config ... I do not get how come they go high, I do not know any uC that on power set all pin's to output and high ... most of them set all pin's to input, and if some are set as output, those are set to 0 and not 1 ...

From what you wrote, I'd say that your uC is powered on, it start the main program, then the RC circuit reboot it and then uC start program again from scratch. This brings me to conclusion that those "set as output high" is actually done in your application and not by uC design... if that's true, all you need to do is be aware of the reset and solve the problem either by
"check the start registers (however is that done with that uC) to see if you were rebooted by RC or POR" or "at the beginning of your application add a delay that is longer then RC time to reset the uC... It will increase the bootup time but will solve you problem in software ...

The first solution is better (detect if you just started or you were reseted by RC)

Sorry that I cannot be of more help but I never used that uC
 
That makes sense.You need to invert the output of that MC pin.Ex: using a pnp transistor etc........& your code will also invert accordingly.

Have you put a pull up resister to that pin?
 
Last edited:
If you can disable counter, then add a RC that will disable counter until the uC is up and running.
Not possible to disable this counter.
I do not get how come they go high, I do not know any uC that on power set all pin's to output and high ... most of them set all pin's to input, and if some are set as output, those are set to 0 and not 1 ...
I cross checked once again now. When the RST pin is connected to Vcc (for resetting) O/P pins go high.
From what you wrote, I'd say that your uC is powered on, it start the main program, then the RC circuit reboot it and then uC start program again from scratch.
No. First the RC circuit resets the IC. Then O/P pin goes high and then low. Then my program starts.
 
That makes sense.You need to invert the output of that MC pin.Ex: using a pnp transistor etc........& your code will also invert accordingly.
Then during RESET my inverted O/P will remain low and at the end of the RESET pulse (given through RC) my inverted O/P will go high(when MC O/P goes low) and remain high till my program makes it low. That means again a pulse will be generated before my program gets control on the pin. Am I right?

Have you put a pull up resister to that pin?
Yes.
 
If your mcu output is normally low, you should use a pull down resistor to sabilize it in the idle mode. This is a problem if your output is an open drain output. The microcontrollers that I'm used to, will normally set all I/O pins to input, and tri-state outputs only. I don't know how your mcu are working, but from what you say, I would think that the driver circuit need a bit more thinking to get right. The general rule regarding power on glitches is to work with the micro not against it, or to make an external disable circuit to be enabled after the correct startup/delay.

TOK ;)
 
Status
Not open for further replies.

New Articles From Microcontroller Tips

Back
Top