Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

8051 hardware problem

Status
Not open for further replies.

aliraza786

Full Member level 4
Full Member level 4
Joined
Nov 10, 2009
Messages
210
Helped
14
Reputation
28
Reaction score
14
Trophy points
1,298
Location
Lahore, Pakistan, Pakistan
Activity points
2,914
hi....i want to ask a question when i simulate the hex file in protious everything goes fine but when i burn the hex in 8051 and put 89s51 in circuit and at that moment i apply power after that for a very short interval of time all the pins of 8051 goes high and after that it start following the code written inside..a very short pulse i recive at the start is disturbing my circuit and i couldnt find any solution for this..help me...plz
 

Have you provided a proper reset on start up,if not check out the datasheet for proper reset requirements.Or may be their is something wrong in your code so you can try to post it here.

Good Luck
 

is it like , after reset , the port connected devices behave madly ?
 

#include<reg51.h>
unsigned char gsm[9]={0,1,2,4,8,16,32,64,128};
sbit led=P1^1; unsigned int k,i,j,l,m; sbit sw=P3^1;
void delay()
{
TMOD=0x01;
TL0=0x67;
TH0=0xFC;
TR0=1;
while(TF0==0);
TR0=0;
TF0=0;
}
void mdelay(int x)
{
for(m=0;m<x;m++)
delay();
}
void call()
{

P1=gsm[4];
mdelay(1000);
P1=gsm[0];
mdelay(500);
P1=gsm[2];
mdelay(1000);
P1=gsm[0];
}
void on()
{
P1=gsm[0];
for(j=0;j<5;j++)
delay();
P1=gsm[8];
mdelay(5000);
P1=gsm[0];
mdelay(15000);
}
void main()
{ P1=0;
if(sw==1)
{
mdelay(50);
if(sw==1)
{
on();
call();
while(1);

}
}
}


____________________________________________________
this is my code i dont know how to apply proper reset at startup....plz tell me how to do that..thnks.

---------- Post added at 17:02 ---------- Previous post was at 16:59 ----------

srizbf no just after powering the circuit device attached to port behave madly for a very short period of time and after that every thing goes fine..and i do ot reset the controler i off the power to reset becuse i ahve no button a this time available..
 

Ok, Hello aliraza
which capacitor and resistor value are you using for reset circuit?? use 10µf capacitor and 10k(or 8.2k) resistance?? It is normal for a microcontroller to reset immediately(during which all port are high) after supplying power but for a very very short time!!!
 

ya i am using 10k and 10uf capacitor but after applying power ports high for a very very short interval but enough time that in which a relay conected to the circuit actiavte and the circuit attached to the relay activated thats the problem basically.........!!
how to reset after start up mean powering the ciruit is is it done by coding..??
 

i apply power after that for a very short interval of time all the pins of 8051 goes high and after that it start following the code written inside
That's by design of x51 processor and can't be avoided. All port pins, that have an internal pull-up, e.g. P1 will go to high state during power-up and reset. Your external circuit must be designed to deal with this behaviour. In some cases, you may need to invert a signal. Basically, there's no problem if all signals are defined active low.
 
ohhh its just fine .. Invert your signal--> you can use transistor(such as bc547,bc548 etc.) for inverting it(basically a not gate).
What i mean is, use low signal to activate relay and high for normal state(to keep it d-energized)!!! so if it resets, all ports will go high and after that it will remain high due to your code .. there will be a little change in your code and just small addition of transistor in your circuit part!!!

Good Luck :)
 
If it is a very short duration that your port is pulled up, may be you can connect a small capacitor which will not effect your port set/reset time so much.
It can keep IO port pulled low for a moment at the start up. But just a workaround, not much recommended.
 

It is power on reset..Actually what happens is When power is turned on the(capacitor and resistor) circuit holds the rst pin high for an amount of time that depends on the capacitor value and the rate at which it charges..
(aa.bmp)Thats the schematic for reset circuit it will work fine but it is incomplete .. if u want to reset your microcontroller of your own add a tack switch as shown below :-
ioi84.jpg
 

Hi aliraza;
During start up capacitor begins to chare up and your port voltage level change slowly. Hopefully your cct will not be trigged during this time. And then your software takes the exact controls on the IO ports. (by the way put port control commands at very early stage of your code, just at the beginning if possible).That is the idea.
It needs some trial and error to determine correct cap value, a kind of optimisation. Becasue that capacitor (form your port to gnd) also delay any port set/reset signal always (during run time). So if your applicaiton is so time critical one, it may disturb the applciaiton.
At the end you should try, see and decide. But best solutiın is hardware inverter.
Good luck
 

where r u from ali raza? i know it is not forum to ask you but it is important for me. If u r from lahore can u plz tell me that what is the price of 89c51 and 89s51 by atmel at hall road? I have not any electronics background or knowledge but mcu is a point of interest for me these days so i have dome some abc and turn on leds on pic16 mcu as i cant find the even a single chip of any mcu but any crystal in my city sahiwal :p
 

Of course emeresel is right . . Yes you can try it, use a capacitor, earlier i too was going to suggest you that but as i did not tried that(but i think it will work) so i told you other method.. if it does not work for you then invert the signal it will definitely work ..
Good Luck :)
 

It is power on reset..Actually what happens is When power is turned on the(capacitor and resistor) circuit holds the rst pin high for an amount of time that depends on the capacitor value and the rate at which it charges..
(aa.bmp)Thats the schematic for reset circuit it will work fine but it is incomplete .. if u want to reset your microcontroller of your own add a tack switch as shown below :-
View attachment 60196
actually i want some better solution. the problem is brown out . as in pakistan the failure of electricity is as common as you are taking breath but most important to note is that the brown-out is double the time of failure of electricity. and even no one can beleive that the 220 volt ac from main power line also have powerful surges becoz the transformer are old enough to scrap. so one thing is to have big caps in power supply so that the brown out can be ignored . second is that there should be some kind of better network to dischage the capacitor more quickly. as i have told that i have no back ground of science and electronics so may be my question is foolish but i am just asking it for knowledge :p
 

Hey d@nny,
Actually i didnt get you? What question are you asking?
But you are Right thats why large capacitors(about 1000uf.., 2200uf ..) are used in power supply circuit(as in 7805 for 5volt regulated supply) . .
but for reset circuit you cannot use large values of capacitor. . sorry i didnt get you, plz be more clear!!!
 

i mean the reset time should be the proper but there should be some thing to descharge the reset capacitor as quickly as possible

---------- Post added at 18:27 ---------- Previous post was at 18:26 ----------

i am using the same 10k and 10uf with ch4013 flipflop but it fails in brownout as the capacitor didnot dishcarge quickly and relay turned on
 

danny price of 89s51 and 89c51 or 89s52 is round about under 130 pkr...tushki you mean that i use logic level zero to activate my circuit conected at port instead of using logic level 1...and i coudnt understand the hardware inverter will you kindly post the shematics of hardware invertor...thnks
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top