Do you have a question? Post it now! No Registration Necessary

Translate This Thread From English to

Threaded View
I am using Atmel's 20-pin 8051. My question is how do I assign Port 1
as an output, becuause once I program the chip I have to reset it once
to get it to not have P1 floating. After the reset it works fine. I
don't assign the P1 direction one way or the other for now.

On the Motorola 68HC11 I would use the data direction register, but
with the 8051 what do I do?

Re: 8051
snipped-for-privacy@nasa.gov (Brian Farmer) wrote in

Quoted text here. Click to load it

8051s in general do not have any way of programming the port direction per
se.  I believe that you need pull down resistors externally in order to use
them as output pins, I am sure others here will be able to be more helpful.


Re: 8051
On 3 Dec 2003 21:00:11 GMT, the renowned Richard

Quoted text here. Click to load it

Many 8051s have "pseudo-bidirectional" port pins. You write ones to
the pins you want to use as inputs- the port pin circuit looks like an
input connected to an n-channel output transistor drain with a
p-channel weak pullup* to Vdd. You pull them down externally toward
Vss to get a 0. Some pins may lack the weak pullup (just the n-channel
transistor and input), so you have to drive them high and low or add
an external pullup resistor.  

* The standard 8051 port design parallels a strong pullup with the
weak pullup. The strong pullup is switched on briefly when the pin is
driven high to quickly charge external capacitance.

Ugly, indeed, but that's the way many of them work. Take special care
of what happens on outputs that control real-world stuff while reset
is asserted.

Best regards,
Spehro Pefhany
"it's the network..."                          "The Journey is the reward"
snipped-for-privacy@interlog.com             Info for manufacturers: http://www.trexon.com
We've slightly trimmed the long signature. Click to see the full one.
Re: 8051

Quoted text here. Click to load it

No. Nothing on the output for Port 1.

- Mark ->

Re: 8051
snipped-for-privacy@nasa.gov (Brian Farmer) wrote in

Quoted text here. Click to load it

Write a 1 to the port SFR before reading it as input. For ouput, just
write your value - done. The pseudo-bi-directional nature of the ports is
both nice and a real pain. See Intel's scanned PDF copy of the MCS-51
User's Manual available on their website for a nice picture of the port
structure. Note that P0 and P2 will require pullups but you don't have
them on the 2051.

- Mark ->

Re: 8051
Quoted text here. Click to load it

plus, the two comparitor pins on the 2051 are open drain, so they will
need pullups if used as outputs.

These are good, PDFs covering all the common-demoninator stuff,
like ports and timers:



Re: 8051
The Philips P89LPC922   Flash 80c51 core 20 pin Dip package micro
can program the Ports as Inputs/output (push-pull) and Quasi-bidirectional.
In push pull mode the max current is 20mA per pin (total 80mA).

The setup for the Port direction (config) is in one of the NEW (spare)
80c51 function registers.



Quoted text here. Click to load it

Re: 8051
This statement about push/pull being programabel is true for the whole
range of the Philips LPC900 family. Philips has lauched approx. 15 new
devices in that family within the last 12 months. What is missing are
high memory devices (8k flash is max) and ADC at this time. I was told
that ADC devices will be launched in Q1.

Cheers, Schwob

Quoted text here. Click to load it

Re: 8051

Quoted text here. Click to load it

 The first (prelim) data for the ADC's 933/934/935 is on Philips Web, & also
on the 14 pin devices.
 14 Pins makes more sense than 8 pins, which quickly gets pin-bound,
and 20 pins is too large physically.
 I see Microchip (&Fairchild) are also realising this, and releasing more 14
pin versions.
( one die that gives 8/14 pins,  very like the 28/40 pin variants are done )


Site Timeline