background image

C8051F336DK

6

Rev. 0.2

6.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 appropriate adapter in the “Serial Adapter” section. Next, the correct “Debug Interface” must be selected.
C8051F336/7/8/9 family devices use the Silicon Labs 2-wire (C2) 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

.

7.  Example Source Code

Example source code and register definition files are provided in the “

SiLabs\MCU\Examples\C8051F336_9\

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.

7.1.  Register Definition Files

Register definition files 

C8051F336.inc and C8051F336_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 

C8051F336_defs.h

 header file with various tool chains. These files are installed into the

SiLabs\MCU\Examples\C8051F336_9\Header_Files\

” directory during IDE installation by default. The register and

bit names are identical to those used in the C8051F336/7/8/9 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. 

7.2.  Blinking LED Example

The example source files 

F336_Blinky.asm

 and 

F336_Blinky.c

 installed in the default directory

SiLabs\MCU\Examples\C8051F336_9\Blinky

” show examples of several basic C8051F338 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 C8051F338 target board about five times a second using the interrupt
handler with a C8051F338 timer.

7.3.  Touch Sensitive Switch Example

The example source file 

F338_TouchSense_Switch.c

 demonstrates the configuration and usage of the touch

sensitive (contactless) switch SW3. Refer to the source file for step-by-step instructions to build and test this
example. This is installed in the “

SiLabs\MCU\Examples\C8051F336_9\TouchSense_Switch

” directory by default.

Summary of Contents for C8051F336DK

Page 1: ...ms C8051F338 Target Board C8051Fxxx Development Kit Quick Start Guide Silicon Laboratories IDE and Product Information CD ROM CD content includes Silicon Laboratories Integrated Development Environment IDE Keil 8051 Development Tools macro assembler linker evaluation C compiler Source code examples and register definition files Documentation C8051F336 Development Kit User s Guide this document AC ...

Page 2: ...f previously installed CP210x Virtual COM Port drivers It will let you know when your system is up to date The driver files included in this installation have been certified by Microsoft 4 If the Launch the CP210x VCP Driver Installer option was not selected in step 3 the installer can be found in the location specified in step 2 by default C SiLabs MCU CP210x Windows_2K_XP_S2K3_Vista At this loca...

Page 3: ...fer to the Application Note AN104 Integrating Keil Tools into the Silicon Labs IDE for instructions to change the limitation to 4 kB and have the programs start at code address 0x0000 4 3 Configuration Wizard 2 The Configuration Wizard 2 is a code generation tool for all of the Silicon Laboratories devices Code is generated through the use of dialog boxes for each of the device s peripherals Figur...

Page 4: ...he USB Debug Adapter as shown in Figure 2 1 Connect the USB Debug Adapter to the DEBUG connector on the target board with the 10 pin ribbon cable 2 Connect one end of the USB cable to the USB connector on the USB Debug Adapter 3 Connect the other end of the USB cable to a USB Port on the PC 4 Connect the ac dc power adapter to power jack P1 on the target board Notes Use the Reset button in the IDE...

Page 5: ...ct with one or more source files build a program and download the program to the target in preparation for debugging The IDE will automatically create a single file project using the currently open and active source file if you select Build Make Project before a project is defined 6 1 Creating a New Project 1 Select Project New Project to open a new project and reset all configuration settings to ...

Page 6: ... are provided in the SiLabs MCU Examples C8051F336_9 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 7 1 Register Definition Files Register definition files C8051F336 inc and C8051F336_defs h define all SFR registers and bit ad...

Page 7: ...ower adapter P2 USB connector connects to PC for serial communication J1 26 pin Expansion I O connector J2 MCU power header VDD J3 Port I O configuration header J4 DEBUG connector for Debug Adapter interface J5 USB connector for UART0 interface J6 Connects pin P0 1 to node IDAC and resistor R2 J7 J8 Connects the potentiometer R14 to pin P1 6 and 3VD J9 J10 External crystal enable connectors J11 To...

Page 8: ...shows the positions of the factory default shorting blocks Figure 4 C8051F338 Target Board Shorting Blocks Factory Defaults SW3 P2 CP 2102 U3 F338 U1 P1 DEBUG J4 3VD GND P1 3 D7 USB D4 P0 7 SW2 RESET SW1 TB1 SILICON LABS www silabs com J11 J7 J8 J1 J2 J3 J6 J9 J10 J5 Prototype Area R14 PWR D6 Prototype Area I O Connection Points Pin 2 Pin 1 Pin 2 Pin 1 Pin 2 Pin 1 Pin 1 Pin 2 Pin 1 ...

Page 9: ... 5 MHz base frequency 2 which is enabled as the system clock source on reset After reset the internal oscillator operates at a frequency of 3 0625 MHz 2 by default but may be configured by software to operate at other frequencies For low frequency operation the C8051F338 features a programmable low frequency internal oscillator 80 kHz base frequency 10 Therefore in many applications an external os...

Page 10: ... shorting blocks should be present on header J11 to properly connect this switch to the MCU See Section 7 3 Touch Sensitive Switch Example on page 6 for details about example source code Three LEDs are provided on the target board to serve as indicators The red LED labeled PWR is used to indicate the presence of power to the target board The green LED labeled with port pin name P1 3 is connected t...

Page 11: ... list of pin descriptions for J1 8 6 Target Board DEBUG Interface J4 The DEBUG connector J4 provides access to the DEBUG C2 pins of the C8051F338 It is used to connect the Serial Adapter or the USB Debug Adapter to the target board for in circuit debugging and Flash programming Table 3 shows the DEBUG pin definitions Table 2 J1 Pin Descriptions Pin Description Pin Description 1 3 VD 3 3 VDC 14 P1 ...

Page 12: ...target board also features a Current to Voltage 1 KΩ load resistor that may be connected to the 10 bit current mode Digital to Analog Converter IDAC output that can be enabled on port pin P0 1 Install a shorting block on J6 to connect port pin P0 1 of the target device to the load resistor If enabled by software the IDAC signal is then routed to the J1 2 and TB1 2 connectors 8 10 C2 Pin Sharing On...

Page 13: ...Target Board Pin Assignments and Headers MCU Pin Name Pin Primary Function Alternate Fixed Function Target Board Function Relevant Headers P0 0 2 P0 0 VREF VREF J1 3 TB1 6 J5 1 P0 1 1 P0 1 IDAC IDAC J1 4 J1 2 TB1 2 J6 1 P0 2 24 P0 2 XTAL1 XTAL1 J1 5 J9 2 P0 3 23 P0 3 XTAL2 XTAL2 J1 6 J10 2 P0 4 22 P0 4 TX_MCU TX_MCU J1 7 J3 5 P0 5 21 P0 5 RX_MCU RX_MCU J1 8 J3 7 P0 6 20 P0 6 CNVSTR CNVSTR J1 9 TB1...

Page 14: ...C8051F336DK 14 Rev 0 2 9 Schematics Figure 5 C8051F338 Target Board Schematic Page 1 of 2 ...

Page 15: ...C8051F336DK Rev 0 2 15 Figure 6 C8051F338 Target Board Schematic Page 2 of 2 ...

Page 16: ...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: