Interrupt Not Working for PIC16F1824

Moderator: Benj

allpicproject
Flowcode V4 User
Posts: 36
Joined: Thu Sep 01, 2011 11:10 am
Has thanked: 17 times
Been thanked: 1 time
Contact:

Interrupt Not Working for PIC16F1824

Postby allpicproject » Tue Jul 10, 2012 6:03 pm

Hi guys,

I having problem to use interrupt for PIC16F1824. I choose INT ( RB0/INT selection ) but the flowcode simulation fail.

From the datasheet of PIC16F1824, the INT is on RA2 pin not RB0 pin ( as normal case ).

Second thing is there's no Interrupt on change (IOC) for this IC ( in flowcode v4.5 ) but IOC can be found on the datasheet.

Actually I'm in middle doing some project to use PIC16F1824 n PIC12F1840 but having problem on the interrupt issue. If PIC16F1824 can be solved, please settle for PIC12F1822 too ( same family with PIC16F1824).


Second question,

How to set the right freq for PIC16F1824. Let say I use internal clock and I want 32 Mhz clock, need I to set clock speed to 8000000Hz ( under top menu -> VIEW -> PROJECT OPTION ) and have 'PLL ENABLE' in CONFIGURE menu ? or how ?


Hope it's can be solved.

Thanks in advance.

User avatar
Enamul
Posts: 1772
Joined: Mon Mar 05, 2012 11:34 pm
Location: Nottingham, UK
Has thanked: 271 times
Been thanked: 814 times
Contact:

Re: Interrupt Not Working for PIC16F1824

Postby Enamul » Sun Jul 15, 2012 12:38 pm

Hi,
I have solved the simulation problem and later on have a look on the internal clock issue..

For the time being I have posted here the sample Flow chart and modified FCD file which you have to put in Program files>Matrix Multimedia>Flowcode V4>FCD
folder and replace the existing one..

Hope this will help :)

Enamul
Attachments
16F1824.fcd
(11.09 KiB) Downloaded 197 times
RB0.fcf
(6.5 KiB) Downloaded 225 times
Last edited by Enamul on Mon Jul 16, 2012 12:13 pm, edited 2 times in total.
These users thanked the author Enamul for the post:
allpicproject (Sun Jul 15, 2012 4:15 pm)
Rating: 5%
 
Enamul
University of Nottingham
enamul4mm@gmail.com

User avatar
Enamul
Posts: 1772
Joined: Mon Mar 05, 2012 11:34 pm
Location: Nottingham, UK
Has thanked: 271 times
Been thanked: 814 times
Contact:

Re: Interrupt Not Working for PIC16F1824

Postby Enamul » Sun Jul 15, 2012 12:46 pm

Hi,
How to set the right freq for PIC16F1824. Let say I use internal clock and I want 32 Mhz clock, need I to set clock speed to 8000000Hz ( under top menu -> VIEW -> PROJECT OPTION ) and have 'PLL ENABLE' in CONFIGURE menu ? or how ?

To use internal 32 Mhz clock, you have to use the attached config setting and I have added modified Code for 32 MHz internal clock..
I will post your rest of the problem regarding Interrupt on change...later on
Enamul
Attachments
RB0.fcf
(6.5 KiB) Downloaded 187 times
RB0_CONFIG.jpg
RB0_CONFIG.jpg (138.15 KiB) Viewed 13864 times
Last edited by Enamul on Sun Jul 15, 2012 8:33 pm, edited 1 time in total.
These users thanked the author Enamul for the post:
allpicproject (Sun Jul 15, 2012 4:16 pm)
Rating: 5%
 
Enamul
University of Nottingham
enamul4mm@gmail.com

allpicproject
Flowcode V4 User
Posts: 36
Joined: Thu Sep 01, 2011 11:10 am
Has thanked: 17 times
Been thanked: 1 time
Contact:

Re: Interrupt Not Working for PIC16F1824

Postby allpicproject » Sun Jul 15, 2012 4:28 pm

Hi Enamul,

Thanks a lot for your help.

Anyway, if you have time, would you please fix for PIC12F1840 too as I need to use it urgently.

Or you can show me how to fix it, I will try to do it on my own ( for INT, IOC and other interrupt related ).

Sorry to trouble you so much.

