Continue to Site

Why have to Reset in 8052 ?

Status
Not open for further replies.

Longmcx

Junior Member level 1
Junior Member level 1
Joined
Sep 28, 2004
Messages
19
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
147
Hi everybody!
I have a little trouble with my project. I use 8052 to communication with my computer by Serial port. when my computer sent a char 'a' to 8052 then 8052 will sent back to my computer char 'b'. But this work properly if i click Reset on 8052 board. if i want to continue, i have to click reset again.I use Keil C.
// sfr have right value
void main(void)
{
while(1)
{
ch = _getchar();
if (ch == 'a')
putcha('b');
)
}

Please help me!
thanks for your attention!
 

i just want to share my experience. Once i also had the same case, my micro would get 'hang' everytime it drives a DC motor. The solution was to separate the ground tracks for high current purposes (motors, relays, etc) with the ground for digital system part.

In other words, we should always never forget about power supply noise (noise in Vcc or ground), that is why we should put decoupling caps near the Vcc pin of the micro.

I also had some unpredictable microcontroller behaviour which was caused by stack overwriting data part, or not enough RAM space for stack, or because of wrong initialization of stack pointer.

As for your program, i cant tell for sure because i am not familiar with C library functions. Usually i do UART communication the old fashion way (adopting the way we do it in ASM, but now using C language instead of assembly).
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top