ST AN3996 APPLICATION NOTE

ST AN3996 APPLICATION NOTE

AN3996

Application Note

Adjustable LED blinking speed using STM8SVLDISCOVERY

Application overview

This application note provides a short description of the demonstration firmware Discover which is preprogrammed in the Flash memory of the STM8S003K3T6 microcontroller.

This demonstration firmware makes use of the STM8S basic 8-bit timer configured as a time-base generator to change the blinking speed of LED LD1 each time the push button B1 is pressed. Once the STM8SVLDISCOVERY is powered-up through a standard USB cable connected to the host PC, LED LD1 starts blinking slowly, meaning that the programming has been completed successfully.

This demonstration software is available from http://www.st.com/stm8svldiscovery. It is provided to allow you to learn, reuse and modify the application source code.

Built around the STM8S003K3T6, the STM8SVLDISCOVERY allows evaluation of the main features of all the STM8S00xxx line MCUs.

Reference documents

STM8SVLDISCOVERY user manual (UM1482).

STM8SVLDISCOVERY getting started (UM1480)

Developing and debugging your STM8S-DISCOVERY application code user manual (UM0834).

STM8S003 datasheet

STM8S reference manual (RM0016)

October 2011

Doc ID 022386 Rev 1

1/10

www.st.com

Contents

AN3996

 

 

Contents

1

Application description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

5

 

1.1

Hardware required . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

5

 

1.2

Application schematics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

5

 

1.3

Application principle . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

5

2

Software description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

6

 

2.1

STM8S standard firmware library configuration . . . . . . . . . . . . . . . . . . . . .

6

 

2.2

Application software flowcharts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

7

2.2.1 Main loop flowchart . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7 2.2.2 Blinking_StateMachine flowchart . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8

3

Revision history . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

9

2/10

Doc ID 022386 Rev 1

AN3996

List of tables

 

 

List of tables

Table 1. LED LD1 configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5 Table 2. Document revision history . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9

Doc ID 022386 Rev 1

3/10

Loading...
+ 7 hidden pages