Is their any difference between interrupt vector table and priority table. Does the vector node simply tells its priority? Here is the vector table:

- 330
- 1
- 11
- 39
- 2
- 6
-
3Why don't you menation the particular chip you are asking about? You questions doesn't have a one-fits-all answer. In some comment you mention an NVIC, so presumably you are talking about some ARM chip? – Wouter van Ooijen Aug 20 '15 at 08:02
4 Answers
The interrupt vector table is simply an area of memory (often beginning at address 0) to hold all the possible interrupt vectors for a processor. By vector, this means when an interrupt occurs, the processor will stop what it is doing, and then vector to the memory location reserved for that interrupt. In a 32 or 64-bit processor, there may be hundreds of vectors.
Each vector is separated by a fixed number of bytes which allows, as a minimum, a jump to be stored there which will jump to the beginning of the ISR (interrupt service routine) that handles that interrupt.
The location of this table, and the order of the vectors within it, are a hardware feature of the processor and cannot be modified except on some processors, the number of bytes allocated for each vector can be modified.
Interrupt priorities are set by the program for each interrupt source that is enabled. As an example, they may range from 1 (lowest) to 7 (highest) -- many other schemes exist. If an interrupt comes in that has a higher priority than the one currently executing, the current one will be interrupted by the higher one unless interrupts are disabled.
Some processors even allow sub-priorities to be specified within a major priority group. So this would control what happens when an interrupt comes in with the same major priority level as the one currently executing.
- 48,066
- 5
- 98
- 162
-
Thanks tcrosley... But lets say I program only two interrupt register, SPI as priorty 18 and ADC as Priorty 12 by setting NVIC register, (without setting timer interrupt in the software) so what actually happens? Will any interrupt occur? Datasheet says that if two interrupt of same priorty occurs, then core will do the internal polling. – user123456 Aug 20 '15 at 06:23
-
@user123456 I'm a little confused by your comment, as the timer interrupt has nothing to do with the others. If you don't enable it, then that interrupt won't take place, but the others will, as long as they are enabled. Setting a priority doesn't automatically enable an interrupt; those are separate operations. If you don't set a priority, it will use the default (usually lowest or highest, depends on the processor). If two interrupts of the same priority occur, then unless the processor has sub-priorities, one will execute after the other (there will be some rule to determine which). – tcrosley Aug 20 '15 at 08:19
Yes, there's a difference. The vector table tells the processor WHERE to go to execute code when an interrupt happens. If the interrupt is enabled and its flag is set, the priority tells the processor WHEN it's actually allowed to go there and execute the code.
So the interrupt will always execute the code at the address in the vector. But if its priority is low, and other higher priority interrupts are executing, it may be some time before it actually gets to execute.
On some 8051 derivatives, if you get two identical priority interrupts at the same time, the interrupt that takes priority is determined by an "internal polling sequence", which happens to be the same order as the peripherals appeared in the vector table. But that's not necessarily true for every processor. Implementations of interrupt systems can be wildly different.
- 41
- 1
- Priority refers to interrupts, every interrupt has his own priority level.
- The lower priority number represents the interrupt with higher priority.
- Higher priority number interrupts are stopping execution of interrupt with lower priority.
- If no priorities defined, when new interrupt arrives, he is set to pending mode, and waits for end of currently active interrupt.
- You can define interrupt groups in case you want to add same priority level to some group of interrupts.
- You can find all available interrupts in Vector Table.
- Vector table is table which contains: interrupt number, priority, pointer to ISR.
So every time you get an interrupt, it goes to Vector Table, finds appropriate priority number and interrupt, then jumps to a function which is pointed by a value from Vector Table and executes that ISR routine also called interrupt function.
- 1,019
- 4
- 23
- 44
-
Thanks Junior. But in the vector table attached, there is no priorty written.?? – user123456 Aug 20 '15 at 06:44
-
You give priority to an interrupt, if you don't give, interrupt has his own default priority and behaves as I written above. @user123456 – Junior Aug 20 '15 at 06:46
-
So is that default priorty is according to the vector number?Because in the data sheet there's nowhere explicitly written default interrupt.? – user123456 Aug 20 '15 at 06:54
-
Every interrupt is set to highest possible priority number, so if not configured, they executes serially, one after another. @user123456 – Junior Aug 20 '15 at 06:55
-
One more thing.. lets say i assign SPI to 22 prioty (acc to vector table, SPI priorty is 11), so is that after Priority 10, priority 12 will be executed? – user123456 Aug 20 '15 at 07:01
-
Default SPI priority is 11, but if you assign it to 22 it becomes 22. First lower priority number interrupts are executed and then interrupts with higher priority number. – Junior Aug 20 '15 at 07:26
Depends on the architecture. For some the priority may also be defined by the order of the vectors, leaving you know choice, vector 7 connected to foo, may always be higher priority than vector offset 8 tied to bar.
In general though one would hope that the vector table is just a table, the phone book or address book. Who you call first for some type of event is a separate list, from that priority list you get a name then you look the name up in the phone book and call them. You are desperate for pizza and ordering pizza is currently more important than feeding the pet, you look up the pizza number in the vector table call that number, then you look up your kids cell phone and have them feed the dog. The vector table is the list of addresses to things. The priority is separate...usually.
- 8,274
- 24
- 33