4 buttons to generate 4 interrupts

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
Anonymous
Not applicable

I want to use 4 buttons to generate 4 interrupts(4 pins belong to different ports), but it seems that there is a limit on the port. What should I do? thanks in advance. 

0 Likes
1 Solution
Bob_Marlowe
Level 10
Level 10
First like given 50 questions asked 10 questions asked

I changed the project. Mainly the external switch setup the pins and the isr component. When you use a CY8C32XXBLE you will have some more resources for creating logical gates etc. These could be used to invert the isr polarity.

   

 

   

Bob

View solution in original post

0 Likes
6 Replies
Bob_Marlowe
Level 10
Level 10
First like given 50 questions asked 10 questions asked

Welcome in the forum.

   

You may connect 4 Isr components to the pins and provide 4 different interrupt handlers using Isr_StartEx() API.

   

Alternatively you can use the Global Signal Reference component to get interrupted by any of the port pins. You will need to read the pins to decide which one was pressed.

   

I also suggest to think about how to debounce the buttons using software.

   

 

   

Bob

0 Likes
Anonymous
Not applicable

thank you ,Bob.

   

And sorry for my mistake.What I want to know is that:If 2 pins belong  to the same port and both connect ISR component(separately),there will be an error:When interrupts are used, spanning is not allowed (i.e. all pins must be placed in the same physical port).How to solve this?

0 Likes
Bob_Marlowe
Level 10
Level 10
First like given 50 questions asked 10 questions asked

There is only a common port interrupt, so you have to check which pin raised the exception.

   

You may connect an Isr component directly to the hw-connection of an input pin without using the port interrupt. Will that solve your problem?

   

 

   

Bob

0 Likes
lock attach
Attachments are accessible only for community members.
Anonymous
Not applicable

I tried it the way you said,but there was an error in interrupting the response. Is there a mistake in the code?

0 Likes
Bob_Marlowe
Level 10
Level 10
First like given 50 questions asked 10 questions asked

I changed the project. Mainly the external switch setup the pins and the isr component. When you use a CY8C32XXBLE you will have some more resources for creating logical gates etc. These could be used to invert the isr polarity.

   

 

   

Bob

0 Likes
lock attach
Attachments are accessible only for community members.
Anonymous
Not applicable

Thank you,Bob.

   

Problem solved.And I have seen your comments in other places,and it is related to this question.It helps a lot ,too.