Author Topic: Interrupts on PICs  (Read 4670 times)

0 Members and 1 Guest are viewing this topic.

Offline deephaven

  • Frequent Contributor
  • **
  • Posts: 783
  • Country: gb
  • Civilization is just one big bootstrap
    • Deephaven Ltd
Interrupts on PICs
« on: July 07, 2011, 11:00:45 am »
Are there any PICS in the 16/18/24 range that have LEVEL sensitive interrupts rather than edge sensitive ones?
 

Offline PeterG

  • Frequent Contributor
  • **
  • Posts: 814
  • Country: au
Re: Interrupts on PICs
« Reply #1 on: July 07, 2011, 12:12:20 pm »
The only way you could achieve this is with the analog input. Digital inputs cant be used for this purpose.
You may need to poll the analog input.

Regards
Testing one two three...
 

Offline dimlow

  • Frequent Contributor
  • **
  • Posts: 301
  • Country: gb
  • Likes to be thought of as
    • Dimlow Ponders
Re: Interrupts on PICs
« Reply #2 on: July 07, 2011, 12:27:12 pm »
I better way would be to use the comparator of a pic, see here http://ww1.microchip.com/downloads/en/DeviceDoc/41215c.pdf

They have interrupts and that would give you your level interrupt
 

Offline PeterG

  • Frequent Contributor
  • **
  • Posts: 814
  • Country: au
Re: Interrupts on PICs
« Reply #3 on: July 07, 2011, 12:49:39 pm »
Didn't think of those Dimlow.

Regards
Testing one two three...
 

Online Mechatrommer

  • Super Contributor
  • ***
  • Posts: 9515
  • Country: my
  • reassessing directives...
Re: Interrupts on PICs
« Reply #4 on: July 07, 2011, 01:35:53 pm »
still you need an external analog Vref, except simpler (2 resistors?).
if something can select, how cant it be intelligent? if something is intelligent, how cant it exist?
 

Offline deephaven

  • Frequent Contributor
  • **
  • Posts: 783
  • Country: gb
  • Civilization is just one big bootstrap
    • Deephaven Ltd
Re: Interrupts on PICs
« Reply #5 on: July 07, 2011, 03:16:43 pm »
Thanks for the replies. I never thought about using an analogue input as an interrupt source as other makes of micro have the ability to choose between edge and level sensitive interrupts. I will look into this as a possible solution.
 

Offline mikeselectricstuff

  • Super Contributor
  • ***
  • Posts: 12110
  • Country: gb
    • Mike's Electric Stuff
Re: Interrupts on PICs
« Reply #6 on: July 07, 2011, 03:41:36 pm »
Assuming you are talking about the traditional meaning of level-sensitive, i.e. maintain the int condition for as long as the pin is at the corresponding level, just interrupt on the edge and poll the pin until it goes inactive.

If you mean int at a specific voltage level, that's what comparators are for.

Youtube channel:Taking wierd stuff apart. Very apart.
Mike's Electric Stuff: High voltage, vintage electronics etc.
Day Job: Mostly LEDs
 

Offline deephaven

  • Frequent Contributor
  • **
  • Posts: 783
  • Country: gb
  • Civilization is just one big bootstrap
    • Deephaven Ltd
Re: Interrupts on PICs
« Reply #7 on: July 07, 2011, 04:03:36 pm »
Hi Mike,

It's the former. The trouble is I have around twelve possible sources of interrupt all going into the same pin and I don't want to miss any. This means after I get an interrupt caused by the edge of the first one, I have to then go and see if there have been any others (this is all done with an FPGA as the source, so I can look at the register in in FPGA to see what interrupts are pending). However, it is still possible to miss an interrupt if I get one between when I've done a poll at the end of the old interrupt and returning to the background. In the past I've made psuedo level driven interrupts by gating the interrupts with a square wave so that it keeps knocking at the PIC's door till it gets serviced.
 

Offline Rufus

  • Super Contributor
  • ***
  • Posts: 2094
Re: Interrupts on PICs
« Reply #8 on: July 08, 2011, 02:40:07 am »
However, it is still possible to miss an interrupt if I get one between when I've done a poll at the end of the old interrupt and returning to the background.

I don't see there is any issue. The interrupt edge trigger is re-armed by clearing the interrupt flag not returning. If you check the interrupt pin level after clearing the interrupt flag a new interrupt will either be seen by the level check or set the interrupt flag again if it occurs later.
 

Offline deephaven

  • Frequent Contributor
  • **
  • Posts: 783
  • Country: gb
  • Civilization is just one big bootstrap
    • Deephaven Ltd
Re: Interrupts on PICs
« Reply #9 on: July 08, 2011, 08:01:53 am »
However, it is still possible to miss an interrupt if I get one between when I've done a poll at the end of the old interrupt and returning to the background.

I don't see there is any issue. The interrupt edge trigger is re-armed by clearing the interrupt flag not returning. If you check the interrupt pin level after clearing the interrupt flag a new interrupt will either be seen by the level check or set the interrupt flag again if it occurs later.

I think that has been what I was doing wrong, I would check the interrupt status bit in the PIC but I should have been looking at the pin. Thanks Rufus.
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf