We are running a survey to help us improve the experience for all of our members. If you see the survey appear, please take the time to tell us about your experience if you can.
Hi, I have the following two doubts: 1) When should I use Dallas contiguous mode:512k vs Dallas contiguous mode: 16M ? 512k is enough for me but I do not know if I get some advantages with 16M mode!? 2) How to locate all functions in a file to a specific location: example 102H? filename: ulm.c Thanks joao
I have a program with just 4355 bytes of code on both modes! It uses Cx51 and Lx51. Then there may be no need at all for using any contiguous mode. Not yet. Contiguous mode only pays off if you have more than 64 KB of code and/or 64KB of data to manage.
Some comments: 1) My program is a LOADER so I need to access 512k of far data. I am now trying the compact mode. If I use FVAR macros does the compiler generates correct code for far data access on other mode than contiguous?! if so I have one huge doubt:) How the compiler knows I am using 24-bit paged addressing mode and not 24-bit contiguous addressing mode!? The assembler to generate is different. I have to investigate this. By the way I have noted that I can not use _lrol_ macro on contiguous mode!? 2) It is true that in 16M mode the LCALL,LJMP and MOV DPTR are 4 bytes long. I believe that because I have "linker code packing" turned on the size is the same in my case for both contiguous modes! But speed and size are not linear on both modes. I feel we can have 16M code faster and tiny than 512K! On 512K "I think" the compiler uses paged mode so page switch must happen even on interrupts! Joao
But speed and size are not linear on both modes. I feel we can have 16M code faster and tiny than 512K! On 512K "I think" the compiler uses paged mode so page switch must happen even on interrupts! You think wrongly, then. 512K and 16M mode really only differ in the maximum allowed distance between any two addresses in code memory. Neither is more similar to paged mode than the other: they will both have to save DPX on entry to interrupt handlers, since that's an integral part of the DPTR now, not because it might be a code banking page register. In principle, you could indeed stay with COMPACT model code and use FVAR macros to access your 512K of RAM, but you'ld have to use paged XRAM address mode to implement far data memory accesses, i.e. you'ld have to fiddle with the runtime setup files (START390.A51 and XBANKING.A51). But if you want it simple and have the tools (i.e. the full PK51 kit), just stick with contiguous mode. Paged addressing is more trouble than it's worth, IMHO.
First thanks for your comments. I now understand that I need to study carefully:) I have tested with the following code:
char far a _at_ 0x12000L; char xdata b; char farfunc(void) { return a+b; } void main(void) { farfunc(); while(1); }
; FUNCTION farfunc (BEGIN) ; SOURCE LINE # 6 ; SOURCE LINE # 7 ; SOURCE LINE # 9 0000 90000000 R MOV DPTR,#b 0004 E0 MOVX A,@DPTR 0005 FF MOV R7,A 0006 90000000 R MOV DPTR,#a 000A E0 MOVX A,@DPTR 000B FE MOV R6,A 000C EF MOV A,R7 000D 2E ADD A,R6 000E FF MOV R7,A ; SOURCE LINE # 10 000F ?C0001: 000F 22 RET ; FUNCTION farfunc (END) ; FUNCTION main (BEGIN) ; SOURCE LINE # 13 ; SOURCE LINE # 14 ; SOURCE LINE # 15 0000 110000 R ACALL farfunc 0003 ?C0002: ; SOURCE LINE # 16 0003 80FE SJMP ?C0002 ; FUNCTION main (END)
; FUNCTION farfunc (BEGIN) ; SOURCE LINE # 6 ; SOURCE LINE # 7 ; SOURCE LINE # 9 0000 90000000 R MOV DPTR,#b 0004 E0 MOVX A,@DPTR 0005 FF MOV R7,A 0006 90000000 R MOV DPTR,#a 000A E0 MOVX A,@DPTR 000B FE MOV R6,A 000C EF MOV A,R7 000D 2E ADD A,R6 000E FF MOV R7,A ; SOURCE LINE # 10 000F ?C0001: 000F 22 RET ; FUNCTION farfunc (END) ; FUNCTION main (BEGIN) ; SOURCE LINE # 13 ; SOURCE LINE # 14 ; SOURCE LINE # 15 0000 12000000 R LCALL farfunc 0004 ?C0002: ; SOURCE LINE # 16 0004 80FE SJMP ?C0002 ; FUNCTION main (END)