Hello, I have faced a problem with a function pointer variable. I have separated the uart module in two parts: HAL, which abstracts the hardware, and Service, which provides the uart service to the application. The interrupt routine is in HAL module, which has a function pointer variable that is called into the interrupt routine as interrupt handler. The actual interrupt handler function is in Service module. This function is assigned to the function pointer variable through a install function in the init routine. It works in debug simulation, but when I load the hex file to the microcontroller the application does not work. Anyone can help me?
Well it's not always necessary but unfortunately it is necessary for certain things. In my case the serial port queue code was also the same as some other queues code so they shared common functions/routines. That's the way it goes.
The most important thing was that it prevented the reinvention of bugs err new wheels. :D Bugs were (are) more expensive than code space I've decided.
Stephen
first: All functions called within an interrupt must be reentrant. (it's a keil keyword).
then: Well it's not always necessary
correct: it is NEVER necessary unless you are doing the crazy (for C51) stuff of calling functions from both main and an ISR.
Erik