I have a port that when any of its pin causes an interrupt, it vectors the MCU to address 0x7B.
I would like to create a new file, and write inside it a function, and have the function's address to be 0x7B.
I'd mention that i write the code in C language, not in assembly language.
At least for PICs, there is a preset function name of some sorts that is at that memory address and gets called whenever the interrupt is triggered. You just declare the function using that name and type out your routine and it just runs whenever the interrupt fires. Check your compiler user manual about interrupts.
Thanks for the answer.
You suggest a nice way how to bypass the setting of a function in a ceratin address.
I'd still like to know how you do that, becuase i assume its possible.
Alirght,
I know that if i used assembly language, i could use the command ' DSEG AT 0x7B '
and their i would be calling my function that serves interrupts.
I just dont know how to write it in C language.
The IAR Compiler for the 8051 has an interrupt keyword that is used to bind a function to an interrupt vector.
Code:
interrupt [0x0023] using [SP_BANK] void SERIALISR(void)
{
...SERIALISR Code
}
It is common to declare an interrupt function as having no return value and taking no arguments. So 0x0023 is the absolute address of the serial port ISR inb all the 8051s you will ever see besides all the ones that you won't. The using qualifier selects one of 4 register banks to be used by the interrupt procedure.