> So, from > then on, I used six variables in the lcd.o object file which would be > defined in the main.o file. (the idea behind this is to be > able to change the ports and bits used by the LCD, depending on the > complexity or needs of the project.) > > So I defined: > LCTRL -> The port which has the LCD control lines (RS, RW, EN) > LBUS -> The port which holds the LCD data/address > LBUST -> LBUS direction control (LBUS's TRIS register) > RS -> Bit n: for the RS line > RW -> Bit n: for the RW line > EN -> Bit n: for the EN line. > > The problem is that I can assign the registers in main.o, but > not the bits!! Dave Dilatush replied >Ricardo, > >I've run into this same problem, which is that constants defined >in one .asm file (with the #define directive) cannot be declared >GLOBAL as can be done with variables. > >The solution I arrived at was to #define bit assignments and >other global constants in a separate "global declarations" file, >and then #include that file at the beginning of each .asm file of >the project. The global declarations file also contains the >#include directive which brings in Microchip's processor >definitions file (for instance, p16f877.inc). > >That way, I can change bit assignments, and even the target >device for a project, by editing only one file instead of editing >every .asm source file. This is exactly what is done with Olin's development environment. There is a global include file where all the port and bit assignments are set up, and then he has a pre-processor which sets up macros making the assignments a lot easier to use. In one assignment statement macros for the port, bit and tris register are all set up together. See http://www.embedinc.com/pic/ to download the software, and follow the link there to Jan-Eriks site for a good PDF manual to it all. -- http://www.piclist.com hint: PICList Posts must start with ONE topic: [PIC]:,[SX]:,[AVR]: ->uP ONLY! [EE]:,[OT]: ->Other [BUY]:,[AD]: ->Ads