Discussion Forum

8051 Interrupt Vector Location

Next Thread | Thread List | Previous Thread Start a Thread | Settings

DetailsMessage
Read-Only
Author
Jerry Yeo
Posted
3-Aug-2005 14:48 GMT
Toolset
None
New! 8051 Interrupt Vector Location
The interrupt vector is always stored in the 0003H code memory. Is it possible to store it in another location ?

Thank You
Read-Only
Author
Gavin Nottage
Posted
3-Aug-2005 15:01 GMT
Toolset
None
New! RE: 8051 Interrupt Vector Location
I would expect it depends on the uC you're using, and suggest you take a look at its datasheet.
Read-Only
Author
erik malund
Posted
3-Aug-2005 15:04 GMT
Toolset
None
New! RE: 8051 Interrupt Vector Location
The interrupt vector is always stored in the 0003H code memory. Is it possible to store it in another location ?

the hardware will start executing whatever code is at address 03h for NOT "The interrupt vector", BUT "the vector for EI0".

Keil has some fancy tapdancing code for the eval versions that will store something (CALL or JMP) in the locations that the hardware accesses that then call or jump to another location, but the interrupt is still initiated at the location specified by the hardware.

Erik
Read-Only
Author
Martin Macher
Posted
3-Aug-2005 16:04 GMT
Toolset
None
New! RE: 8051 Interrupt Vector Location
Assuming you are programming in C, you have to define the interrupt function attributes, e.g. for Philips P89C664:

void Int_timer_tf2( void ) interrupt 7 using 2
{
   ... source lines ...
}
There are two keywords:
interrupt x defines the interrupt number. This number tells compiler which vector address you want. See also the manual "Cx51 Compiler User's guide - Chapter 3 Language Extensions - Function Declarations - Interrupt Functions" on p. 125. Look at the table "Interrupt Number" to "Adress"!

using x defines the desired register bank access for the interrupt function.

In the example mentioned above, the function Int_timer_tf2() will be called if an TF2 event occurs, because the interrupt vector address is 0x003B. This function use the register bank 2 (Registers in Addr 0x10 to 0x17).

If you want to get other interrupt vector addresses than the standard one described in the manual you have to define your own interrupt vector addresses with the INTVECTOR and INTERVAL control directives. Please read the manual.

Martin
Read-Only
Author
Jerry Yeo
Posted
4-Aug-2005 05:01 GMT
Toolset
None
New! RE: 8051 Interrupt Vector Location
Thank You.

I have tried to use "#pragma intvector(0x8000)" in my main.c where my interrupt routines are defined.

I have check the .m51 file, and the interrupt vector table has been shifted to 0x8000 onwards.

But after I have done all these, my program cannot work.

Did I miss out anything ?

Thank You
Read-Only
Author
Andrew Neil
Posted
4-Aug-2005 09:03 GMT
Toolset
None
New! RE: 8051 Interrupt Vector Location
http://www.keil.com/support/man/docs/c51/c51_intvector.htm

"Did I miss out anything ?"

Almost certainly: you have succesfully got the tools to place the vectors at a different location, but you haven't mentioned doing anything to get the hardware to look at that new location!

How do you propose that your 8051 silicon will find these re-located interrupt vectors...?

This comes back to Gavin's original response to you:

"I would expect it depends on the uC you're using, and suggest you take a look at its datasheet."
Read-Only
Author
erik malund
Posted
4-Aug-2005 13:15 GMT
Toolset
None
New! RE: 8051 Interrupt Vector Location
I suggest you realize that while there may, indeed, be such a person as a "PC programmer" to call anyone a " '51 embedded programmer" would be the equivalent of calling that person "worthless".

If you want to work with the '51 you need to become (study as needed) an "embedded engineer".

To succesfully work with small micros such as the '51 it is impossible to be hardware ignorant.

Erik
Read-Only
Author
Jon Ward
Posted
4-Aug-2005 14:12 GMT
Toolset
None
New! RE: 8051 Interrupt Vector Location
http://www.keil.com/support/docs/189.htm

Jon
Read-Only
Author
Andy Neil
Posted
4-Aug-2005 15:59 GMT
Toolset
None
New! RE: 8051 Interrupt Vector Location
http://www.keil.com/support/docs/189.htm

Yes, that tells you everything you need to do to generate the code - but you still need to have the right hardware to make any use of it!

This is not a software-only issue!

Next Thread | Thread List | Previous Thread Start a Thread | Settings