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

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



Joined: 17 Nov 2014
Posts: 8

View user's profile Send private message

#int RDA
PostPosted: Sat May 04, 2019 7:01 am     Reply with quote

Does anybody have an idea why the interrupts doesn't work ?
I have the same issue with the PIC16F690.

In the following code, the Touch Sense works perfectly.

Note, i am using the CCS 5.080

Thanks
Code:

#include <16LF727.h>
#device ICD=TRUE

#FUSES NOPUT                    //No Power Up Timer
#FUSES MCLR                     //Master Clear pin enabled
#FUSES NOPROTECT                //Code not protected from reading
#FUSES NOBROWNOUT               //No brownout reset
#FUSES BORV19                   //Brownout reset at 1.9V

#use delay(internal=8000000)
#use rs232(baud=9600,parity=N,xmit=PIN_E1,rcv=PIN_E0,bits=8,stream=PORT1)
#use i2c(Master,Slow,sda=PIN_C4,scl=PIN_C3)

#use touchpad(pin_b1='0', pin_d0='3', pin_d1='6')

char car;

#INT_RDA
void  RDA_isr(void)
{
car=getc();
putc(car);
}

void main()
{

   enable_interrupts(INT_RDA);
   enable_interrupts(GLOBAL);

   while(TRUE)
   {

     ;
 

}
dluu13



Joined: 28 Sep 2018
Posts: 223
Location: Toronto, ON

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

PostPosted: Sat May 04, 2019 7:22 am     Reply with quote

This is the main problem:
If you want to use the interrupt then you must use the hardware UART that's on pins C6 and C7. So instead of xmit and rcv, replace that with UART1.
Code:
#use rs232(baud=9600,parity=N,UART1,bits=8,stream=PORT1,errors)


Some other comments:
You also need to use the ERRORS option in the rs232 setup or else your uart will lock up when there's an error. ERRORS will automatically clear errors. I also highly suggest using the RECEIVE_BUFFER option instead of making your own INT_RDA. That will make the compiler automatically generate an ISR that puts received characters into a circular buffer that you can access from your main loop.


Last edited by dluu13 on Sat May 04, 2019 7:28 am; edited 1 time in total
PCM programmer



Joined: 06 Sep 2003
Posts: 20759

View user's profile Send private message

Re: #int RDA
PostPosted: Sat May 04, 2019 7:28 am     Reply with quote

Same thing with the 16F690. The hardware UART is on pins B7 and B5.
michaeltolini



Joined: 17 Nov 2014
Posts: 8

View user's profile Send private message

PostPosted: Sat May 04, 2019 12:15 pm     Reply with quote

Thanks, it works now !
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