Port direction of 4051

Hi,

In the following code sequence:

mov P1,#00 ;set port direction out mov P1,#0Ah ;output #00001010h to port 1

How does the uC know whether it should output the byte #0A to port 1 OR it should be setting P1.1 & P1.3 to input? I could understand how the 6821 PIA works since it has a Port Direction Register.

Allen

------ The next war will determine NOT who is right BUT what is left.

Reply to
Allen Bong
Loading thread data ...

PIA

The I/O ports in the 8051 architecture behave pretty much like open-drain ports: output '1' and input states are the same inside the port. The difference to pure open-drain is thet the ports output short pull-up current pulses when writing an one to charge the load capacitances more quickly than plain open-drain.

The port structure also demands that the output load does not sink current from the port, but an input must be able to sink some current.

You do not need to output the zeroes before writing the output pattern.

HTH

Tauno Voipio tauno voipio @ iki fi

Reply to
Tauno Voipio

My rotten architecture vote to the mini-paged architecture of PICs and 8048 (like the old PDP-8).

Tauno Voipio tauno voipio @ iki fi

Reply to
Tauno Voipio

it

Thanks, gentlemen. Now I have a clearer picture on how to interface to this "crude & rotten" architecture.

Allen.

Reply to
Allen Bong

Yeah. As someone so aptly put it, the 8051 family is very much like cockroaches: hardly anybody _wants_ to have them around, they're blatantly ugly; but they're numerous, they're everywhere, and odds are they'll survive all of us.

--
Hans-Bernhard Broeker (broeker@physik.rwth-aachen.de)
Even if all the snow were burnt, ashes would remain.
Reply to
Hans-Bernhard Broeker

I use it sometimes too, despite the fact that it's crap and guzzles current, for precisely the reasons you mention.

Current teacher's pet is MSP430 series, with gcc. At 2.5V, with a 32kHz crystal, it doesn't consume power, it produces it. I wish they'd do a 5V tolerant IO version with an external bus though.

The XAG49 is nice to use, though support is expensive now Raisonance seem to have given up the cheap deal they used to do. It's like an 8051 with better IO and 16 bit core. Why didn't they make it pin compatible with 8051s though?

Paul Burke

Reply to
Paul Burke

ElectronDepot website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.