CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to support@ccsinfo.com

16f877a UART interrupt not triggering

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
xyzsor



Joined: 19 Dec 2010
Posts: 12

View user's profile Send private message Visit poster's website

16f877a UART interrupt not triggering
PostPosted: Fri Apr 22, 2011 6:11 am     Reply with quote

Hey guys.. Im having problems making the UART interrupt work.. I searched the forum and everywhere else but i cant really find what's missing in my code.. Could anyone please please help me.. It would be of great help..


putc() and getc() works well on the main() function but it doesnt seem to work in the interrupt.. I dont know whats missing to make the interrupt trigger.. Thanks alot to anyone who helps..

Code:


#include <16F877A.h>
#device adc=8
#FUSES NOWDT   
#FUSES XT       
#FUSES PUT       
#FUSES NOPROTECT 
#FUSES NODEBUG   
#FUSES NOBROWNOUT
#FUSES NOLVP     
#FUSES NOCPD
#use delay(clock=4000000)
#use rs232(baud=9600, xmit=PIN_C6, rcv=PIN_C7, ERRORS)
#priority rda
#byte portd=8               

int8 data;

#int_rda
void rda_isr(void)
{
    data = getc();
    putc(data);   
}

void main()
{
    enable_interrupts(INT_RDA);
    enable_interrupts(GLOBAL);

    set_tris_d(0x00);

   
    while(true)
    {      
    portd = 0xFF;
    delay_ms(300);
    portd = 0x00;
    delay_ms(300);
    }
}


PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Fri Apr 22, 2011 1:01 pm     Reply with quote

It works for me. I tested it with compiler vs. 4.119 on a PicDem2-Plus
board. The board is connected to a PC which is running TeraTerm.

If I type a few keys to test it, it's working. It displays this on the terminal
window:
Quote:
asdfasdfasdfasfd
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group