Jorge Andres Reyes Alvarez

MCF51QE - HELP Define & Storage Variables

Discussion created by Jorge Andres Reyes Alvarez on Jan 20, 2009
Latest reply on Jan 20, 2009 by Tom Thompson
Im having troubles defining variables in codewarrior 6.2, can you tell me where can i find information about C programming with the MCF51QE in codewarrior? more specifically about defining variables and the  memory storage in that chip...

I want two variables, one for voltage and one for current that changes over the time. Im measuring each from the power line and using the ADC to have the digital value of them. The idea is to calculate the energy that is been used. So, we have one more variable to have the accumulate value of the product of current and voltage (not that easy when using a gain control). I would need that three variables for my project.

I need a little help with where do i have to storage these variables in memory (static, volatile, etc) if im using and interruption, when a conversion completes (ADC Module triggered with the RTC> coco=1), that changes these variables. Whats the best way to do it? i defined that variables as GLOBAL, outside of the main, but when compiling there was an error in the interruption when a conversion is complete (coco Interruption subroutine), why?

Thanks to all, and i´ll appreciate your help.

Outcomes