ARM Technical Support Knowledge Articles

ACCESSING BITS ON P5 OF PHILIPS 552

Applies to: C51 C Compiler

Answer


Information in this article applies to:


SYMPTOMS

I'm using a Philips 552 and accessing port 5. However, I'm not sure that P5 is bit addressable. Is it? If not, how can I access individual bits of this port?

CAUSE

P5 of the 552 is not bit-addressable. Only those SFRs whose address ends in 0 or 8 are bit-addressable. For example, SFRs at addresses 0x90 and 0xC8 are bit addressable while an SFR at address 0x94 is not.

RESOLUTION

Use the bitwise AND and OR operators of the C language to set and clear individual bits in P5. For example:

P5 |= 1 << 6;   // Set Bit 6 in P5
P5 &= ~(1 << 5);   // Clear Bit 5 in P5

Article last edited on: 2004-06-15 16:18:49

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