Thanks a lot for you kindness.

User avatar
Enamul
Posts: 1772
Joined: Mon Mar 05, 2012 11:34 pm
Location: Nottingham, UK
Has thanked: 271 times
Been thanked: 814 times
Contact:

Re: Interrupt Not Working for PIC16F1824

Postby Enamul » Sun Jul 15, 2012 5:21 pm

Hi,
I am glad that it helps you. I am now looking at 12f1840 and try to post as soon as possible..

Enamul
These users thanked the author Enamul for the post:
allpicproject (Sun Jul 15, 2012 5:24 pm)
Rating: 5%
 
Enamul
University of Nottingham
enamul4mm@gmail.com

User avatar
Enamul
Posts: 1772
Joined: Mon Mar 05, 2012 11:34 pm
Location: Nottingham, UK
Has thanked: 271 times
Been thanked: 814 times
Contact:

Re: Interrupt Not Working for PIC16F1824

Postby Enamul » Sun Jul 15, 2012 5:44 pm

Hi,
Here goes the modified FCD file for 12f1840 PIC and this is also corrected for RA2INT...

Please use same config option..and I forget to put ; on the c code of last post...please add that in RB0 last program..

Enamul
Attachments
16F1824.fcd
(11.09 KiB) Downloaded 190 times
RA2_INT_12F1840.fcf
(5.5 KiB) Downloaded 206 times
Last edited by Enamul on Mon Jul 16, 2012 12:13 pm, edited 2 times in total.
These users thanked the author Enamul for the post:
allpicproject (Sun Jul 15, 2012 7:12 pm)
Rating: 5%
 
Enamul
University of Nottingham
enamul4mm@gmail.com

allpicproject
Flowcode V4 User
Posts: 36
Joined: Thu Sep 01, 2011 11:10 am
Has thanked: 17 times
Been thanked: 1 time
Contact:

Re: Interrupt Not Working for PIC16F1824

Postby allpicproject » Sun Jul 15, 2012 7:17 pm

Hi Enamul,

Thanks for your help n fast respond.

I will test it when the IC arrived ( I just ordered it ).

Thanks again for all your help.

allpicproject
Flowcode V4 User
Posts: 36
Joined: Thu Sep 01, 2011 11:10 am
Has thanked: 17 times
Been thanked: 1 time
Contact:

Re: Interrupt Not Working for PIC16F1824

Postby allpicproject » Sun Jul 15, 2012 7:30 pm

Hi Enamul,

If you have time ( and you want to do it of course ), please fix for other PIC16F182x n PIC12F1822 on interrupt:

1. INT
2. IOC

Thanks in advance for your help ( if you do it or not ;) ) .... btw, it's not urgent (take your time).

User avatar
Enamul
Posts: 1772
Joined: Mon Mar 05, 2012 11:34 pm
Location: Nottingham, UK
Has thanked: 271 times
Been thanked: 814 times
Contact:

Re: Interrupt Not Working for PIC16F1824

Postby Enamul » Sun Jul 15, 2012 8:10 pm

Hi,
That's nice. Please let me know after testing in hardware.
Please re-download RB0 and RA2_INT_12f1840 program because earlier c code semicolon (;) was missing
I'm now looking at port change on interrupt. This will take some time to configure. I will post whenever I can sort out the issue.
Thanks!
Enamul
These users thanked the author Enamul for the post:
allpicproject (Sun Jul 15, 2012 8:40 pm)
Rating: 5%
 
Enamul
University of Nottingham
enamul4mm@gmail.com

User avatar
Enamul
Posts: 1772
Joined: Mon Mar 05, 2012 11:34 pm
Location: Nottingham, UK
Has thanked: 271 times
Been thanked: 814 times
Contact:

Re: Interrupt Not Working for PIC16F1824

Postby Enamul » Sun Jul 15, 2012 8:39 pm

Hi,
I have made correction to PIC12f1822 fcd file and attached here with the sample program...

I will post rest later on..

Enamul
Attachments
12F1822.fcd
(10.05 KiB) Downloaded 196 times
RA2_INT_12F1822.fcf
(5.5 KiB) Downloaded 191 times
Last edited by Enamul on Mon Jul 16, 2012 12:14 pm, edited 1 time in total.
These users thanked the author Enamul for the post:
allpicproject (Sun Jul 15, 2012 8:40 pm)
Rating: 5%
 
