shvi
Junior Member level 3
hi
i am doing pic16f877a uart interrupt programming in mplab
in simulation it wil give error like this:
CORE-E0001: Stack over flow error occurred from instruction at 0x000015
my code is like this:
main.c
#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;
//SPEN = 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 = 'D';
//count++ ;
//TXIF = 0;
}
}
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++ );
}
plz help me i don't how this error is coming
thanks
i am doing pic16f877a uart interrupt programming in mplab
in simulation it wil give error like this:
CORE-E0001: Stack over flow error occurred from instruction at 0x000015
my code is like this:
main.c
#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;
//SPEN = 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 = 'D';
//count++ ;
//TXIF = 0;
}
}
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++ );
}
plz help me i don't how this error is coming
thanks