BS2824 Holtek Semiconductor Inc., BS2824 Datasheet - Page 48

no-image

BS2824

Manufacturer Part Number
BS2824
Description
Touch Key Mcu
Manufacturer
Holtek Semiconductor Inc.
Datasheet
BS2824/BS2854/BS2868
Touch Key MCU
Rev. 1.00
I/O Port Control Registers
Pin-shared Functions
Each Port has its own control register, known as PAC, PBC, PCC, PDC, PFC which controls the
input/output configuration. With this control register, each I/O pin with or without pull-high
resistors can be reconfigured dynamically under software control. For the I/O pin to function as an
input, the corresponding bit of the control register must be written as a 1 . This will then allow the
logic state of the input pin to be directly read by instructions. When the corresponding bit of the
control register is written as a 0 , the I/O pin will be setup as a CMOS output. If the pin is currently
setup as an output, instructions can still be used to read the output register. However, it should be
noted that the program will in fact only read the status of the output data latch and not the actual logic
status of the output pin.
The flexibility of the microcontroller range is greatly enhanced by the use of pins that have more
than one function. Limited numbers of pins can force serious design constraints on designers but by
supplying pins with multi-functions, many of these difficulties can be overcome. For some pins, the
chosen function of the multi-function I/O pins is set by configuration options while for others the
function is set by application program control.
The external interrupt pin, INT, is pin-shared with an I/O pin. To use the pin as an external
interrupt input the correct bits in the INTC0 register must be programmed. The pin must also be
setup as an input by setting the PAC3 bit in the Port Control Register. A pull-high resistor can also
be selected via the appropriate port pull-high resistor register. Note that even if the pin is setup as
an external interrupt input the I/O function still remains.
The Timer/Event Counter pins, TC0, TC1 and TC2 are pin-shared with I/O pins. For these shared
pins to be used as Timer/Event Counter inputs, the Timer/Event Counter must be configured to be
in the Event Counter or Pulse Width Capture Mode. This is achieved by setting the appropriate
bits in the Timer/Event Counter Control Register. The pins must also be setup as inputs by setting
the appropriate bit in the Port Control Register. Pull-high resistor options can also be selected
using the port pull-high resistor registers. Note that even if the pin is setup as an external timer
input the I/O function still remains.
The PFD function output is pin-shared with an I/O pin. The output function of this pin is chosen
using the CTRL0 register. Note that the corresponding bit of the port control register, must setup
the pin as an output to enable the PFD output. If the port control register has setup the pin as an input,
then the pin will function as a normal logic input with the usual pull-high selection, even if the PFD
function has been selected.
The PWM function whose outputs are pin-shared with I/O pins. The PWM output functions are
chosen using the CTRL0 register. Note that the corresponding bit of the port control registers, for
the output pin, must setup the pin as an output to enable the PWM output. If the pins are setup as
inputs, then the pin will function as a normal logic input with the usual pull-high selections, even if
the PWM registers have enabled the PWM function.
Pins PB0~PB3 on Port B can be used as LCD COM driver pins. This function is controlled using
the SCOMC register which will generate the necessary 1/2 bias signals on these four pins.
External Interrupt Input
External Timer/Event Counter Input
PFD Output
PWM Outputs
SCOM Driver Pins
48
January 27, 2010

Related parts for BS2824