XA-G49 (8051 extended architecture) I/O Port Bit-Addressing Question

Nov 30, 2004 2 Replies

Hi.



The P3 I/O port in my application has some bits used for output-only and some for input-only. The output-only bits are configured in push-pull mode and the input-only ones in quasi-bidirectional.



In quasi-bidirectional mode I have to write a '1' to the bit latch, so as to not pull the line down myself.


My question: Can I use bit set/bit clear instructions (CLR, SETB) on the output-only bits without clobbering the bit-latch for the input bit?


If SETB/CLR are implemented as RMW, and the input value is zero, that will clobber the latch, but if the SFR is truly bit-addressable at the lowest level, then a bit operation won't clobber neighboring bits.



Here's an example to clarify my question:



Suppose bit-7 is my input pin and bit 0 is my output pin.



I want to set the output latch on bit 7 to '1' so as to allow the external device to drive it. I can do this with the instruction:



setb P3.7



If the device is currently driving the pin low, I'll get a zero in bit-7 if I read P3 back.



Now say I want to drive out a '1' on my output bit, bit 0. I *could* do this with:



setb P3.0



But if this is implemented internally as a read-modify-write, it could do:



P3


Ok, actually it does (page 7-16). So I'm good to go.

Apparently not. Not a single message. I guess 8051 architecture microcontrollers aren't popular.

Well, I've used the XA-G49 on a couple of jobs, gave up because it's too thirsty, but these days I only use assembler when I have to. Life is short, and anyway I'm not really interested in device- specific characteristics, keep it C and general, and I can port it to something else if I need to. But Philips really messed up when they designed the XA series, as it's NOT pin compatible with the 8051 if you use an external bus.

Paul Burke

Join the Discussion

Have something to add? Share your thoughts — no account required.

Didn't find your answer?

Ask the community — no account required