Enamul
University of Nottingham
enamul4mm@gmail.com

User avatar
Enamul
Posts: 1772
Joined: Mon Mar 05, 2012 11:34 pm
Location: Nottingham, UK
Has thanked: 271 times
Been thanked: 814 times
Contact:

Re: Interrupt Not Working for PIC16F1824

Postby Enamul » Sun Jul 15, 2012 9:10 pm

HI,
I think you mean 16f182x means 16f1823, 16f1825-29. I have made changes to 16f1823 & 25 and attached here. I have checked PIC 16f1826 and 27...those are already fine as they have mapped on RB0...
I will also add 1828 and 1829 in the other post..as I can't add more than 3 in attachment.

Enamul
Attachments
16F1823.fcd
(6.19 KiB) Downloaded 138 times
16F1825.fcd
(10.43 KiB) Downloaded 138 times
Last edited by Enamul on Mon Jul 16, 2012 12:15 pm, edited 1 time in total.
These users thanked the author Enamul for the post:
allpicproject (Mon Jul 16, 2012 5:56 am)
Rating: 5%
 
Enamul
University of Nottingham
enamul4mm@gmail.com

User avatar
Enamul
Posts: 1772
Joined: Mon Mar 05, 2012 11:34 pm
Location: Nottingham, UK
Has thanked: 271 times
Been thanked: 814 times
Contact:

Re: Interrupt Not Working for PIC16F1824

Postby Enamul » Sun Jul 15, 2012 11:55 pm

Hi,

Here goes 16f1828 and 29...

Hope these will help :)
Enamul
Attachments
16F1829.fcd
(10.72 KiB) Downloaded 143 times
16F1828.fcd
(10.66 KiB) Downloaded 138 times
Last edited by Enamul on Mon Jul 16, 2012 12:16 pm, edited 1 time in total.
These users thanked the author Enamul for the post:
allpicproject (Mon Jul 16, 2012 5:57 am)
Rating: 5%
 
Enamul
University of Nottingham
enamul4mm@gmail.com

User avatar
Enamul
Posts: 1772
Joined: Mon Mar 05, 2012 11:34 pm
Location: Nottingham, UK
Has thanked: 271 times
Been thanked: 814 times
Contact:

Re: Interrupt Not Working for PIC16F1824

Postby Enamul » Mon Jul 16, 2012 1:10 am

Hi,

I have managed to change FCD file for PORTA change on interrupt for PIC 16f1824..I have added that in FCD file but now its available in interrupt list. In the beginning of flowchart you have to define the pins whether rising edge or falling edge..In the sample program I have configured all rising and all falling edge detection..

It will not simulate but you can test on hardware and let me know how it works!
Enamul
Attachments
16F1824.fcd
(11.09 KiB) Downloaded 145 times
RA_Change_ON_INT.fcf
(7 KiB) Downloaded 192 times
Last edited by Enamul on Mon Jul 16, 2012 12:16 pm, edited 1 time in total.
These users thanked the author Enamul for the post:
allpicproject (Mon Jul 16, 2012 5:57 am)
Rating: 5%
 
Enamul
University of Nottingham
enamul4mm@gmail.com

allpicproject
Flowcode V4 User
Posts: 36
Joined: Thu Sep 01, 2011 11:10 am
Has thanked: 17 times
Been thanked: 1 time
Contact:

Re: Interrupt Not Working for PIC16F1824

Postby allpicproject » Mon Jul 16, 2012 6:01 am

I'm really happy with your contribution. Thanks a lot buddy.

Btw, I only have PIC16F1824 right now and PIC12F1840 coming soon ... so I will let you know once I test it ( give me 1 or 2 days ).

My very best regards
Zuki.

allpicproject
Flowcode V4 User
Posts: 36
Joined: Thu Sep 01, 2011 11:10 am
Has thanked: 17 times
Been thanked: 1 time
Contact:

Re: Interrupt Not Working for PIC16F1824

Postby allpicproject » Mon Jul 16, 2012 8:44 am

Hi Enamul,

I test your PIC16F1824 ( both ... with INT n IOC ) but not succesfull ( on my hardware .. confirm working hardware ).

