problem in uart communication 16f876a and proteus

Status
Not open for further replies.

embpic

Advanced Member level 3
Joined
May 29, 2013
Messages
742
Helped
80
Reputation
160
Reaction score
77
Trophy points
1,308
Location
india
Visit site
Activity points
5,213
Hello master's
I am getting problem while doing uart communication in PIC 16f876a. i am using mplab ide and hi-tech compiler. i am trying it on Proteus so help me
to do uart communication in controller.
may be proteus circuit go wrong.
i have attched file below.

- - - Updated - - -

i have attched proteus file and program.
 

Attachments

  • uart.rar
    7.2 KB · Views: 56

Code:
void tx_init (){

    TRISC7  = 1;
    TRISC6  = 1;
    SPBRG = 0X19;            //Set Baud rate 9600bps at  4MHz
    TXSTA = 0b00100100;
    RCSTA = 0b10010000;

}

Code:
void rx_int_init(){
    RCIF = 0;
    GIE = 1;
    PEIE = 1;
    RCIE = 1;

}

ISR vector for interrupt


Code:
void interrupt isr (){

  
        
}
 
Last edited:

Sir tried by pullin down and also reconfigure the registor but no effect
 

It is seen to be does not return from interrupt
try on this I disable the interrupt then it is working
Code:
#include<htc.h>
#define _XTAL_FREQ 4000000 // 4 MHz clock 

__CONFIG(FOSC_XT & WDTE_OFF& PWRTE_OFF & BOREN_OFF &
LVP_OFF & WRT_OFF & DEBUG_ON & CPD_OFF & CP_OFF);
void interrupt isr();
int main(void)
{
TRISC = 0xc0;
SPBRG = 0X19;            //Set Baud rate 9600bps
TXSTA = 0b00100100;
RCSTA = 0b10010000;
INTCON = 0XC0;
//PIE1 = 0X10;


while(1){
TXREG = 's';


}

}

void interrupt isr()
{

PIR1 = 0x00;
    
}
 
Last edited:

Status
Not open for further replies.

Similar threads

Cookies are required to use this site. You must accept them to continue using the site. Learn more…