C8051F930-DK
Rev. 0.5
11
6. Example Source Code
Example source code and register definition files are provided in the “
SiLabs\MCU\Examples\C8051F93x_92x\
”
default directory during IDE installation. These files may be used as a template for code development. Example
applications include a blinking LED example which configures the green LED on the target board to blink at a fixed
rate.
6.1. Register Definition Files
Register definition files
C8051F930.inc and C8051F930_defs.h
define all SFR registers and bit-addressable
control/status bits. A macro definition header file
compiler_defs.h
is also included, and is required to be able to use
the
C8051F930_defs.h
header file with various tool chains. These files are installed into the
“
SiLabs\MCU\Examples\C8051F93x_92x\Header_Files\
” directory during IDE installation by default. The register
and bit names are identical to those used in the C8051F93x-C8051F92x data sheet. These register definition files
are also installed in the default search path used by the Keil Software 8051 tools. Therefore, when using the Keil
8051 tools included with the development kit (A51, C51), it is not necessary to copy a register definition file to each
project’s file directory.
6.2. Blinking LED Example
The example source files
F93x_Blinky.asm
and
F93x_Blinky.c
installed in the default directory
“
SiLabs\MCU\Examples\C8051F93x_92x\Blinky
” show examples of several basic C8051F930 functions. These
include disabling the watchdog timer (WDT), configuring the Port I/O crossbar, configuring a timer for an interrupt
routine, initializing the system clock, and configuring a GPIO port pin. When compiled/assembled and linked this
program flashes the green LED on the C8051F930 Target Board about five times a second using the interrupt
handler with a C8051F930 timer.
6.3. Touch Sensitive Switch Example
The example source file
F93x_CapTouchSense_Switch.c
demonstrates the configuration and usage of the touch
sensitive (contactless) switches located on P2.0 and P2.1. Refer to the source file for step-by-step instructions to
build and test this example. This is installed in the “
SiLabs\MCU\Examples\C8051F93x_92x\
CapTouchSense_Switch
” directory by default.
Downloaded from
Elcodis.com
electronic components distributor