Keil Logo

C251: OPTIMUM ACCESS TO ASIC SFR PAGE


Information in this article applies to:

  • C251 Version 3 or higher

QUESTION

I 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

ANSWER

Yes.  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

  • See the C251 User's Guide. In µVision, click on the Books Tab in the Project Workspace window.

Last Reviewed: Thursday, January 11, 2007


Did this article provide the answer you needed?
 
Yes
No
Not Sure
 
  Arm logo
Important information

This site uses cookies to store information on your computer. By continuing to use our site, you consent to our cookies.

Change Settings

Privacy Policy Update

Arm’s Privacy Policy has been updated. By continuing to use our site, you consent to Arm’s Privacy Policy. Please review our Privacy Policy to learn more about our collection, use and transfers
of your data.