ht82j30r Holtek Semiconductor Inc., ht82j30r Datasheet - Page 15

no-image

ht82j30r

Manufacturer Part Number
ht82j30r
Description
Ht82j30r/ht82j30a -- 16 Channel A/d Mcu With Spi Interface
Manufacturer
Holtek Semiconductor Inc.
Datasheet

Available stocks

Company
Part Number
Manufacturer
Quantity
Price
Part Number:
HT82J30R
Manufacturer:
HOLTEK
Quantity:
155
I/O Pin Structures
The diagrams illustrate the I/O pin internal structures. As
the exact logical construction of the I/O pin may differ
from these drawings, they are supplied as a guide only
to assist with the functional understanding of the I/O
pins.
Programming Considerations
Within the user program, one of the first things to con-
sider is port initialisation. After a reset, all of the data and
port control register 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 options have been selected. If the PAC, PBC,
PCC, PDC and PFC port control register, are then pro-
grammed to setup some pins as outputs, these output
pins will have an initial high output value unless the as-
sociated PA, PB, PC, PD and PF port data registers are
first programmed. Selecting which pins are inputs and
which are outputs can be achieved byte-wide by loading
the correct value into the port control register or by pro-
gramming individual bits in the port control register us-
ing 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 re-
write this data back to the output ports.
Rev. 1.10
Port B and Port C. If these pins are to be used as A/D
inputs and not as normal I/O pins then the corre-
sponding bits in the A/D Converter Control Register,
ADCR, must be properly set. There are no configura-
tion options associated with the A/D function. If used
as I/O pins, then full pull-high resistor configuration
options remain, however if used as A/D inputs then
any pull-high resistor options associated with these
pins will be automatically disconnected.
Read/Write Timing
8-bit Timer/Event Counter Structure
15
Port A has the additional capability of providing wake-up
functions. When the device is in the Power Down Mode,
various methods are available to wake the device up.
One of these is a high to low transition of any of the Port
A pins. Single or multiple pins on Port A can be setup to
have this function.
Timer/Event Counters
The provision of timers form an important part of any
microcontroller giving the designer a means of carrying
out time related functions. These devices contains an in-
ternal 8-bit count-up timer which has three operating
modes. The timer can be configured to operate as a
general timer, external event counter or as a pulse width
measurement device. The provision of an internal
8-stage prescaler to the timer clock circuitry gives added
range to the timer.
There are two registers related to the Timer/Event
Counter, TMR and TMRC. The TMR register is the reg-
ister that contains the actual timing value. Writing to
TMR places an initial starting value in the Timer/Event
Counter preload register while reading TMR retrieves
the contents of the Timer/Event Counter. The TMRC
register is a Timer/Event Counter control register, which
defines the timer options, and determines how the timer
is to be used. The timer clock source can be configured
to come from the internal system clock source or from
an external clock on shared pin PA4/TMR.
Configuring the Timer/Event Counter Input Clock
Source
The internal timers clock source can originate from ei-
ther the system clock or from an external clock source.
The system clock input timer source is used when the
timer is in the timer mode or in the pulse width measure-
ment mode. The internal timer clock also passes
through a prescaler, the value of which is conditioned by
the bits PSC0, PSC1 and PSC2 in the TMRC register.
An external clock source is used when the timer is in the
event counting mode, the clock source being provided
on shared pin PA4/TMR. Depending upon the condition
of the TE bit, each high to low, or low to high transition on
the PA4/TMR pin will increment the counter by one.
HT82J30R/HT82J30A
March 13, 2008

Related parts for ht82j30r