Topic : "Multiple vector-single handler" and "global code translation"

Forum : 8051

Original Post
Post Information Post
March 5, 2010 - 2:52pm
Guest

I got the 2 following questions and want to post the answers that could help some other developpers facing the same issues:

Quote:
1. It´s possible that a unique function (interrupt service routine) serves
several HW interrupts? When possible how can we implement it?

Try this:

void timer0_irq ( void ) interrupt 1
{
output_packet_timeout--;
}
typedef struct
{
unsigned char ljmp_opcode;
void (*fct) ( void );
} t_irq_handler;
at 0x001b code t_irq_handler timer1_irq_handler = { 0x02, &timer0_irq }; //timer1 irq call timer0 handler

Quote:
2. How can I allocate all the code in a fixed position (i.e we want that all
the code starts on the position 0x4000, reset interrupt included), without
to change the startup.a51, only with linker/compiler directives.

Insert the following directives in the additional options of the linker:
ABSOLUTECODEOFFS(04000H) CODE(04000H)