Keil Logo Arm Logo

Discussion Forum

89C51 serial interrupt handling erro

Next Thread | Thread List | Previous Thread Start a Thread | Settings

Details Message
Read-Only
Author
Stephen Yeung
Posted
13-Jan-2010 21:36 GMT
Toolset
C51
New! 89C51 serial interrupt handling erro

technical people,

when I tried to write a menu to 89C51, with header correct header file, 100% sure I correctly sent the baud rate for hyperterminal program in computer to communicate. I turn on serial interrupt buy setting EA=1 & ES=1; I clear RI or TI when I have interrupt in Interrupt service routine(serial() interrupt 4) at every time. However, when I tried to echo the word I typed in hyperteminal, It doesn't show. I compiled in keil c IDE and get hex code. and burn it into my 89C51 chip, it does not jump to the main program. It always stay in interrupt service routine. What's happening?Can you help?

Thanks,
Steve

Read-Only
Author
SBM B
Posted
14-Jan-2010 06:27 GMT
Toolset
C51
New! RE: 89C51 serial interrupt handling erro

hi Steve,

You are clearing the TI as well as RI flag in serial interrupt.
Before doing this disable all interrupt, in ISR, then do whatever you want and at the end of ISR again Enable serial interrupt.

Read-Only
Author
Andy Neil
Posted
14-Jan-2010 07:21 GMT
Toolset
C51
New! It should not benecessary...

... to disable interrupts in the ISR.

Have you looked at the interrupt-driven serial IO example in the downloads section of this very website?

Read-Only
Author
erik malund
Posted
14-Jan-2010 13:18 GMT
Toolset
C51
New! this qualifies as ...

You are clearing the TI as well as RI flag in serial interrupt.
Before doing this disable all interrupt, in ISR, then do whatever you want and at the end of ISR again Enable serial interrupt.

this qualifies as the blind leading the deaf.

Why on earth would you disable an interrupt for a period of time where it can not activate anyhow?

Erik

Next Thread | Thread List | Previous Thread Start a Thread | Settings

Keil logo

Arm logo
Important information

This site uses cookies to store information on your computer. By continuing to use our site, you consent to our cookies.