beautypg.com

Abstract and contents – Motorola ONCE SC140 User Manual

Page 3

background image

Abstract and Contents

iii

In software application development on embedded devices, optimization is critical. Optimized code
provides not only faster processing speed but also lower power consumption and longer battery life.
Optimized code also minimizes CPU load, enabling more applications to fit into a single chip. In selecting
a processor for a system, it is important to understand and compare the speed of execution of different
processors. All of these applications may require a stopwatch as a criterion for measurement. This
application note presents the stopwatch timer application developed on the Software Development
Platform (SDP). The stopwatch timer is implemented using the Enhanced OnCE

resource, which is

non-intrusive to SC140 operation, therefore, timing can be correctly measured. Two stopwatch techniques,
with and without source code modification, are presented. This application note also explains how to port
stopwatch applications to other SC140 based devices.

1

Introduction

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1

2

SC140 Enhanced OnCE Stopwatch Timer Capabilities

. . . . . . . . . . . . . . . . . . . 2

2.1

Features . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2

2.2

Resources . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2

2.3

Implementation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2

3

Setting Up the Stopwatch Timer Within an Application

. . . . . . . . . . . . . . . . . . . 3

3.1

Initializing the Stopwatch Timer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3

3.2

Starting the Stopwatch Timer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5

3.3

Stopping the Stopwatch Timer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6

3.4

Converting Cycles to Actual Time . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6

3.5

Putting it All Together . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7

3.6

Adapting Stopwatch Timer Code to Other SC140 Devices . . . . . . . . . . . . . . . . . . . . . . . . 8

4

Setting Up the Stopwatch Timer Within the Debugger

. . . . . . . . . . . . . . . . . . . . 8

4.1

Initializing the Stopwatch Timer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8

4.2

Stopping the Stopwatch Timer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11

5

Setting Up the System Clock Speed

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12

5.1

Setting Up the PLL in Software . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13

5.2

Setting Up the PLL in Hardware . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14

6

Verifying Correct Setup

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14

6.1

Using the LED on the SDP . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14

6.2

Testing the Stopwatch Timer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15

Abstract and Contents