solved it. using udata_acs and bancsel Lembit ----- Original Message ----- From: "Lembit Soobik" To: "Microcontroller discussion list - Public." Sent: Tuesday, September 19, 2006 4:07 PM Subject: [PIC] 18F4520 - Global variable >I have a program working which reads telegrams from a bus and displays some > info on an LCD. > The program is split on 3 files: > - Main > - Bus (receiving telegrams) > - LCD control > > there are variables defined in each part. Some are globals in each part. > > The LCD part has only 4 variables defined (UDATA), one of which is global > (temp_wr) and is accessed from the Main. > This global variable contains the data for LCD display (one Byte) > > The whole program worked until I added some more variables (in the Bus > part), > when the LCD displayed a row of weird characters (C0h) > Checking the map file, I found that the variables were all in bank 0, > starting at 080h, > but when I added more variables, the 4 variables from the LCD part were > shifted into bank 5, > starting at 500h. > Further tests showed that ONLY if the global variable temp_wr is defined > in > the LCD part global > (and in Main as Extern), AND it is in bank 5, it shows that problem. > If however I put the same variable into Main as global and use it in LCD > (Extern), it works fine, no matter in which bank it is. > > Of course I can use it this way, but I like to understand what's going > wrong > here. > Is it bad programming style to define a global variable in other than the > Main part? > and yes, I did RTFM, but did not find a relevant hint. > > Thank you all for any help > Lembit > > -- > http://www.piclist.com PIC/SX FAQ & list archive > View/change your membership options at > http://mailman.mit.edu/mailman/listinfo/piclist > > > -- > No virus found in this incoming message. > Checked by AVG Free Edition. > Version: 7.1.405 / Virus Database: 268.12.5/450 - Release Date: 18.09.2006 > > -- http://www.piclist.com PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist