Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

pic16f877a uart error in mplab

Status
Not open for further replies.

shvi

Junior Member level 3
Joined
Jun 14, 2010
Messages
26
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Location
rajkot
Activity points
1,474
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
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top