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 have a routine in my main program file for displaying float values on terminal program. When i try to use the same routine in my Interrupt service routine(ISR), it give an warning stating "Reference made to unresolved function". Secondly i also wanted to know how can i use a global variable in the ISR as its not possible to pass a parameter from any routine to the ISR.
When i try to use the same routine in my Interrupt service routine(ISR), it give an warning stating "Reference made to unresolved function". That's two bad things in one sentence. First, you shouln't be doing such excessively hard work as formatting an FP number in an ISR, ever. Second, that's not a warning, it's an error, and it says you didn't actually manage to call the same routine---probably just a typo in the call to it, but it's impossible for anyone out here to be sure, since you didn't show any actual code. Secondly i also wanted to know how can i use a global variable in the ISR Just do it. But be sure not to use a multi-byte variable, or if you do, read up on multi-threaded programming techniques like "semaphores".
Secondly i also wanted to know how can i use a global variable in the ISR Just do it. But be sure not to use a multi-byte variable, or if you do, read up on multi-threaded programming techniques like "semaphores a better search word might be "atomic" Erik
Also study the volatile keyword. A global variable shared between an ISR and main code should be declared volatile.
"A global variable shared between an ISR and main code should be declared volatile." Note that this is in addition to Hans-Bernhard & Erik's notes about "atomic" accesses - not an alternative!