I have noticed that the Kiel compiler doesn't produce the correct interrupt vector if 8051 interrupt numbers are used. For example for external interrupt 0 (IE0), the interrupt number has to be 0, instead of 1 to produce a jump at location 1. Example:
void edge1 (void) interrupt 0{ /*produces correct code
while
void edge1 (void) interrupt 1{ /*produces wrong code
This is the case with all the interrupts I have used. My questions is what do you have to do to produce a reset vector? Reset is interrupt number 0 in 8051 numbering. Using -1 or 255 both produce a compile error.
The 8051 documentation does assign numbers to the interrupts. These numbers reflect each interrupts priority level. VERY incomplete statement and many have been led astray by this.
Correctly the statement should be: These numbers reflect each interrupts priority level for interrupts occurring in the same processor cycle
Another caveat is that some modern derivatives have 'gaps' in the interrupt vectors (usually an interrupt that another family member has) and do not have gaps in the 'interrupt numbers'
Thus the only safe way to get an 'interrupt number' is by the formula ((interrupt_vector_address/8 ) -3)
Erik
That should be:
"the only safe way to get Keil's so-called 'interrupt number' for C51 is by the formula ((interrupt_vector_address/8 ) -3)"
and, in fact, it's not completely safe - as it doesn't state the upper-bound on Keil's so-called C51 "interrupt numbers".
Therefore, the only really safe way to get Keil's so-called 'interrupt number' for C51 is to Please read the manual: http://www.keil.com/support/man/docs/c51/c51_le_interruptfuncs.htm
Source Priority Within Level 1. IE0 (highest) 2. TF0 3. IE1 4. TF1 5. RI+TI (lowest)
You have now responded with:
I don't see how that has anything to do with interrupt numbers - and it certainly doesn't suggest that reset is "interrupt 0".
The point is this:
The 8051 documentation does assign numbers to the interrupts. These numbers reflect each interrupts priority level.
VERY incomplete statement and many have been led astray by this.
Which part of "Source Priority Within Level" do you not understand?
Time to give the debugger a fresh cup of tea.
No, I don't think it does.
It simply presents them in an ordered list, using '1' to indicate the highest priority and '5' the lowest.
Saying, "IE0 has priority level 1 (highest)" is not at all the same as saying, "IE0 is interrupt number 1".
This is like pulling teeth! You're not usually quite this obtuse.
Yes, you're right.
I don't disagree with you (that is surely the only interpretation you can put on it by now?) - however the table that does what you describe (correctly) above leads to confusion because people assume that the number given to/assigned to/written beside/stated along with/beside/near/asscoiated with each interrput is the very same number that should be entered following the 'interrupt' keyword.
If you disagree further with my attempt to agree with but expand on your explanation then you may consider me well and truly beaten.