|
by Tom Cantrell
Start ı Flash
Rules ı Speeding Ticket ı Mix
Mode Master ı Cheap Thrills ı Sources
and PDF
MIX MODE MASTER
Thanks to the march of silicon, MCUs
now integrate all the standard digital functions (memory, I/O, timers,
etc.) required for many applications. Thatıs true for the ıC51, as
well. Itıs got all the stuff found on the original ı51 (timers, parallel
I/O, UART, etc.) and then some.
Beyond the generic ı51 basics, one notable
upgrade is a Programmable Counter Array that combines a 16-bit timer/counter
with five independent compare-and-capture channels. Itıs useful for
everything from high-speed timing (one quarter of the system clock,
up to 5 MHz) to complex waveform generation (e.g., PWM).
Which is better, I2C or SPI?
The ıC51 takes the easy way out and includes both. I was pleased to
see that these are complete hardware implementations, not just a shift
register that needs a lot of bit-banging software backup.
In a 64-pin TQFP package (48- and 32-pin
versions are available), there are 32 bits (four 8-bit ports) available
for digital I/O. Through a 3-V chip (VCC = 2.7 to 3.6 V),
the ıC51 I/Os are 5-V tolerant. In addition, Cygnal came up with a
rather novel solution to the problem of allocating pins to general-
or special-purpose I/O in the form of a programmable crossbar switch
(see Figure 3).
|
|
| Figure 3ıThe ıC51 incorporates
a crossbar switch to map special I/O functions to port pins.
If a function pin isnıt needed, itıs removed from the map, and
the ones below it move up, which neatly leaves all parallel
I/O lines grouped together. |
With so much digital integration on hand,
the next logical step is to integrate the analog functions required
for a true System-on-(just-one)-Chip solution. In that ı98 "Onward
and Upward" presentation I referred to earlier, I came up with
a list of desirable analog add-ons (see Figure 4). Go through the
ıC51 datasheet bullets, and sure enough, youıll see that Cygnal hit
the bullıs-eye on just about every one of them.
 |
| Figure 4ıThe ıC51 illustrates
the trend towards analog integration with a vengeance, incorporating
just about every feature on this list I made up back in ı98. |
The 8-channel 10- (ıF010) or 12-bit (ıF000)
A/D has good specs (100k samples per second, ı1 LSB integral non-linearity,
and ı0.25 ppm/ıC temperature coefficient), but thatıs just the start.
Besides the converter, the ıC51 integrates the bits and pieces that
comprise an entire analog front-endıprogrammable gain amp (PGA), precision
voltage reference, temperature sensor, two 12-bit voltage output DACs,
and two comparators.
Each analog input pair can be configured
as two single-ended inputs or a differential input. The PGA allows
gain to be set by software from 0.5 to 16 in powers of two. Together
with the DAC, this offers a no-muss-no-fuss solution for dealing with
signals that have a lot of DC offset. You use differential mode with
the signal on one pin, with the other connected to one of the DACs.
The DAC output is calibrated to null the offset, and the resulting
(small) differential representing the actual signal of interest can
be zoomed in with the PGA. Similarly, the temperature sensor allows
software to compensate for temperature sensitivity and drift, perhaps
taking advantage of the flash memory to store custom (re)calibration
equations or look-up tables.
If you need extra analog input channels,
the DACs, comparators, and a bit of software can do the trick. The
comparators feature programmable positive and negative hysteresis
(see Figure 5), and their output can generate an interrupt or be routed
to a pin.
 |
| Figure 5ıThe ıC51 comparators
offer programmable hysteresis, which can be independently specified
for rising and falling edge. |
The ADC offers a similar feature of automatic
window comparison. The result of each conversion is compared to programmable
high and low limits and can generate an interrupt if the result is
within or outside the specified range.
Both the comparator and window comparison
interrupts can wake a sleeping ıC51, making it ideal for those applications
(especially battery-powered) in which the controller mainly sits around
baby-sitting an analog input, only shifting into high gear when the
input crosses a certain threshold.
The ıC51ıs analog features go beyond
the signal chain to include general housekeeping such as an internal
programmable clock oscillator. It has four selections (1.9, 3.8, 7.5,
and 15 MHz) and is reasonably accurate as far as on-chip clocks go
(ı20% or so). Thanks to the built-in voltage reference, the ıC51 also
takes on the power supply monitoring function of an external supervisor
chip. Altogether thereıs a whopping seven sources for reset (see Figure
6), and the ıC51 has status bits for each so the software can figure
out who done it.
 |
| Figure 6ıIncorporating the
features of an external supervisor chip, the ıC51 handles up
to seven reset sources, including a power-supply monitor, bi-directional
reset pin, I/O pin, comparators, missing clock detector, watchdog
timer, and software.
|
PREVIOUS
NEXT
Circuit Cellar
provides up-to-date information for engineers. Visit www.circuitcellar.com
for more information and additional articles.
For subscription information, call (860) 875-2199, subscribe@circuitcellar.com
or subscribe
online. ıCircuit Cellar, the Magazine for Computer Applications.
Posted with permission.
|