ARM Technical Support Knowledge Articles

ERROR 146 (INVALID BASE ADDRESS)

Applies to: C51 C Compiler

Answer


Information in this article applies to:


QUESTION

When I compile my program, I receive the following error message:

Error 146: Invalid Base Address

How do I fix this?

ANSWER

This error message indicates that the byte base address specified for an SBIT is not valid. The byte address of an SBIT must be an SFR whose least significant nibble must be 0 or 8. For example:

sfr P1 = 0x90;
sbit P1_0 = P1^0;  // This is valid

sfr P4 = 0xD1;
sbit P4_0 = P4^0;  // This is NOT valid since P4 is not an a 0 or 8 boundary

For SFR addresses that are not bit-addressable, you might use standard AND and OR operations to access the indivitual SFR bits.

Example:

sfr P4 = 0xD1;

void test (void)  {
  if (P4 & 0x01)   {   // if bit 0 set
    P4 |= 0x80;        // set bit 7
  }
  else  {
    P4 &= ~0x02;       // reset bit 1
  }
}

Article last edited on: 2005-05-25 04:30:47

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