Hi,
I can't seem to get the UART interrupt working (see attached code) in V4.5. If I put the IF statement in RxInt into the main loop and don't use the interrupt all works well. Unfortunately I need it to work from the interrupt fot the next stage. I have tried manually setting Intcon, PIE1 and PIR1 to no avail. Any ideas please?
Thanks,
Dave.
UART Interrupt not working (V4.5)
Moderator: Benj
- 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: UART Interrupt not working (V4.5)
Hi Dave,
Please try adding the following line of code in a C icon at the start of your program and let me know how you get on.
Edit. Hmm I see your already doing this. The GEIE and RCIE lines of code should not be required and your RxInt macro is incorrect, the C code may not work correctly.
Here is a quick test program for your hardware to see if the interrupt is working at all. If still nothing then have you done a 1 second flasher test on the hardware to ensure your clock speed and config is correct?
Please try adding the following line of code in a C icon at the start of your program and let me know how you get on.
Code: Select all
set_bit(intcon, PEIE);
Here is a quick test program for your hardware to see if the interrupt is working at all. If still nothing then have you done a 1 second flasher test on the hardware to ensure your clock speed and config is correct?
Regards Ben Rowland - MatrixTSL
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
- 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: UART Interrupt not working (V4.5)
Whoops the RxInt macro should set RxRec to 0 not 1.
Regards Ben Rowland - MatrixTSL
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel