Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

[SOLVED] How to differentiate between an ISR and Normal Function written in Assembly Language.

Status
Not open for further replies.

xpress_embedo

Advanced Member level 4
Joined
Jul 5, 2011
Messages
1,154
Helped
161
Reputation
396
Reaction score
189
Trophy points
1,353
Location
India
Activity points
10,591
Hello!! Everyone
Fews Days back i had an interview, in that they asked me a question.

How to differentiate between an ISR and Normal Function written in Assembly Language?

To which i replied that in PIC Micro-Controllers we use retfie instruction to return from interrupt while in normal we use return instruction

I dont have much idea about assembly language, but wants to know basics.

What is interrupt latency time???
I think it is the time taken to reach ISR when interrupt has occured.
In PIC it is 3 Instruction Cycles Long why??

Apart from that can anyone provide me some information regading how interrupts are handled internally by the compiler and assembler, i.e what will happens when controller gets interrupted, how it reaches particular address and what will happens if someone calls another function in interrupt.
 

Microchip defines interrupt latency as:

Interrupt latency is defined as the time from when the interrupt event occurs to the time code execution at the interrupt vector begins.

If you search on that term for a specific chip, you will find more details. Some chips, e.g., the enhanced 16F series, have automatic context saving; others (e.g., non-enhanced 12F series) do not. Latency will vary with the chip.

You do not absolutely have to use RETFIE to return from an interrupt; although, it is generally advised not to avoid that instruction.

John
 
I haven't worked much with Assembly language but regarding

What is interrupt latency time???

Interrupt latency: what yuo have said is right !
how much time the processor takes to serve the ISR.
For example if you have two ISR's both differing with priority, the lower priority ISR has to wait till the higher to complete but the output depends on the second one, the interrupt latency for second ISR increases and if its for longer time the system stops responding for a moment, and you might feel your system is not responding or not working properly.
so longer interrupt latency is no good

In PIC it is 3 Instruction Cycles Long why??

Thats due to machine level architecture, 3 instruction cycles are fetch decode and execute which is for a basic PIC , latest processor are up to 14 instruction cycles.
The concept of " pipelining " helped to built speed machines and came advanced ARM processors, due to cost basis still PIC controllers are in use.
if intersted you have to read about Instruction pipelining of the particular processor.

Apart from that can anyone provide me some information regading how interrupts are handled internally by the compiler and assembler, i.e what will happens when controller gets interrupted, how it reaches particular address and what will happens if someone calls another function in interrupt.
For you understand, what happens internally you have read multiple documents.
I suggest you start reading "Beginning Linux programming" , you need not work with Linux OS, but it explians well.

- - - Updated - - -

"Beginning Linux programming" , Richard Stones , Neil Mathews !
 
Thanks for the information, but i want to know that What is the difference between normal function and isr function.

retfie and return is the main difference between these.

I am using Ubuntu Linux for some basic purposes, and what we mean my Beginning Linux Programming are you talking about Device Driver programming.
 

Thanks for the information, but i want to know that What is the difference between normal function and isr function.

retfie and return is the main difference between these.

There are differences between PIC chips. It would be easier to discuss a specific chip. The following is a general comment and is, of course, subject to those differences.

The REFFIE instruction can automatically reset some of the enable bits (e.g., GIE) and flag bits for an interrupt. With chips that have automatic context saving, it takes care of that too. In contrast, a RETURN or GOTO from an interrupt will not automatically do those resets. I have not used RETURN from an interrupt and see little use for it, but I have used GOTO plus software re-enabling of GIE and clearing of the interrupt flag.

John
 
Interrupt functions should be relatively short so you don't spend a lot of time servicing them and miss another interrupt request. Normal function can be as long and time consuming as needed. Interrupt functions are always located at a specific memory location depending on the chip. Look for the Interrupt Vector in the spec sheet to find out where it is for your chip. Normal functions can be placed almost anywhere. Interrupt functions are called by hardware (and a few software) triggers where normal functions are called through software only.
 
Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top