339Views10Replies

Author Options:

Please how do I enable a level sensitive interrupt for my PIC on mikro c? Answered

In all the sites I have checked, its only the INTEDG command to enable  rising or falling edge interrupt. Please how can I enable a level triggered interrupt on my PIC18F14K22 with mikroc compiler? Thank you. 

Discussions

The forums are retiring in 2021 and are now closed for new topics and comments.
0
iceng
iceng

Best Answer 5 years ago

You cannot interrupt on an analog voltage point.

You can trigger on a counter going through zero and you can trigger on a high or a low level.

Say you want to trigger when a pin is high level.

Well unless that pin is already high when you enable the interrupt,

The logical situation is that pin starts out low and you want to interrupt when it is high...

Interrupting is faster then poling the pin, Well the fastest interrupt occurs when the pin just went high.

In fact the fastest way to detect a high pin is the so-called rising edge detect interrupt on change detect.

The upshot is that PIC has no Level interrupt because it makes no sense.

Look it up yourself on part 7.

http://ww1.microchip.com/downloads/en/DeviceDoc/41...

0
steveastrouk
steveastrouk

Answer 5 years ago

Plenty of processors HAVE digital level sensing interrupts - the 8052 family for one. Simply, while the interrupt pin is high, the interrupt routine fires (or if its low, depending on the config)

0
ikechukwu.dimobi
ikechukwu.dimobi

Answer 5 years ago

Thank you very much, its clear now.

0
ikechukwu.dimobi
ikechukwu.dimobi

Answer 5 years ago

Thank you. So what you are saying is that PIC MCUs dont hae level trigered interrupt capability

0
steveastrouk
steveastrouk

Answer 5 years ago

Yes, it looks like they can only be edge-triggered. What are you trying to do that needs level-triggered interrupts ?

0
iceng
iceng

Answer 5 years ago

This level triggering is vague

Say author wants to trigger on a high

Does author want to trigger some time after the pin goes high ?

Or does author want to trigger immediately when the pin goes high ?

0
steveastrouk
steveastrouk

Answer 5 years ago

WHILE the pin is high.

0
iceng
iceng

Answer 5 years ago

That means that as soon as the interrupt is enabled the interrupt will activate because the line is already high.. That is the same as polling the line.

0
steveastrouk
steveastrouk

Answer 5 years ago

Except the interrupt hardware does it for you.

0
iceng
iceng

Answer 5 years ago

Yes and why not

0
seandogue
seandogue

5 years ago

"... how do I enable a level sensitive interrupt...?"

A threshold detector will produce the signal you need to trip the interrupt. GOogle the bolded term if you are unfamiliar