We are running a survey to help us improve the experience for all of our members. If you see the survey appear, please take the time to tell us about your experience if you can.
I'm attempting to use the timer 1 ISR for the ADuC814. In assembly I easily use the ORG directive to write to the address that the PC jumps to when the interupt is set. How do I do the equivalent in C? Any help would be appreciated.
You can locate any function to a specific location in code space by placing it in its own module and then telling the linker where to locate that module. It's a cumbersome and often unnecessary process, however.
and would not work for an ISR (as this thread is about) writing an ISR as a function and linker locate it would make the compiler exit the function with 'ret' instead of 'reti'
Erik
PS do not fall for whatever "interrupt number" the datasheet for your derivative may state, for C purposes the interrupt number is (vector address -3)/8
"writing an ISR as a function and [forcing the] linker [to] locate it would make the compiler exit the function with 'ret' instead of 'reti'"
Yes - hence forcing the adress is necessary, but not sufficient.
and would not work for an ISR (as this thread is about)
He also intimated that he knew how he would have used "ORG" in assembly to get something done and asked about the equivalent in C. In general, only the linker can implement ORG for you. In the special case of ISRs (which I very-well understand he's talking about), I pointed out the interrupt keyword.
not complaining about your post, just clarifying.