preprocessor arithmetic and linker
When using named constants in MPASM, arithmetic operations can be performed on them in the preprocessor. This allows you to make code readable.
However, due to the fact that the IVT of the IVController in PIC18FxxQ43 requires the address of the interrupt handler to be divided by 4, there is a difficulty with the syntax of the interrupt table.
Since the code label gets its value only by the linker, and the preprocessor calculates arithmetic even before the code is compiled, the syntax construct:
leads to an error. At the same time, the design:
does not cause an error and compiles normally.
What is worth doing in this case?
The proposal to nail the handler through ORG is not considered. This will require constant manual maintenance of the value in ORG when modifying the code.
post edited by Mark Yampolsky - 2020/04/22 22:58:55