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 proteus

Status
Not open for further replies.

shvi

Junior Member level 3
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 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
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top