PIC12F617 External interrupt via GP2 -- how?

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

Moderator: Benj

Post Reply
gtc
Posts: 69
Joined: Mon Mar 23, 2015 5:34 am
Has thanked: 30 times
Been thanked: 15 times
Contact:

PIC12F617 External interrupt via GP2 -- how?

Post by gtc »

Using Flowcode version: 6.1.2.0

According to Microchip's datasheet for the 12F617, the OPTION register is a readable and writable register, which contains various control bits to configure:
• Timer0/WDT prescaler
• External GP2/INT interrupt
• Timer0
• Weak pull-ups on GPIO

So, apart from the WDT, this chip supports these types of interrupts: TMR0 register overflow, GPIO change and external GP2/INT pin interrupts.

However, using Properties:Interrupt, the only choices given are:

Timer0
INT0 Pin
Timer 1
IOC GPIO
UART RXINT0
Timer 2
Custom ...

I don't want to use GPIO change, I want to use GP2/INT, but how do I select it given it's not in Flowcode's option list?

Does this require a change to the chip's profile file?

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

Re: PIC12F617 External interrupt via GP2 -- how?

Post by medelec35 »

Hi gtc,
Selecting INT0 Pin should be the INT interrupt on GP2

Martin
Martin

gtc
Posts: 69
Joined: Mon Mar 23, 2015 5:34 am
Has thanked: 30 times
Been thanked: 15 times
Contact:

Re: PIC12F617 External interrupt via GP2 -- how?

Post by gtc »

Hi,

I should have mentioned that I did try INT0, but it was not recognized. That is, the interrupt routine was not called.

I have a momentary push-button (active high) attached to GP2. I see the GP2 pin go red on the chip emulator, but for some reason the INT0 routine is not being triggered.

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

Re: PIC12F617 External interrupt via GP2 -- how?

Post by medelec35 »

have you got a pull-down resistor connected between pin and 0V. say 4.k - 15k?
Martin

gtc
Posts: 69
Joined: Mon Mar 23, 2015 5:34 am
Has thanked: 30 times
Been thanked: 15 times
Contact:

Re: PIC12F617 External interrupt via GP2 -- how?

Post by gtc »

At this stage, I am referring to Flowcode's simulation.

I can get the GPIO change interrupt option (IOC GPIO) to work in simulation, but GPIO change is not what I want. I only want an external interrupt via GP2.

It's INT0 in simulation for this chip that I can't get to work. (Had no problem with INT0 for the 16F88 chip).

EtsDriver
Posts: 444
Joined: Tue Apr 15, 2014 4:19 pm
Location: Kajaani, Finland
Has thanked: 345 times
Been thanked: 227 times
Contact:

Re: PIC12F617 External interrupt via GP2 -- how?

Post by EtsDriver »

Usually the interrupt simulations don't work on flowcode, and you just have to manually step into them if you want to simulate it for test purposes, or use real hardware to test it out.
Ill just keep the good work up!

gtc
Posts: 69
Joined: Mon Mar 23, 2015 5:34 am
Has thanked: 30 times
Been thanked: 15 times
Contact:

Re: PIC12F617 External interrupt via GP2 -- how?

Post by gtc »

So far I have found that internal interrupts, such as those based on timers, don't work in simulation, however with the 16F88 chip I had no problem in simulation with a simple external interrupt such as INT0 on RB0, so I expected to have a similar experience with the 12F617 chip simulation using INT0 on GP2.

The fact that Flowcode's GPIO type interrupt simulation works, but its INT0 simulation does not, leads me to the conclusion that there's a Flowcode simulation bug here.

To demonstrate the problem I have attached a trivial program with a push button input and an LED output. In Properties:Interrupt change the Interrupt On parameter between "INT0 Pin" and "IOC GPIO" to see that the former does not trigger the interrupt routine, but the latter does.
Attachments
PIC12F617 Interrupt Test.fcfx
(5.6 KiB) Downloaded 286 times

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

Re: PIC12F617 External interrupt via GP2 -- how?

Post by medelec35 »

Hi gtc,
I was only referring to hardware.
gtc wrote: but its INT0 simulation does not, leads me to the conclusion that there's a Flowcode simulation bug here.
I have just checked on the beta thread and I posted about INT interrupt that does not use B0 :
interrupt issue1.png
(7.65 KiB) Downloaded 4333 times
So it looks like that statement is correct.
I would assume it's on the list of bugs to be fixed?

Martin
Martin

gtc
Posts: 69
Joined: Mon Mar 23, 2015 5:34 am
Has thanked: 30 times
Been thanked: 15 times
Contact:

Re: PIC12F617 External interrupt via GP2 -- how?

Post by gtc »

Hi Martin,

Many thanks for that confirmation. With microcontrollers, I rely on Flowcode simulation testing as much as possible before committing to hardware.

As your bug report confirms that the INT0 interrupt does work with the hardware as documented, I'll plow ahead with a prototype on that basis.

Hopefully a Matrix staffer will see this thread and reply to your question. On that topic, it would be very helpful if Matrix would provide us users with a list of the reported issues in various versions and their fix status.

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

Re: PIC12F617 External interrupt via GP2 -- how?

Post by medelec35 »

gtc wrote:As your bug report confirms that the INT0 interrupt does work with the hardware as documented, I'll plow ahead with a prototype on that basis.
Just bear in mind that although 12F617 is affected by this simulation bug, it's not mentioned on the list that I had posted.
I'm confidant it will work, but that's not a 100% guarantee.
Martin

gtc
Posts: 69
Joined: Mon Mar 23, 2015 5:34 am
Has thanked: 30 times
Been thanked: 15 times
Contact:

Re: PIC12F617 External interrupt via GP2 -- how?

Post by gtc »

Okay, thanks again. I'll report back how it goes.

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: PIC12F617 External interrupt via GP2 -- how?

Post by Benj »

Hello,

The problem should be fixed in this definition file. Simply copy the file to your "Flowcode 6/FCD/PIC" directory and restart Flowcode for the changes to be loaded.
12F617.fcdx
(12.96 KiB) Downloaded 230 times
I will have a quick search through and see if I can fix this problem on the other devices mentioned.

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: PIC12F617 External interrupt via GP2 -- how?

Post by Benj »

Here are all the devices I found with the problem.
PIC.zip
(80.57 KiB) Downloaded 226 times
If you find/come across any more then let me know.

Post Reply