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.

Help me setup the Timer1 overflow Interrupt on 8051 in Keil

Status
Not open for further replies.

SphinX

Advanced Member level 3
Joined
Jan 25, 2002
Messages
822
Helped
58
Reputation
116
Reaction score
29
Trophy points
1,308
Location
EGYPT
Activity points
7,045
8051 Problem?

Hi,

I have setup the Timer1 overflow Interrupt to interrupt every 50ms (to do certain task)
My main program do some task process too.

One of the process is to send serial characters (Using SBUF Register).
It takes a long time to send 3 chars and it send them zeros !

I tried to disable all interrupt "EA=0;" before i send any serial chars, but without any success, the problem is still exist.

But When i removed the Timer1 interrupt setup, it works ok.

What is the solution?
I use Keil 7.08 C51 Compiler

Thanks very much
SphinX
 

Re: 8051 Problem?

check your timer1 interrupt routine , and have disabled serial interrupt ?
and do u reload timer1 on interrupt ? and ....
 

Re: 8051 Problem?

If I understand well:

You have main program which sending via serial port 3 characters.

Meanwhile you have interrupt every 50ms, which sometimes become in a middle of sending serial data.

With EA you disable all interrupts so youdisable and serial interrupt.

You can disable just Timer 1 interupt (ET1 in IE register).

So when you disable overflow of T1 SBUF still can generate interrupt and whole thing has to work well.

Regards.

Mr.Cube
 

Re: 8051 Problem?

Sorry for language:

the TIMER 1 is USED for routine SERIAL, use Timer 0 for Interruption
 

Re: 8051 Problem?

When you disable ALL INTERUPTS, you also disable the BAUDRATE GENERATOR TIMER, so... it's that simple. u r disabling you main serial task.

Hope this is useful.
 

8051 Problem?

THANKS ALL GUYS.
Yes, There is a conflict between Serial and Timer1 interrupt because I set the Baud Rate by Timer1

Now I use Timer0 instead Timer1 and It works fine.

My code is 600+ lines of C code (C51 Keil)

So I haven't notice this simple problem. :-(

My project is Time Attendance using Proximity Cards .

Thanks Again
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top