| |||||
Technical Support Support Resources
Product Information | C251: OPTIMUM ACCESS TO ASIC SFR PAGEInformation in this article applies to:
QUESTIONI am using an ASIC that is mapped into the address space 0x7Fxxxx on a 251 device. The following code works fine, but it runs too slow. Is there a way to improve performance? Would using the DR56 and the MOVX instruction help?
char volatile far ASIC_SFR _at_ 0x7F0020;
void test (void) {
ASIC_SFR_register=0x55;
}
This code translates to: 000000 7455 MOV A,#055H ; A=R11 000002 7E340000 R MOV WR6,#WORD0 ASIC_SFR_register 000006 7E240000 R MOV WR4,#WORD2 ASIC_SFR_register 00000A 7A1BB0 MOV @DR4,R11 ; A=R11 ANSWERYes. To use XDATA addressing, change your program code to:
#define ASIC_SFR *((unsigned char volatile xdata *) 0x20)
void main (void) {
ASIC_SFR = 0x55;
}
This code translates to: 000000 7455 MOV A,#055H ; A=R11 000002 900020 MOV DPTR,#020H 000005 F0 MOVX @DPTR,A ; A=R11 Then, change the address location of the memory class XDATA using the L251 CLASSES directive as follows: L251 obj_files CLASSES (XDATA (0x7F0000-0x7FFFFF)) This initializes the DPX register with 0x7F in the START251.A51 file which results in very efficient access using the MOVX instruction. MORE INFORMATION
Last Reviewed: Thursday, January 11, 2007 | ||||
| |||||