|
|
View previous topic :: View next topic |
Author |
Message |
michaeltolini
Joined: 17 Nov 2014 Posts: 8
|
#int RDA |
Posted: Sat May 04, 2019 7:01 am |
|
|
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: 395 Location: Toronto, ON
|
|
Posted: Sat May 04, 2019 7:22 am |
|
|
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: 21708
|
Re: #int RDA |
Posted: Sat May 04, 2019 7:28 am |
|
|
Same thing with the 16F690. The hardware UART is on pins B7 and B5. |
|
|
michaeltolini
Joined: 17 Nov 2014 Posts: 8
|
|
Posted: Sat May 04, 2019 12:15 pm |
|
|
Thanks, it works now ! |
|
|
|
|
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
|