PIC12F617 External interrupt via GP2 -- how?
Moderator: Benj
-
- 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?
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?
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?
-
- 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?
Hi gtc,
Selecting INT0 Pin should be the INT interrupt on GP2
Martin
Selecting INT0 Pin should be the INT interrupt on GP2
Martin
Martin
-
- 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?
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.
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.
-
- 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?
have you got a pull-down resistor connected between pin and 0V. say 4.k - 15k?
Martin
-
- 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?
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).
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).
-
- 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?
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!
-
- 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?
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.
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 285 times
-
- 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?
Hi gtc,
I was only referring to hardware.
I would assume it's on the list of bugs to be fixed?
Martin
I was only referring to hardware.
I have just checked on the beta thread and I posted about INT interrupt that does not use B0 : So it looks like that statement is correct.gtc wrote: but its INT0 simulation does not, leads me to the conclusion that there's a Flowcode simulation bug here.
I would assume it's on the list of bugs to be fixed?
Martin
Martin
-
- 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?
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.
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.
-
- 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?
Just bear in mind that although 12F617 is affected by this simulation bug, it's not mentioned on the list that I had posted.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.
I'm confidant it will work, but that's not a 100% guarantee.
Martin
- 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?
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.
I will have a quick search through and see if I can fix this problem on the other devices mentioned.
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.
I will have a quick search through and see if I can fix this problem on the other devices mentioned.
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: PIC12F617 External interrupt via GP2 -- how?
Here are all the devices I found with the problem.
If you find/come across any more then let me know.
If you find/come across any more then let me know.
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