Page 1 of 1

PIC12F617 External interrupt via GP2 -- how?

Posted: Fri Sep 11, 2015 6:10 am
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?

Re: PIC12F617 External interrupt via GP2 -- how?

Posted: Fri Sep 11, 2015 8:36 am
by medelec35
Hi gtc,
Selecting INT0 Pin should be the INT interrupt on GP2

Martin

Re: PIC12F617 External interrupt via GP2 -- how?

Posted: Fri Sep 11, 2015 1:27 pm
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.

Re: PIC12F617 External interrupt via GP2 -- how?

Posted: Fri Sep 11, 2015 4:15 pm
by medelec35
have you got a pull-down resistor connected between pin and 0V. say 4.k - 15k?

Re: PIC12F617 External interrupt via GP2 -- how?

Posted: Sat Sep 12, 2015 2:23 am
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).

Re: PIC12F617 External interrupt via GP2 -- how?

Posted: Sat Sep 12, 2015 2:45 am
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.

Re: PIC12F617 External interrupt via GP2 -- how?

Posted: Sat Sep 12, 2015 2:59 am
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.

Re: PIC12F617 External interrupt via GP2 -- how?

Posted: Sat Sep 12, 2015 12:02 pm
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

Re: PIC12F617 External interrupt via GP2 -- how?

Posted: Sat Sep 12, 2015 12:51 pm
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.

Re: PIC12F617 External interrupt via GP2 -- how?

Posted: Sat Sep 12, 2015 1:04 pm
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.

Re: PIC12F617 External interrupt via GP2 -- how?

Posted: Sat Sep 12, 2015 2:16 pm
by gtc
Okay, thanks again. I'll report back how it goes.

Re: PIC12F617 External interrupt via GP2 -- how?

Posted: Mon Sep 14, 2015 12:06 pm
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.

Re: PIC12F617 External interrupt via GP2 -- how?

Posted: Mon Sep 14, 2015 1:11 pm
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.