background image

C8051F12x-DK

4

Rev. 0.6

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. 

Summary of Contents for C8051F12X

Page 1: ...able 2 Hardware Setup using an EC2 Serial Adapter Connect the target board to a PC running the Silicon Laboratories IDE via the Serial Adapter as shown in Figure 1 1 Connect one end of the RS232 serial cable to a serial COM port on the PC 2 Connect the other end of the RS232 serial cable to the DB 9 connector on the Serial Adapter 3 Connect the Serial Adapter to the JTAG connector on the target bo...

Page 2: ...ment IDE Keil software 8051 tools and additional documentation Insert the CD ROM into your PC s CD ROM drive An installer will auto matically launch allowing you to install the IDE software or read documentation by clicking buttons on the Installa tion Panel If the installer does not automatically start when you insert the CD ROM run autorun exe found in the root directory of the CD ROM Refer to t...

Page 3: ...ing the Silicon Laboratories IDE project manager you must first create a project A project consists of a set of files IDE configuration debug views and a target build configuration list of files and tool configurations used as input to the assembler compiler and linker when building an output object file The following sections illustrate the steps necessary to manually create a project with one or...

Page 4: ...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 C...

Page 5: ... 7 pin J3 Connects LED D3 to P1 6 pin J4 JTAG connector for Debug Adapter interface J5 DB 9 connector for UART0 RS232 interface J6 Connector for UART0 TX P0 0 J8 Connector for UART0 RTS P4 0 J9 Connector for UART0 RX P0 1 J10 Connector for UART0 CTS P4 1 J11 Analog loopback connector J12 J19 Port 0 7 connectors J20 Analog I O terminal block J22 VREF connector J23 VDD Monitor Disable J24 96 pin Exp...

Page 6: ...lock from the header to disconnect SW2 from the port pins The port pin signal is also routed to a pin on the J24 I O connector See Table 1 for the port pins and headers corresponding to each switch Two LEDs are also provided on the target board The red LED labeled PWR is used to indicate a power connection to the target board The green LED labeled with a port pin name is connected to the C8051F120...

Page 7: ... J10 Install shorting block to connect UART0 CTS P4 1 to the transceiver 7 5 Analog I O J11 J20 Several C8051F120 analog signals are routed to the J20 terminal block and the J11 header The J11 connector provides the ability to connect DAC0 and DAC1 outputs to several different analog inputs by installing a shorting block between a DAC output and an analog input on adjacent pins of J11 Refer to Tab...

Page 8: ... 3 VDC and digital ground Table 5 defines the pins for the port connectors The same pin out order is used for all of the port connectors 7 7 VDD Monitor Disable J23 The VDD Monitor of the C8051F120 may be disabled by moving the shorting block on J23 from pins 1 2 to pins 2 3 as shown in Figure 4 Pin Description 1 Pn 0 2 Pn 1 3 Pn 2 4 Pn 3 5 Pn 4 6 Pn 5 7 Pn 6 8 Pn 7 9 3 VD 3 3 VDC 10 GND Ground Ta...

Page 9: ...d C 1 XTAL1 A 2 MONEN B 2 P1 7 C 2 P1 6 A 3 P1 5 B 3 P1 4 C 3 P1 3 A 4 P1 2 B 4 P1 1 C 4 P1 0 A 5 P2 7 B 5 P2 6 C 5 P2 5 A 6 P2 4 B 6 P2 3 C 6 P2 2 A 7 P2 1 B 7 P2 0 C 7 P3 7 A 8 P3 6 B 8 P3 5 C 8 P3 4 A 9 P3 3 B 9 P3 2 C 9 P3 1 A 10 P3 0 B 10 P0 7 C 10 P0 6 A 11 P0 5 B 11 P0 4 C 11 P0 3 A 12 P0 2 B 12 P0 1 C 12 P0 0 A 13 P7 7 B 13 P7 6 C 13 P7 5 A 14 P7 4 B 14 P7 3 C 14 P7 2 A 15 P7 1 B 15 P7 0 C...

Page 10: ...Silicon Laboratories JTAG and C2 debug interfaces All Serial Adapters may be powered from the tar get board but the EC1 and EC2 Serial Adapter units cannot provide power to the target board Table 7 shows the pin definitions for the Serial Adapter s DEBUG connector Notes When powering the Serial Adapter via the DEBUG connector the input voltage to the DEBUG connector s power pin must be 3 0 to 3 6 ...

Page 11: ... USB connection to the PC The USB Debug Adapter is capable of providing power to a circuit board via pin 10 of the DEBUG connector The C8051F120 Tar get Board is not designed to be powered from this source Table 8 shows the pin definitions for the DEBUG ribbon cable connector Notes The USB Debug Adapter requires a target system clock of 32 KHz or greater With the default settings the USB Debug Ada...

Page 12: ...C8051F12x DK 12 Rev 0 6 10 Schematic Figure 7 C8051F120 Target Board Schematic ...

Page 13: ... Hardware Setup using a USB Debug Adapter Section 5 4 2 changed step 2 to include new instructions Section 7 J4 changed Serial Adapter to Debug Adapter Target Board DEBUG Interface Section added USB Debug Adapter DEBUG Connector Pin Descriptions Table changed pin 4 to C2D Changed jumper to header EC2 Serial Adapter section added EC2 to the section title table title and figure title EC2 Serial Adap...

Page 14: ...y for the functioning of undescribed features or parameters Silicon Laboratories reserves the right to make changes without further notice Silicon Laboratories makes no warranty rep resentation or guarantee regarding the suitability of its products for any particular purpose nor does Silicon Laboratories assume any liability arising out of the application or use of any product or circuit and speci...

Reviews: