Multisim and Ultiboard

cancel
Showing results for 
Search instead for 
Did you mean: 

8051 timer2 ISR

Dear Friend,

 

   I tried  many times to write ISR for Timer 2.I have program for timer 1 and for serial routin.But As want to use microcontroller for variouse application at once,my program not going for ISR of TIMER2.

 

   If any one know,please write only in code compitible to Mutisim in 'C'.

 

Waiting for Reply,

 

Regards,

surajbgm

0 Kudos
Message 1 of 5
(5,465 Views)
Timer2 is supported by the 8052 (not the 8051).  Try using the 8052 MCU and see if you're still having problems.
Anita
National Instruments Electronics Workbench Group
0 Kudos
Message 2 of 5
(5,337 Views)

Madam,

 

   Presently I am using P89v51rd2fn,so first i tried with 8051,after i  even tried with 8052.Code written in C language as per H-lite manual.

  

   But PC is not going for Intrupt routine on serial or timer interrupt.If have some example in C language for interrupts,please send.I am trying this for last 2 months.

  

   Now for optional i am using Keil.If you sents me proper data,i will be very happy.

 

   I found some problem with include library also. On recieving data from you,i will reply you result.So you can update.

 

Waiting for reply,

 

Happy Sankranti,

 

SURAJ KANAGO

0 Kudos
Message 3 of 5
(5,317 Views)

Suraj,

Can you provide the interrupt program that you are using?  I can take a look at it and see if I can spot any problems.

Thanks.

Anita
National Instruments Electronics Workbench Group
0 Kudos
Message 4 of 5
(5,281 Views)

Dear Madam,

 

 

   I was busy in other works and also tried on other site to get solution.Here is program sample where it goes for ISR and make AND process and give back.

 

   SEnder microcontroller sends and Receiver Microcontroller recieves the characters when Reciever program  is using flags RI and TI,but when i use ISR,Reciever not goes for Routine and Sender is waiting to receive character after AND process.So its clear that problem is in ISR setting and program.

 

Here is Reciever program

 ___________________________________________________________________________

#include <htc.h>
#include <stdio.h>
#include <conio.h>

void msdelay(unsigned int);

void msdelay(unsigned int p)
{
int q;
for (q=0;q<p;q++);
return;
}

void main(void)
{
unsigned char z;
TMOD = 0x20;
TH1 = 0xFD;
TL1=0xFD;
SCON = 0x50;
IE=0x90;
TR1=1;
msdelay(1);
while(1);

}

 

 

interrupt void
serial_intr(void)
{
unsigned char z;
int q;
if (RI==1)
{
z=SBUF;
RI=0;
TI=0;
for (q=0;q<400;q++);
z&=0x0F;
RI=0;
TI=0;
SBUF=z;
while(TI==0);
RI=0;
TI=0;
}

_____________________________________________________________________

0 Kudos
Message 5 of 5
(5,003 Views)