AnsweredAssumed Answered

Problems of defining local and global variables

Question asked by Sai Chun TANG on Jan 21, 2011
Latest reply on Jan 25, 2011 by Sai Chun TANG

Hello,

 

I am a beginner of writing application that consists of one main program with subroutines in separate files for HCS08QE.

 

In my test program, I declared a global variable (GlobalVar) in the main program and two local variables (SubRoutineVar1 and SubRoutineVar2).  However, the subroutines cannot see the Global Variable and it cannot be compiled.

 

When I replaced the comment "ADD GlobalVar" by "ADD #05" in the subroutine, the program can be complied, but in the .map file, I found the SR_DataSec Section started at 0x20A3 (which is in the ROM segment, but I want it to be at the direct-page RAM segment).

 

By the way, I have tried to find some information about using CW. Some pdfs mention changing the .prm file, but I got more errors after doing that. I have been reading the pdf  "HC(S)08/RS08 Assembler Manual for Microcontrollers", may I have your advices what infomation (e.g. pdfs) I should read to learn such things.

 

Thanks a lot.

Outcomes