TOOLSTICK-EK

ToolStick-EK
4 Rev. 0.2
Changing the values of registers does not require recompiling the code or redownloading the firmware. At any
time, the device can be halted and the values of the registers can be changed. The firmware will continue execu-
tion using the new values. This capability greatly speeds up the debugging process.
The debug windows for the other sets of registers are found in the View Debug Windows SFR’s menu.
5.4. Enabling and Using Watch Windows
The Debug Windows in the View menu are used to view and modify hardware registers. To view and modify vari-
ables in code, the IDE provides watch windows. Just as with register debug windows, variables in the watch win-
dows are updated each time the device is halted. This section of the User’s Guide explains how to add a variable
to the watch window and modify the variable. The variable T2_Overflow_Count is a counter that stores the number
of times the LEDs blink.
1. If the device is running, stop execution using the “Stop” button or use the Debug
Stop menu option.
2. In the File View on the left-hand side of the IDE, double-click on BLINK_LED.c to open the source file. The
source file might already be open.
3. Scroll to the bottom of the source file and right-click on the variable “T2_Overflow_Count”. In the context
menu that appears, select “Add T2_Overflow_Count to Watch” and then choose “Default.” On the right-
hand portion of the IDE, the watch window appears and the T2_Overflow_Count variable is added. The
current value of the variable is shown to the right of the name.
4. Start and stop the device a few times. See that the value of the T2_Overflow_Count is incremented each
time the LEDs blink.
5. When the device is halted, click on the value field in the watch window and change the value to 0. Then
click the Refresh button or select Debug Refresh to write the new value to the device.
6. Start and stop the device a few times to watch the variable increment starting from 0.
Changing the values of variables does not require recompiling the code or redownloading the firmware. At any
time, the device can be halted and the values of the variables can be changed. The firmware will continue execu-
tion using the new values.
5.5. Setting and Running to Breakpoints
The Silicon Laboratories microcontroller devices support up to four hardware breakpoints. A breakpoint is associ-
ated with a specific line of code. When the processor reaches a hardware breakpoint, the code execution stops,
and the IDE refreshes all debug and watch windows. The on-chip debug hardware allows for breakpoints to be
placed on any line of executable code, including code in Interrupt Service Routines. This section provides steps to
set a breakpoint on the line of source code that increments the T2_Overflow_Count variable.
1. If the device is running, stop execution using the “Stop” button or use the Debug
Stop menu option.
2. Scroll to the bottom of the source file and right-click on the variable “T2_Overflow_Count”. In the context
menu that appears, select “Insert/Remove Breakpoint.” On the left side of the line in the editor window, a
red circle is added to indicate a breakpoint is placed on the source line.
3. Click the “Go” button or select the Debug Go menu option.
4. After a short time, the IDE will show that the device is halted. A blue line will be placed in the editor window
to indicate where the code execution has stopped.
5. Start the processor a few more times. Notice that the LEDs blink once for every time the processor is
started and the T2_Overflow_Counter also increments by one.
ToolStick-EK
Rev. 0.2 5
5.6. Single-Stepping Through Firmware
The IDE supports the ability to single-step through firmware one assembly instruction at a time. The IDE reads the
Flash from device, converts the instructions to assembly and displays them in a disassembly window. The following
steps show how to open the disassembly window and single step through firmware.
1. If a breakpoint is not already set on the line of code that increments the T2_Overflow_Count variable, set
the breakpoint using the steps described in Section 5.5.
2. Start the processor using the “Go” button and wait until it stops on the breakpoint.
3. Select View Debug Windows Disassembly. The disassembly window will appear on the right-hand
side of the IDE if it is not already open.
4. To execute one assembly instruction at a time, click the “Step” button on the toolbar or select the Debug
Step menu option. The highlighted line in the disassembly window indicates the next instruction to be exe-
cuted. The blue line marker in the editor window will stay on the same .C source line until all of the assem-
bly instructions are completed.
The disassembly window has three columns. The left column is the address of the instruction in Flash. The middle
column is the instruction in hex. The right column is the disassembled instruction. The Disassembly debug window
and the capability to single-step through firmware allows a developer to see exactly what instructions are executed
and their output.
6. PWM Demo
In addition to the demo Blink_LED example software, the ToolStick CD also includes a demo project named
PWM_LED. This demo firmware uses the hardware Programmable Counter Array modules on the C8051F300 in
8-bit PWM mode to drive the LEDs on the ToolStick.
The project and source files for the demo can be found in the C:\SiLabs\MCU\Demos\ToolStick\PWM\ folder.
7. Configuration Wizard 2
Configuration Wizard 2 helps accelerate development by automatically generating initialization source code to con-
figure and enable the on-chip resources needed by most design projects. Configuration Wizard 2 is installed as part
of the demo installation.
This chapter of the User’s Guide describes the basic features and capabilities of Configuration Wizard 2.
7.1. Configuration Wizard 2 Options
When Configuration Wizard 2 is opened, the program lists the device families that it supports. Based on the target
device, first select the device family and then the specific part number.
The default source file that appears initially includes the header file for the device. As the initialization code is gen-
erated for each hardware peripheral, it is added to source file.
Configuration Wizard 2 can output the initialization code in either C or assembly. The selection between C and
assembly is done using the Options Code Format menu option.
ToolStick-EK
6 Rev. 0.2
7.2. Generating Initialization Code
As an example, the following steps show how to generate initialization code for the Programmable Counter Array
module on a C8051F300. The code generated is similar to the PWM PCA initialization example code described in
Section 6.
1. Open Configuration Wizard from the Start
Programs
Silicon Laboratories menu.
2. Select C8051F30x as the Device Family and C8051F300 as the Part Number.
3. Select the Peripherals PCA menu option. The top part of the new window has the peripheral options.
The lower part shows the initialization code.
4. In the PCA0 tab, select “Enable PCA0.” Notice the code that is inserted in the bottom half of the window.
5. In the Module 0 tab, select “8-bit Pulse Width Modulator”
6. In the Module 1 tab, select “8-bit Pulse Width Modulator”
7. In the Module 2/WDT tab, uncheck “Enable Watchdog Timer”
8. Click “OK.” The initialization code is inserted in a new function PCA_Init(). This function can be directly
inserted in to a final project.
Configuration Wizard 2 can be used the configure the oscillators, port pins and other peripherals in a similar man-
ner.
The Peripherals menu of Configuration Wizard is customized based on the device family and part number. The
options in the menu show which peripherals are supported.
More information regarding any peripheral can be found
in the device family’s respective data sheet.
8. Information Locations
Example source code is installed in the “C:\SiLabs\MCU\Demos\ToolStick” directory during IDE installation.
Documentation for the ToolStick kit, including this User’s Guide, can be found in the C:\SiLabs\MCU\Demos\Tool-
Stick\Documentation\ folder.

TOOLSTICK-EK

Mfr. #:
Manufacturer:
Silicon Labs
Description:
TOOLSTICK C8051F300 EVAL BRD
Lifecycle:
New from this manufacturer.
Delivery:
DHL FedEx Ups TNT EMS
Payment:
T/T Paypal Visa MoneyGram Western Union

Products related to this Datasheet