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

#int_RDA never fires (18F4520) compiler version = PCH 4.094

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



Joined: 27 Mar 2008
Posts: 9

View user's profile Send private message

#int_RDA never fires (18F4520) compiler version = PCH 4.094
PostPosted: Sun Feb 21, 2010 8:06 pm     Reply with quote

Hi,

I have an interrupt for RS232 (#int_RDA), but it never fires when it receives data.

So I checked the include file 18f4520.c and found:

Code:
#define INT_RDA                   0x9D20


I checked the datasheet and the SPFs for RDA is bit 5 of PIR1 (RCIF)

Can I do the following because the RDA interrupt address might be wrong?

Code:

#define  PIR1     0xF9E
#bit     RCIF  =  PIR1.5
#define int_UART_RX RCIF 

#int_UART_RX
void uart_rx_isr(void)
{

//blah blah

}


Here is the completed program:
Code:

#include <18f4520.h>
#device ICD=TRUE
#fuses HS,NOLVP,NOWDT
#use delay (clock=20000000)

#define tx_pin PIN_C6
#define rx_pin PIN_C7
#use rs232(baud=2400, xmit=tx_pin, rcv=rx_pin, stream=PC, ERRORS)


#int_RDA
void RDA_isr(void)
{
  printf("RDA fires\n\r");
}
void main()
{

}


My compiler version is PCH 4.094u

Thanks
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Sun Feb 21, 2010 8:46 pm     Reply with quote

You need to call the enable_interrupts() routine for both INT_RDA and
GLOBAL interrupts (2 lines of code).
iKevin



Joined: 27 Mar 2008
Posts: 9

View user's profile Send private message

PostPosted: Sun Feb 21, 2010 9:06 pm     Reply with quote

I put those enables in and it works, thanks a lot buddy.
Code:
#include <18f4520.h>
#device ICD=TRUE
#fuses HS,NOLVP,NOWDT
#use delay (clock=20000000)

#define tx_pin PIN_C6
#define rx_pin PIN_C7
#use rs232(baud=2400, xmit=tx_pin, rcv=rx_pin, stream=PC, ERRORS)


#int_RDA
void RDA_isr(void)
{
  printf("RDA fires\n\r");
}

void main()
{
   enable_interrupts(INT_RDA);
   enable_interrupts(GLOBAL);
}
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