Generating initialization code, Information locations, Toolstick-ek – Silicon Laboratories TOOLSTICK EK User Manual

Page 6

Advertising
background image

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.

Advertising