I make 2 flowcode file ... 1) with INT 2) Just push A2 and A4 LED light ON (while push A2 button).

With your FCD, it' not working on hardware (both testing no. 1 n no. 2) but no problem on flowcode simulation n flowcode compilation ( error free ).

With older FCD, test no. 2 working 100% on hardware n simulation.

Attached the older FCD (working for test no. 2 on my hardware ).
Attachments
16F1824.fcd
(10.43 KiB) Downloaded 145 times
These users thanked the author allpicproject for the post:
Enamul (Mon Jul 16, 2012 11:40 am)
Rating: 5%
 

allpicproject
Flowcode V4 User
Posts: 36
Joined: Thu Sep 01, 2011 11:10 am
Has thanked: 17 times
Been thanked: 1 time
Contact:

Re: Interrupt Not Working for PIC16F1824

Postby allpicproject » Mon Jul 16, 2012 8:48 am

This 2 flowcode files.
Attachments
PIC_000043_007.fcf
(7 KiB) Downloaded 157 times
PIC_000043_006.fcf
(7 KiB) Downloaded 178 times

User avatar
Enamul
Posts: 1772
Joined: Mon Mar 05, 2012 11:34 pm
Location: Nottingham, UK
Has thanked: 271 times
Been thanked: 814 times
Contact:

Re: Interrupt Not Working for PIC16F1824

Postby Enamul » Mon Jul 16, 2012 11:26 am

Hi,
I was working late last night. That's why wake up late. It's nice that you have tested RA2 for int and normal I/O. I have edited ansel register which causes the pins to become analogue and that's why it works in simulation but not in hardware.I have updated all the FCD I have posted and modified so that it works both for simulation and hardware. As I don't have those IC in hand I can't test in hardware. Please use the attached FCD and let me know how it works?

I mean it should work both for simulation and hardware.. :)
Enamul
Attachments
16F1824.fcd
(11.09 KiB) Downloaded 149 times
These users thanked the author Enamul for the post:
allpicproject (Mon Jul 16, 2012 5:44 pm)
Rating: 5%
 
Enamul
University of Nottingham
enamul4mm@gmail.com

allpicproject
Flowcode V4 User
Posts: 36
Joined: Thu Sep 01, 2011 11:10 am
Has thanked: 17 times
Been thanked: 1 time
Contact:

Re: Interrupt Not Working for PIC16F1824

Postby allpicproject » Mon Jul 16, 2012 5:41 pm

Hi Enamul,

Thanks for the contribution.

I just test PIC16F1824 FCD and so far it's work fine (hardware n simulation) ... for A2INT interrupt. For IOC on Port A still not doing yet.

I will test it for IOC for PIC16F1824 n IOC and A2INT for PIC12F1840 on next week as I need to finish my urgent project this week.

I will let you know the result later once I test it.


NOTE: If you want to do, is it possible to make FCD for PIC16F1503 ? as I have some stock on this PIC but flowcode 4.x not support. If you cannot/don't want to make it, it's ok to me as you help me a lot already. Sorry to trouble you on so many PICs.

Thanks a lot for your help.
Zuki.

User avatar
Enamul
Posts: 1772
Joined: Mon Mar 05, 2012 11:34 pm
Location: Nottingham, UK
Has thanked: 271 times
Been thanked: 814 times
Contact:

Re: Interrupt Not Working for PIC16F1824

Postby Enamul » Mon Jul 16, 2012 6:01 pm

Hi Zuki,
It's just not only making FCD file, I have to make PIC16F1503.h and FCD both.
NOTE: If you want to do, is it possible to make FCD for PIC16F1503 ? as I have some stock on this PIC but flowcode 4.x not support.

As those file should include all the functionality of the ic, it will take time..
I will work on my off time to make that..Is that ok?
Enamul
Enamul
University of Nottingham
enamul4mm@gmail.com

allpicproject
Flowcode V4 User
Posts: 36
Joined: Thu Sep 01, 2011 11:10 am
Has thanked: 17 times
Been thanked: 1 time
Contact:

Re: Interrupt Not Working for PIC16F1824

Postby allpicproject » Mon Jul 16, 2012 6:27 pm

