ARM Technical Support Knowledge Articles

OPTIMUM ACCESS TO ASIC SFR PAGE

Applies to: C251 C Compiler

Answer


Information in this article applies to:


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

Article last edited on: 2007-01-11 09:43:36

Rate this article

[Bad]
|
|
[Good]
Disagree? Move your mouse over the bar and click

Did you find this article helpful? Yes No

How can we improve this article?

Link to this article
Copyright © 2011 ARM Limited. All rights reserved. External (Open), Non-Confidential