External interupts not working

Moderator: Benj

Post Reply
dz28
Posts: 60
Joined: Thu Aug 04, 2016 3:30 pm
Has thanked: 7 times
Been thanked: 9 times
Contact:

External interupts not working

Post by dz28 »

Hello,

I am working with the PIC18F45Q10 Micro.
Using External Interrupts INT0 and INT1
The data sheet shows that these are Remappable pins to any PortA or PortB location.
I don't see anywhere to select the pins so I am using the default locations RB0 and RB1 and have an active High switch connected to each.
Flowcode (V8.2.2.15) seems to recognize this setup and simulates correctly.
I compile to Hex (no errors) and program with PicKit3 (attached to EB006V9) with no problems.
When running the hardware the chip does not vector to the interrupt macro when the external switches are engaged.
Hardware is EB006V9 and EB083 I/O brd.

Any thoughts would be appreciated.

Thanks,
Dave

dz28
Posts: 60
Joined: Thu Aug 04, 2016 3:30 pm
Has thanked: 7 times
Been thanked: 9 times
Contact:

Re: External interupts not working

Post by dz28 »

IOC seems to be non functional also

Thanks
Dave

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

Re: External interupts not working

Post by medelec35 »

Hi Dave,
I have moved your topic to the bugs section as I agree there are issues with the interrupt.
For the selection of INT0 remapable pins, I have temporarily attempted to fix it.
Not sure if will work correctly in hardware or not as not an expert with Fcdx files.
Can you place the attached file in C:\ProgramData\MatrixTSL\FlowcodeV8\FCD\PIC folder.
The folder is hidden by default.
Reload Flowchart and hopefully you will be able to select different pins?
Not addressed IOC.
Attachments
18F45Q10.fcdx
(42.89 KiB) Downloaded 146 times
Martin

dz28
Posts: 60
Joined: Thu Aug 04, 2016 3:30 pm
Has thanked: 7 times
Been thanked: 9 times
Contact:

Re: External interupts not working

Post by dz28 »

I'll give it a try and let you know how it works out.

Thanks,
Dave

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

Re: External interupts not working

Post by medelec35 »

OK nps.
If not working, can you please make sure1 second flash test is working OK?
Martin

dz28
Posts: 60
Joined: Thu Aug 04, 2016 3:30 pm
Has thanked: 7 times
Been thanked: 9 times
Contact:

Re: External interupts not working

Post by dz28 »

Martin,

Good news INT0 seems to now work!!
Can this mod be extended to include INT1 and INT2?

Thanks again for your Help and quick response

Dave

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

Re: External interupts not working

Post by medelec35 »

Hi Dave,
Your welcome.
dz28 wrote:Good news INT0 seems to now work!!
That is good news.
Try this unofficial fix.
Attachments
18F45Q10.fcdx
(45.51 KiB) Downloaded 149 times
Martin

dz28
Posts: 60
Joined: Thu Aug 04, 2016 3:30 pm
Has thanked: 7 times
Been thanked: 9 times
Contact:

Re: External interupts not working

Post by dz28 »

Tested INT0 and INT1 and they seem to work with the hardware.
I'll give a good go on Monday

Thanks,
Dave

dz28
Posts: 60
Joined: Thu Aug 04, 2016 3:30 pm
Has thanked: 7 times
Been thanked: 9 times
Contact:

Re: External interupts not working

Post by dz28 »

I had a chance to play with this a bit now.
INT0 seems to work OK by itself.
INT1 by itself or along with INT0 is very erratic.
Sometimes triggering sometimes not.
If I add a tMR0 interrupt to the mix things get worst.
I think there is more going on here.

Let me know if you want me to try anything specific to help debug this.

Thanks,
Dave

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: External interupts not working

Post by Benj »

Hi Dave,

Is the signal going to the INT1 pin at full VCC and VSS voltage? Also is the rise/fall time nice and fast, we have seen unexpected things when using capacative type signals.

H Martin,

Thanks for the fix to the FCD. I've checked the datasheet and your solution looks good to me so I've applied this fix to the rest of the family.

dz28
Posts: 60
Joined: Thu Aug 04, 2016 3:30 pm
Has thanked: 7 times
Been thanked: 9 times
Contact:

Re: External interupts not working

Post by dz28 »

The signals look good.
I am using Eblocks boards EB083 and EB006V9
Programming with PicKit3 plugged into the EB006V9
The Switch signals do fall short of 5V only swinging to 3.1V at the PIC
EB083 is unmodified.

Weird thing is that if I write a program to toogle an LED every 1 sec in the TMR0 interupt routine everything works fine.
If I add INT0 and a switch on RB0. The LED flashing becomes erratic. This happens with the INT0 switch untouched and RB0 sitting at Ground.

I will mod the EB083 board so it switches to 5V.

Thanks
Dave

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

Re: External interupts not working

Post by medelec35 »

Can you post a flowchart that has the issues you have described?
Martin

dz28
Posts: 60
Joined: Thu Aug 04, 2016 3:30 pm
Has thanked: 7 times
Been thanked: 9 times
Contact:

Re: External interupts not working

Post by dz28 »

Martin,

Attached are 2 flowcharts
Both simulate fine in flowcode.

"Test2" seems to work fine programmed to hardware.
"LED_Flash" adds some minor complexity to the interrupt routines and main loop.
The TMR0 led flash struggles to stay in sync when programmed to hardware.

Could be some type of programming error that causes a conflict on the portA outputs?

Thanks,
Dave
Attachments
Test2.fcfx
(14.04 KiB) Downloaded 128 times
LED_Flash.fcfx
(19.16 KiB) Downloaded 117 times

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

Re: External interupts not working

Post by medelec35 »

Not sure if will make a difference or not.
Can you try with a basic port output instead of Led_5mm turn on/off?
Martin

dz28
Posts: 60
Joined: Thu Aug 04, 2016 3:30 pm
Has thanked: 7 times
Been thanked: 9 times
Contact:

Re: External interupts not working

Post by dz28 »

Moved the TMR0 LED to PORTB and it seems happy now.

Dave

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

Re: External interupts not working

Post by medelec35 »

dz28 wrote:Moved the TMR0 LED to PORTB and it seems happy now.
Ahh, that's good.
I did suspect that the same component within different interrupts could cause an adverse affect.
Just was not 100% sure where LED components are concerned.
Glad its now working as expected.
Martin

Post Reply