RX INT not working 16F1825[Resolved]

For Flowcode users to discuss projects, flowcharts, and any other issues related to Flowcode 8.

Moderator: Benj

Post Reply
medelec35
Matrix Staff
Posts: 9520
Joined: Sat May 05, 2007 2:27 pm
Location: Northamptonshire, UK
Has thanked: 2585 times
Been thanked: 3815 times
Contact:

RX INT not working 16F1825[Resolved]

Post 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.
Attachments
RX Int Test1.fcfx
(13.33 KiB) Downloaded 178 times
Martin

User avatar
Benj
Matrix Staff
Posts: 15312
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Has thanked: 4803 times
Been thanked: 4314 times
Contact:

Re: RX INT not working 16F1825

Post 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

medelec35
Matrix Staff
Posts: 9520
Joined: Sat May 05, 2007 2:27 pm
Location: Northamptonshire, UK
Has thanked: 2585 times
Been thanked: 3815 times
Contact:

Re: RX INT not working 16F1825

Post 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.
Martin

medelec35
Matrix Staff
Posts: 9520
Joined: Sat May 05, 2007 2:27 pm
Location: Northamptonshire, UK
Has thanked: 2585 times
Been thanked: 3815 times
Contact:

Re: RX INT not working 16F1825

Post 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?
Martin

User avatar
Benj
Matrix Staff
Posts: 15312
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Has thanked: 4803 times
Been thanked: 4314 times
Contact:

Re: RX INT not working 16F1825[Resolved]

Post 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?

Post Reply