Q- I use AD812 and wonder must I set the port 2 and 3 to input/output n SFR or
does it do that automaticly?
ASome information of the status of ports 0, 1, 2 and 3 on power up. Where the
ADuC812 deviates from the "standard" 8051, I will explain the standard
situation and the ADuC812 situation.
In the standard 8051 microcontroller, port 0 is either a bidirectional I/O port
or a multiplexed data/address port for accessing external memory. This is also
the case for the ADuC812. As shown on the datasheet (p 18), the P0 SFR (addr
80h) powers up as all "1"s (FFh), i.e. configured as a digital input. In the
standard 8051 implementation, when port 1 is configured as an input it is an
open drain circuit with the pull-down FET turned off and with no pull-up FET.
This is also the case for the ADuC812 and so port 1 will power up as a high
impedance input with no internal pull up.
Port 1 on the ADuC812 differs from the standard 8051 implementation.
In the standard AD8051 implementation, port 1 can be configured as either a
digital input of a digital output (writing a 1 to the port pin latch configures
the pin as an input, writing a 0 to the port pin latch configures the part as
In the ADuC812, writing a 1 to the SFR configures port1 as an analog
input.Writing a 0 to the SFR configures the port as a digital input. The
default power up condition for the Port 1 register is all "1"s (note the
datasheet on page 18 is contradictory as it gives the default Port 1 SFR
contents as all "0"s (incorrectly) but the hex value is correctly given as FFh.)
Therefore the ADuC812 port 1 powers up with port 1 as 8 analog inputs. The
input mulitplexer connects P1.0 (pin 1) to the input of the ADC, which will
look approximately like a 10k resistance to ground. The remaining pins of port
1 are high impedance inputs.
Port 2 and Port 3
Ports 2 and 3 on the ADuC812 are similar to the standard 8051 implementation.
They can be configured as inputs or outputs but also have secondary functions
associated with them. On power up, ports 2 and 3 are configured as inputs by
default and have an internal pull up resistor, which is capable of sourcing up
to 80uA of current e.g. if the input is connected to ground.