Hardware Reference
In-Depth Information
bclr
PPSP,$F0
; choose pull-up device
movb
#$FF,PIFP
; clear the Port P key-wake-up flags
bset
PIEP,$F0
; enable Port P interrupt
cli
; enable key-wake-up interrupt globally
7.13 Summary
The on-chip peripheral modules such as parallel ports, SCI, SPI, I 2 C, and CAN are imple-
mented mainly to perform synchronization functions during I/O operations. Since these periph-
eral modules use the same power source as does the processor, an external interface chip may
still be needed when dealing with peripheral devices. The user needs to pay attention to electri-
cal compatibility when interfacing the microcontroller with other peripheral chips.
Liquid crystal displays can display a lot of information while consuming very little power
and hence are the device of choice for displaying a large amount of information. For simple em-
bedded systems, a character-based LCD is adequate. The Hitachi HD44780 is the most popular
character-based LCD controller. The LCD is often sold as a kit that consists of the LCD panel,
LCD controller, and other required electronic circuits.
Keypads and keyboards are the most important input devices for computer systems. The
input process for keypads and keyboards consists of three steps: key scanning, key debouncing,
and ASCII code lookup. The purpose of key debouncing is to make sure that one keystroke is
only recognized as one character. In addition, the debouncing technique can also be used to gen-
erate a single pulse with one key press.
A digital-to-analog converter converts a digital value into an electric quantity in the form of
current or voltage. Voltage output is more popular for the DAC. The DAC has many applications.
Examples include digital gain and offset adjustment, programmable voltage and current sources,
programmable attenuators, digital audio, and digital video. When choosing a DAC, the user needs
to consider the resolution, dynamic range, monotonicity, number of channels, and type of output.
A stepper motor is a digital motor in the sense that each step of the rotation rotates a fixed
number of degrees. It is most suitable for applications that require a high degree of positional
control, such as plotters, disk drives, magnetic tape drives, robot joints, and so on. The resolu-
tion of one step of a stepper motor can be as small as 0.72 and as large as 90 degrees. The sim-
plest stepper motor has two pairs of coils.
Driving a stepper motor involves applying a series of voltages to the coils of the motor.
A subset of coils is energized at the same time to cause the motor to rotate one step. The pattern
of coils energized must be followed exactly for the motor to work correctly. The pattern will vary
depending on the mode used on the motor. A microcontroller can easily time the duration during
which the coil is energized and hence control the speed of the stepper motor in a precise manner.
Saving power is a major concern in most battery-powered embedded products. When the
user is not using an embedded system, the microcontroller should be switched to a low-power
mode. The HCS12 has two low-power modes: wait mode and stop mode. The HCS12 consumes
the least power in the stop mode. The stop (wait) mode can be entered by executing the stop
(wai) instruction. To facilitate the exit of the stop or wait mode, the HCS12 provides the key-
wake-up feature. Whenever the HCS12 is in one of the low-power modes and a selected signal
edge arrives at one of the key-wake-up port pins, an interrupt request will be generated and the
HCS12 will be waked up. The service for the key-wake-up interrupt is simply to clear the inter-
rupt flag and resume the execution of the instruction following the wai or stop instruction.
 
Search WWH ::




Custom Search