
Rev. 1.40
62
March 29, 2019
Rev. 1.40
63
March 29, 2019
HT45F23A/HT45F24A
TinyPower
TM
Flash MCU with OPA & Comparators
HT45F23A/HT45F24A
TinyPower
TM
Flash MCU with OPA & Comparators
Port B NMOS Open Drain Control Register
Port B pins PB0~PB3 can be setup as open drain structures. This is implemented using the
ODE0~ODE3 bits in the MISC register.
• MISC Register
Bit
7
6
5
4
3
2
1
0
Name
ODE3
ODE2
ODE1
ODE0
—
—
PFDSEL
PFDEN
R/W
R/W
R/W
R/W
R/W
—
—
R/W
R/W
POR
0
0
0
0
—
—
0
0
Bit 7
ODE3
: PB3 Open Drain Control
0: disable
1: enable
Bit 6
ODE2
: PB2 Open Drain Control
0: disable
1: enable
Bit 5
ODE1
: PB1 Open Drain Control
0: disable
1: enable
Bit 4
ODE0
: PB0 Open Drain Control
0: disable
1: enable
Bit 3~2
Unimplemented, read as “0”
Bit 1~0
PFDSEL, PFDEN
: PFD related control - described elsewhere
I/O Pin Structures
The accompanying diagram illustrates the internal structures of some generic I/O pin types. As
the exact logical construction of the I/O pin will differ from these drawings, they are supplied as a
guide only to assist with the functional understanding of the I/O pins. The wide range of pin-shared
structures does not permit all types to be shown.
Programming Considerations
Within the user program, one of the first things to consider is port initialisation. After a reset, all of
the I/O data and port control registers will be set high. This means that all I/O pins will default to
an input state, the level of which depends on the other connected circuitry and whether pull-high
selections have been chosen. If the port control registers, PAC~PDC, are then programmed to setup
some pins as outputs, these output pins will have an initial high output value unless the associated
port data registers, PA~PD, are first programmed. Selecting which pins are inputs and which are
outputs can be achieved byte-wide by loading the correct values into the appropriate port control
register or by programming individual bits in the port control register using the “SET[m].i” and
“CLR[m].i” instructions. Note that when using these bit control instructions, a read-modify-write
operation takes place. The microcontroller must first read in the data on the entire port, modify it to
the required new bit values and then rewrite this data back to the output ports. Note that when the
device is powered on the PC1/AN5/OSC1 and PC0/AN4/OSC2 pins will experience a high level
output between 1 and 2 volts for a period of tRSTD. It is important to take this into account for any
connected external hardware devices.