8051 Controller

Hello

I am new to the 8051 compatible controller. I am used to PIC as well as Renesas and using C. The 8051 does not have a "Port Direction" to set. I have some questions regarding this:

- How to set it as input? I read something of writing 1 to the latch. However, this is as using it as output and set it. I don't get its function.

- How to set it as output correctly?

- There is a difference between reading the "pin" and reading "latch". Can I somehow select which one I want to read?

Thanks for your help Franz

Reply to
<
Loading thread data ...

The 8051 port pins have weak pull-ups, which means if you set them to '1', you can use them as inputs. There is nothing else you can or must do to use a pin as an input. You can't read back the latch AFAIK.

If you want to use it as a an output, you don't need to do anything either, unless you need more drive on the high side, in which case you add a pull-up resistor or a buffer.

This is why doing open collector type routines like I2C, one-wire bus etc is so easy on the 8031.

Reply to
vkesler

Thanks a lot. Franz

Reply to
<

There's a good web site....

formatting link
, that has a good forum, and tutorial web page.

The wording for the "classic" 80c51 ports is called Quasi-Bidirectional.

Check out these

a.. '51 "Bible" Family Architecture (PDF): Chapter 1: '51 family of microcontrollers, architectural overview a.. '51 "Bible" Hardware Description (PDF): Chapter 3: '51 Hardware description- stuff that is not in data sheets any more a.. '51 "Bible" Programmers Guide (PDF): Chapter 2: '51 programmers guide and instruction set

formatting link

Regards Joseph

Reply to
Joe G (Home)

This also depends somewhat on the variant. The orginal 80C51 used a quasi-bidirectional port : Strong N FET with dymamic P fet and lighter holding P FET. This makes Wire OR and two way links like i2c ans 2 wire, very easy. The data sheets explain which opcodes read the pins, and which read the latch; there is no port set-up as such.

Newer variants have 4 mode port pins : (and these do need a port set-up) Std C51 CMOS Drive Open Drain Input

Examples are Silabs devices, Philips LPC9xx, Atmel AT89LPxx, Winbond W79E8xx series, (etc)

These allow almost any design to be implemented, on a per-pin granularity.

Open drain without pullups, is good for very low power keypad idle appliations, Input only allows higher impedence drive sources ( mains zero crossing ) CMOS drive is good for LED or large FET drive.

-jg

Reply to
Jim Granville

Ah!

Heres a good start

formatting link

Reply to
Joe G (Home)

Thanks to all of you guys. You're a great help. The 8052.com indeed is a good place to start and Kai's description clarified all.

Thanks a lot! Franz

"Joe G (Home)" schrieb im Newsbeitrag news:44d20609$0$1211$ snipped-for-privacy@news.optusnet.com.au...

Reply to
<

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.