How can I to set general I / O ports as an interrupt source? (SOLVED!)

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

Moderator: Benj

Post Reply
Lagoda
Posts: 170
Joined: Fri Jul 15, 2016 9:51 pm
Has thanked: 69 times
Been thanked: 61 times
Contact:

How can I to set general I / O ports as an interrupt source? (SOLVED!)

Post by Lagoda »

Hi All,

I would like to use a PIC32MZ Series MCU.
I wanted to use an external interrupt, but I could not to interpret what I see in the "Interrupt Proprties" window.
How can I to setup the masks?
I've also tried the "Select pin (s)" button, but every pin of this port is active at both edges by default.
If I click on an active pin seem I can to deactivate and vice versa, but I can not to select that have to work it on rising edge or falling edge only.

How to configure I/O interrupts through this interface?
Can somebody help me?

Best Regards,
Lagoda
Attachments
Interrupt.jpg
Interrupt.jpg (118.41 KiB) Viewed 4484 times
Last edited by Lagoda on Wed Oct 18, 2017 11:04 pm, edited 1 time in total.

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: How can I to set general I / O ports as an interrupt source?

Post by Benj »

Hi Lagoda,

Looks to me like it's an all or nothing thing on the silicon. i.e. if you enable the pin then it will interrupt on rising and falling edges. Unless I'm missing something.

You can filter out one of the edges using software. Look at the counting multiple pulses example here.
https://www.matrixtsl.com/wikiv7/index. ... Interrupts

Lagoda
Posts: 170
Joined: Fri Jul 15, 2016 9:51 pm
Has thanked: 69 times
Been thanked: 61 times
Contact:

Re: How can I to set general I / O ports as an interrupt source?

Post by Lagoda »

Hi Ben,

I checked what you recommended.
In this example, you can set any type of edge. (color of the pin may be green, red, gray or white)
And I opened a new project.
If I set the type of target MCU to PIC32MZ2048EFM144 then you can activate the interrupt on both edges only.
(The color of the pin may only be green or white.)
Please try it out.

Lagoda

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: How can I to set general I / O ports as an interrupt source?

Post by Benj »

Hi Lagoda,
In this example, you can set any type of edge. (color of the pin may be green, red, gray or white)
And I opened a new project.
If I set the type of target MCU to PIC32MZ2048EFM144 then you can activate the interrupt on both edges only.
The PIC32MZ device only supports both edges as part of the IOC interrupt, it is a limitation of the silicon not Flowcode.

You would have to interrupt on both edges and then take the current value of the port pin, if the bit is a logic 1 then the last edge was a rising edge.

Lagoda
Posts: 170
Joined: Fri Jul 15, 2016 9:51 pm
Has thanked: 69 times
Been thanked: 61 times
Contact:

Re: How can I to set general I / O ports as an interrupt source?

Post by Lagoda »

The PIC32MZ device only supports both edges as part of the IOC interrupt, it is a limitation of the silicon not Flowcode.
Oops!

This avoided my attention. I'm sorry. :oops:

I hope this MCU isn't will cause more surprises for me.

Thank you very much.

Best Regards,

Lagoda

stefan.erni
Valued Contributor
Valued Contributor
Posts: 654
Joined: Fri Aug 19, 2016 2:09 pm
Location: switzerland
Has thanked: 182 times
Been thanked: 179 times
Contact:

Re: How can I to set general I / O ports as an interrupt source? (SOLVED!)

Post by stefan.erni »

Hi Lagoda

I have problem with the IRQ on the PIC32MZ. My program crash if the IRQ is on.....
Can I have a sample from your code?

Post Reply