Page 1 of 1

RX INT not working 16F1825[Resolved]

Posted: Wed Jan 23, 2019 10:51 am
by medelec35
Using attached Flowchart, not able to get RX interrupt to work on default or alternative settings.
When chars sent at 9600 baud, nothing is detected.

Re: RX INT not working 16F1825

Posted: Wed Jan 23, 2019 11:19 am
by Benj
Hi Martin,

You don't seem to be calling the UART Initialise macro in your program. Hopefully that's the reason it's not working :D

Re: RX INT not working 16F1825

Posted: Wed Jan 23, 2019 11:42 am
by medelec35
Hi Ben,
Thanks & Silly me.
for testing, I deleted initialise program call macro from the main flowchart and that had the initialise UART in.
Then main program which works perfect with ECIO40p8, does not work when migrated to 16F1825.
Issue is with RX not working.

I have double-checked and the initialise UART is definitely there but still not working with RX.
However, after adding initialise UART with the very basic test program, RX does work.
So there is something conflicting in the original program that worked with ECIO40p8
I will PM the flowchart in question.

Re: RX INT not working 16F1825

Posted: Wed Jan 23, 2019 2:12 pm
by medelec35
Hi Ben,
Worked out the issue.
If RXINT0 is used before UART Initilise, then RX interrupt will not work.
Is this commonly known?

Re: RX INT not working 16F1825[Resolved]

Posted: Wed Jan 23, 2019 5:20 pm
by Benj
Hi Martin,

There is code in the CAL UART initialise routine to disable the RX interrupt if not specifically enabled in the CAL component. e.g. for component based RX interrupts such as GPS or ESP8266.
#if (MX_UART_INT_X == 1)
MX_UART_INT_CH1_EN;
st_bit(INTCON, PEIE);
st_bit(INTCON, GIE);
#else
cr_bit (MX_UART1_PIE, RCIE);
#endif
I can't remember why we disable the interrupt if it's not enabled in the CAL. There is likely a reason for it but I can't remember what that might be. Maybe to avoid a lockup if a frame error etc is received?