ADVANCED TECHNIQUES FOR DESIGN ENGINEERS
■ BY PETER BEST
WORKING WITH PERIPHERALS
PREVIOUS DESIGN CYCLE COLUMNS have focused on providing you with an
in-depth technical view into the Silicon Laboratories C8051F120 microcontroller.
All good things must come to an end and this month’s installment of Design
Cycle will wrap up our look at the C8051F120 microcontroller.
If you’ve had the time and interest to take in our previous
C8051F120 discussions, you have already been introduced to many of the C8051F120’s on-chip peripherals. This
month’s collection of technical speak, C8051F120 C source
code, pictures, and graphics will cover the remainder of the
C8051F120 peripherals that we have not yet examined.
Up to this point, everything hardware has been based on
the electronics you see in Photo 1. The collection of active
and passive electronic components surrounding the
C8051F120 microcontroller in Photo 1 makes up a Silicon
Laboratories C8051F120 Development Board, which is part
of a Silicon Laboratories Development Kit. With the
assistance of the Silicon Laboratories USB Debug Adapter
you see in Photo 2, I can use the C8051F120 Development
Board to exercise all of the C8051F120’s on-chip peripherals.
All of the C8051F120’s analog-to-digital converter inputs,
comparator inputs, comparator outputs, digital-to-analog
converter outputs, general-purpose I/O port pins, voltage
reference inputs, voltage reference outputs, capture inputs,
PWM outputs, general-purpose timer outputs, counter outputs, and serial ports are available to us on the C8051F120
■ PHOTO 1. Everything you need Development Board by
to get an understanding of how way of pins, screw termi-
the C8051F120 and its on-chip nals, a D-shell connector,
peripherals work can be found and a 96-pin expansion
on this board.
I/O connector. This high accessibility of C8051F120 signals
allows me to use a Cleverscope to show you waveforms,
logic levels, and voltages that are generated in response to
stimuli introduced by the C programming language.
USB is the big thing in personal computers these days.
However, as long as microcontroller hardware continues to
include on-chip UARTs, RS-232 will live. So, let’s begin this
month’s discussion by putting some frills into the UART
code we discussed previously.
We initialized and activated the C8051F120’s UART0
in the previous Design Cycle column. However, we didn’t
care to listen for other intelligent electronic devices as we
were using UART0 to do all of the talking. So, this time
around, we’ll add some ears to our UART0 code.
If you’re just tuning in, we used the Configuration Wizard
2 application to lay the groundwork for much of the UART0
code we generated in previous Design Cycle discussions. We
will continue to use the Configuration Wizard 2 application
as we go about enabling and activating the remainder of the
C8051F120 peripherals we are yet to encounter. However,
there are some things the Configuration Wizard 2 cannot do
for us. For example, the Configuration Wizard 2 is not
designed to allocate UART0
transmit and receive buffers in
the C8051F120’s SRAM area.
Generating interrupt handler
routines is another task that the
Configuration Wizard 2 is not
suited for. That leaves us to use
our noggins to augment the basic
UART0 code that was provided
so graciously to us by the
■ PHOTO 2. Couple this little
bugger with the Keil µVision3
8051 C Development Suite and
take a journey into the C8051F120’s