Tuesday, 20 October 2015

USART INTERRUPT PROGRAMMING OF PIC16F877A(RECEIVER INTERRUPT)

#include<pic.h>
void transmit();
void main()
{
TXSTA=0X24;
RCSTA=0X90;
SPBRG=0X19;
TRISB=0X80;
RCIE=1;
GIE=1;
PEIE=1;
}
void interrupt isr()
{
char a;
if(RCIF==1)
{
a=RCREG;
transmit();
RCIF=0;
}

}
void transmit()
{
TXREG='t';
while(TXIF==0);
TXIF=0;
}

No comments:

Post a Comment