I use * hardware.inc* to define all pins and hardware related stuff. And *#include hardware.inc* in every file it is needed. Here a sample: ; ; Unico posto in cui si possono definire ; gli I/O del micro_processore errorlevel -302 errorlevel -312 PROCESSOR PIC16F88 #include p16f88.inc Extern X, Y, U1, U2 ; Extern U3, U4 Extern W_TEMP, timer1, timer2, timer3 ;Oscillatore interno a 8 MHz Clock EQU .69 ;Base dei tempi: 100 us - Prescaler 1:1 ;cOSCTUNE EQU B'00000000' ; cOSCCON EQU B'01110000' ;Usa oscillatore come CFG, 8 MHz ;cOSCCON EQU B'01010000' ;Usa oscillatore come CFG, 2 MHz TimeBase1 EQU .200 ;Timer2 -> 20 ms TimeBase2 EQU .100 ;Timer3 -> 2 s FrequenzaPWM EQU .255 #define PWMHigh 0 ;---------------------------------------------------------- ; PORTA tris_a EQU b'00000001' ;TRIS pwon_a EQU b'00000000' ;stato I/O (PORTA) #define in_trimmer PORTA,0 ;2 AN0 ;#define unused PORTA,1 ;3 AN1 ;#define unused PORTA,2 ;4 AN2 ;#define unused PORTA,3 ;5 AN3 ;#define unused PORTA,4 ;6 ;#define unused PORTA,5 ;7 ;#define unused PORTA,6 ;10 ;#define unused PORTA,7 ;9 cADCON0 equ B'10000001' ;0: enable conversion ;1: unused ;2: W1 = start / R = status ;5-3: selezione canale ;7-6: ADCS1-0 = base dei tempi (16/32 Tosc) Canale0 equ cADCON0 & B'11000111' | B'00000000' Canale1 equ cADCON0 & B'11000111' | B'00001000' Canale2 equ cADCON0 & B'11000111' | B'00010000' Canale3 equ cADCON0 & B'11000111' | B'00011000' Canale4 equ cADCON0 & B'11000111' | B'00100000' cADCON1 equ B'00000000' ;0-3: unused ;5-4: vref ;6: ADCS2= base dei tempi ;7: ADFM=1 risultato giustificato verso il basso ;Base dei tempi A/D ;ADCS2-0 = 101 16 Tosc ;ADCS2-0 = 010 32 Tosc cANSEL equ B'00000001' ;---------------------------------------------------------- ; PORTB tris_b equ b'00011110' ;TRIS pwon_b equ b'00000000' ;stato I/O #define out_pwm PORTB,0 ;21 #define in_dip1 PORTB,1 ;22 #define in_dip2 PORTB,2 ;23 #define in_dip3 PORTB,3 ;24 #define in_dip4 PORTB,4 ;25 ;#define unused PORTB,5 ;26 ;#define icsp_pgc PORTB,6 ;27 ;#define icps_pgd PORTB,7 ;28 KPL wrote: >> And that is done automaticly by MPLINK when using >> reloc mode. Nothing top change in the source code. >> >> Jan-Erik. >> -- >> > > ok, thanks, will try in the evening. > > What about the other question? I tried yesterday, looks like #DEFINE > is limited to the file where it is given. How to define some pin names > (or other substitutes) in main file, which will be used in some > subroutines in separate section? I would not like to #define those > things in every file separately. How do people do this? > > -- http://www.piclist.com PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist