C8051F12x-DK
5.4.2. Building and Downloading the Program for Debugging
1. Once all source files have been added to the target build, build the project by clicking on the Build/Make
Project button in the toolbar or selecting Project->Build/Make Project from the menu.
Note: After the project has been built the first time, the Build/Make Project command will only build the
files that have been changed since the previous build. To rebuild all files and project dependencies, click
on the Rebuild All button in the toolbar or select Project->Rebuild All from the menu.
2. Before connecting to the target device, several connection options may need to be set. Open the
Connection Options window by selecting Options->Connection Options... in the IDE menu. First, select
the adapter that was included with the kit in the "Serial Adapter" section. Next, the correct "Debug Interface"
must be selected. C8051F12x family devices use the JTAG debug interface. Once all the selections are
made, click the OK button to close the window.
3. Click the Connect button in the toolbar or select Debug->Connect from the menu to connect to the device.
4. Download the project to the target by clicking the Download Code button in the toolbar.
Note: To enable automatic downloading if the program build is successful select Enable automatic con-
nect/download after build in the Project->Target Build Configuration dialog. If errors occur during the
build process, the IDE will not attempt the download.
5. Save the project when finished with the debug session to preserve the current target build configuration,
editor settings and the location of all open debug views. To save the project, select Project->Save Project
As... from the menu. Create a new name for the project and click on Save.
6. Example Source Code
Example source code and register definition files are provided in the "SiLabs\MCU\Examples\C8051F12x" 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 C8051F120.inc and C8051F120.h define all SFR registers and bit-addressable control/
status bits. They are installed into the "SiLabs\MCU\Examples\C8051F12x" directory during IDE installation. The
register and bit names are identical to those used in the C8051F12x data sheet. Both 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. Code Banking Files
In order to utilize code banking in a project there are two files that will need to be changed. You can either custom
edit L51_bank.a51 and startup.a51 or use the copies installed into the "IDEfiles\C51\Lib" directory during IDE
installation. Both of these files MUST be added to your project and linked with your project in order for code bank-
ing to function properly. For more information on code banking, please see Application Note AN130 - Code Bank-
ing Using the Keil 8051 Tools.
6.3. Blinking LED Example
The example source files blink.asm and blinky.c show examples of several basic C8051F12x 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. When compiled/assembled and linked this pro-
gram flashes the green LED on the C8051F120 target board about five times a second using the interrupt handler
with a C8051F120 timer.
4
Rev. 0.6
Need help?
Do you have a question about the C8051F12X and is the answer not in the manual?
Questions and answers