hi,
i am doing pic16f877a uart interrupt programming and i also draw schematic in proteus 7 but when i load hex file in proteus it give warning like this
STACK OVERFLOW PUSHING RETURN ADDRESS OF INTERRUPT
due to this data will not display on virtual terminal
so help me
thanks
my code is below:
#include <htc.h>
#include "usart.h"
#include "delay.h"
#include "always.h"
unsigned char count = 0;
void main()
{
unsigned char i=1;
TRISD = 0x00;
PORTD = 0X00;
init_comms();
PEIE = 1;
GIE = 1;
TXIE = 1;
while(1)
{
// putch('I');
// putch('N');
// putch('D');
// putch('I');
// putch('A');
// putrs1USART("Devindia infoway");
// putch(0x0a);
// putch(0x0d);
// putch('V');
// putch('I');
// putch('N');
// putch('D');
// putch('I');
// putch('A');
// putchdec(i);
// i++;
if(count == 255)
{
PORTD = ~PORTD;
count = 0;
}
}
}
//usart.c//
#include <htc.h>
#include <stdio.h>
#include "usart.h"
unsigned char byte = 'D';
unsigned char count = 0;
void interrupt_ISR()
{
// while(1)
//{
/* output one byte */
if(TXIF) /* set when register is empty */
{
TXREG = byte;
count++ ;
}
}
unsigned char
getch() {
/* retrieve one byte */
while(!RCIF) /* set when register is not empty */
continue;
return RCREG;
}
unsigned char
getche(void)
{
unsigned char c;
putch(c = getch());
return c;
}
void putchdec(unsigned char c)
{
unsigned char temp;
temp=c;
//hundreds
if ((c/100)>0) putch((c/100)+'0');
c-=(c/100)*100;
//tens
if (((temp/10)>0) || ((temp/100)>0)) putch((c/10)+'0');
c-=(c/10)*10;
//ones
putch((c/1)+'0');
}
void putrs1USART(const char *data)
{
do
{
while(!TXIF);
TXREG = *data;
}
while( *data++ );
}
when i load this code in proteus it will give warning that i mentioned above.
i need your help
thanks