12-22-2009 04:53 PM
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
01-12-2010 12:34 PM
01-13-2010 12:54 AM
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
01-15-2010 03:59 PM
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.
03-16-2010 08:17 AM
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;
}
_____________________________________________________________________