Enamul wrote:Hi Zuki,
It's just not only making FCD file, I have to make PIC16F1503.h and FCD both.
NOTE: If you want to do, is it possible to make FCD for PIC16F1503 ? as I have some stock on this PIC but flowcode 4.x not support.

As those file should include all the functionality of the ic, it will take time..
I will work on my off time to make that..Is that ok?
Enamul


Your respond already make me so happy :D :D :D

Take your time ... I don't need it urgent ... just to make use of my ready stock of PICs

Thanks for all help. :wink:

User avatar
Enamul
Posts: 1772
Joined: Mon Mar 05, 2012 11:34 pm
Location: Nottingham, UK
Has thanked: 271 times
Been thanked: 814 times
Contact:

Re: Interrupt Not Working for PIC16F1824

Postby Enamul » Mon Jul 16, 2012 8:03 pm

Hi Zuki,
I have seen a problem in Ben post...
viewtopic.php?f=40&t=10599&p=36603&hilit=fcd#p36603
You can see there...
I have had a look at the compiler that comes with Flowcode v5 for PIC and unfortunately it does not currently support the 16F15xx range of devices.

Which means that you can't compile it using Flowcode as V5 yet not compatible with these ICs so v4 also not compatible because of Boostc compiler.
I will make a try to use Hitech C, I guess that will help to compile PIC 16f15xx family..If I can sort the issue I will post that..
Enamul
Enamul
University of Nottingham
enamul4mm@gmail.com

allpicproject
Flowcode V4 User
Posts: 36
Joined: Thu Sep 01, 2011 11:10 am
Has thanked: 17 times
Been thanked: 1 time
Contact:

Re: Interrupt Not Working for PIC16F1824

Postby allpicproject » Wed Jul 18, 2012 10:45 am

No problem.

If you can make it happen .. that's very good. But if it's not possible then ok. :D

Just hope for the best ... 8)

User avatar
Enamul
Posts: 1772
Joined: Mon Mar 05, 2012 11:34 pm
Location: Nottingham, UK
Has thanked: 271 times
Been thanked: 814 times
Contact:

Re: Interrupt Not Working for PIC16F1824

Postby Enamul » Fri Jul 20, 2012 1:42 am

Hi Zuki,
I have made a new FCD file for PIC 16f1824 which has the facility to set rising edge and falling edge from port int properties. I hope this will help you and you don't need to deal with C code any more.By the way I am working on 16f1503..

Thanks,
Enamul
Attachments
16F1824v2.fcd
Changed as per your request but remember to rename to 16f1846.fcd
(11.8 KiB) Downloaded 171 times
TEST.fcf
simple FC to test INT
(5.5 KiB) Downloaded 186 times
Last edited by Enamul on Fri Jul 20, 2012 4:25 pm, edited 1 time in total.
These users thanked the author Enamul for the post (total 2):
Benj (Fri Jul 20, 2012 9:33 am) • allpicproject (Fri Jul 20, 2012 3:50 pm)
Rating: 10%
 
Enamul
University of Nottingham
enamul4mm@gmail.com

allpicproject
Flowcode V4 User
Posts: 36
Joined: Thu Sep 01, 2011 11:10 am
Has thanked: 17 times
Been thanked: 1 time
Contact:

Re: Interrupt Not Working for PIC16F1824

Postby allpicproject » Fri Jul 20, 2012 3:48 pm

Hi Enamul,

Thanks for the FCD.

I will test it by next week as I too busy this week. I will post the result.

Hope you can make FCD for PIC16F1503 too ... :D :D :D

BTW, can you change the name of new FCD to ie. PIC16F1824_v2 ( I will change it to PIC16F1824) or something like that so I won confuse. :D
Just for keep track :D

User avatar
Enamul
Posts: 1772
Joined: Mon Mar 05, 2012 11:34 pm
Location: Nottingham, UK
Has thanked: 271 times
Been thanked: 814 times
Contact:

Re: Interrupt Not Working for PIC16F1824

Postby Enamul » Fri Jul 20, 2012 4:46 pm

Hi Zuki,
I have already made FCD for the PIC 16f1503 and checking everything to post..
Hope you can make FCD for PIC16F1503 too ...

I have tried both v4 and v5 and seen that the chip can be added to target chip list..Just wait for a while.. :)
Enamul
Enamul
University of Nottingham
enamul4mm@gmail.com