Page 1 of 1

PIC16F1779 Timer2 Interrupt problem [SOLVED]

Posted: Sat Jul 19, 2025 1:36 pm
by Sasi
Hello,
The Timer2 interrupt of the PIC16F1779 MCU is not working for me in Flowcode10.
Martin (medelec35) sent me a modified 16F1779.fcdx file that I tested with.
viewtopic.php?t=3215
I would be happy if you could investigate it.
Thanks,
Sasi
16F1779.fcdx
(24.2 KiB) Downloaded 36 times
PIC16F1779_TMR2_INT_test.fcfx
(11.68 KiB) Downloaded 50 times
As a supplement, I would like to add that interrupts implemented using Timer0 and Timer1 work fine.

Re: PIC16F1779 Timer2 Interrupt problem

Posted: Tue Jul 22, 2025 10:12 am
by medelec35
Hi Sasi.
I have look at a simulator and its not setting bit7 for T2CON ON
Looking at fdc for 16F1779, all of the code for timer 2 interrupt is wrong as microchip changed the rules with this family.
I have made a lot of changes, hopefully timer 2 will work, but I can't test it as not got 16F1779

If it does work, I will change the affected fcds

Re: PIC16F1779 Timer2 Interrupt problem

Posted: Tue Jul 22, 2025 1:01 pm
by Sasi
Hi Martin,
I tried it on hardware (Curiosity HPC Board), but unfortunately the Timer2 interrupt does not work with the modification.
Sasi

Re: PIC16F1779 Timer2 Interrupt problem

Posted: Tue Jul 22, 2025 2:01 pm
by medelec35
Thank you for your patience and feedback, I have figured out what the issue is.
In the original code the clock source was left out.
I have now set the clock source to Fosc/4
Now you should see Timer2 working.

Re: PIC16F1779 Timer2 Interrupt problem

Posted: Tue Jul 22, 2025 2:43 pm
by Sasi
Great! Now the Timer2 Interrupt works. :D
Thank you very much.
Regards,
Sasi

Re: PIC16F1779 Timer2 Interrupt problem [SOLVED]

Posted: Tue Jul 22, 2025 3:53 pm
by medelec35
That's great!
I'm glad I got it working for you.
Now that I have got used to setting up fdcx for 16F1779, I have gone a bit further by allowing you to select a Timer 2 source, rather than fixing the source.
Now you will have complete control with timer 2

Re: PIC16F1779 Timer2 Interrupt problem [SOLVED]

Posted: Tue Jul 22, 2025 5:51 pm
by Sasi
Clock Source Select also works. :D
Thanks!
If you have time to work on the DAC and CCP issues, I would be happy to help you with the testing.
Sasi