Awwwww! Bruce beats me again.
And he's right. Doesn't make much difference. PBP catagorizes the variables according to type, and then sorts them alphabetically within each type.
The "order" depends on whether you are using a 14-bit or 16-bit core.
For 14-bit cores the order is ...
1 - WORD arrays
2 - BYTE arrays
3 - WORD's
4 - BIT array's
5 - BYTE's
6 - BIT's
For 16-bit cores the order is ...
1 - Bit Arrays
2 - Bit's
3 - WORD's
4 - BYTE's
5 - BYTE Arrays
6 - WORD arrays
A good question might be, Why the difference?
Here's an example of the differences using these variablesCompiled for a 16F877 you get this...Code:Cbyte VAR BYTE BBYTEArray VAR BYTE(10) BwordArray VAR WORD(10) AWORD VAR WORD BWORD VAR WORD ABYTEArray VAR BYTE(10) AbitArray VAR bit(10) DWORD VAR WORD ABYTE VAR BYTE BBYTE VAR BYTE AWORDArray VAR WORD(10) CBit VAR Bit BbitArray VAR bit(10)Compiled for a 18F252 you get this...Code:_AWORDArray EQU RAM_START + 018h _BwordArray EQU RAM_START + 02Ch _ABYTEArray EQU RAM_START + 040h _BBYTEArray EQU RAM_START + 04Ah _AWORD EQU RAM_START + 054h _BWORD EQU RAM_START + 056h _DWORD EQU RAM_START + 058h PBA01 EQU RAM_START + 05Ah PBA02 EQU RAM_START + 05Ch _ABYTE EQU RAM_START + 05Eh _BBYTE EQU RAM_START + 05Fh _Cbyte EQU RAM_START + 080h PB01 EQU RAM_START + 081h #define _AbitArray PBA01, 000h #define _BbitArray PBA02, 000hInterestingly, if you use any BANK modifiers, all that goes out the window.Code:PBA01 EQU RAM_START + 01Ah PBA02 EQU RAM_START + 01Ch PB01 EQU RAM_START + 01Eh _AWORD EQU RAM_START + 01Fh _BWORD EQU RAM_START + 021h _DWORD EQU RAM_START + 023h _ABYTE EQU RAM_START + 025h _BBYTE EQU RAM_START + 026h _Cbyte EQU RAM_START + 027h _ABYTEArray EQU RAM_START + 028h _BBYTEArray EQU RAM_START + 032h _AWORDArray EQU RAM_START + 03Ch _BwordArray EQU RAM_START + 050h #define _AbitArray PBA01, 000h #define _BbitArray PBA02, 000h
In fact, once you use a BANK modifier, all variables declared after it will be placed in that BANK and the following banks untill RAM is full, then it goes back to BANK0 and tries to fit things in the remaining space. So even if you only have 1 variable with a BANK2 modifier, you could be placing Lot's of variables in BANK2 and BANK3.
I didn't know that till now. Thanks for the question Mark!
<br>




Bookmarks