ST STM8SVLDISCOVERY Application Note
ST STM8SVLDISCOVERY Application Note

ST STM8SVLDISCOVERY Application Note

Adjustable led blinking speed

Advertisement

Quick Links

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
Adjustable LED blinking speed
using STM8SVLDISCOVERY
Doc ID 022386 Rev 1
AN3996
Application Note
1/10
www.st.com

Advertisement

Table of Contents
loading
Need help?

Need help?

Do you have a question about the STM8SVLDISCOVERY and is the answer not in the manual?

Questions and answers

Summary of Contents for ST STM8SVLDISCOVERY

  • Page 1 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.
  • Page 2: Table Of Contents

    Contents AN3996 Contents Application description ........5 Hardware required .
  • Page 3 AN3996 List of tables List of tables Table 1. LED LD1 configuration ........... . . 5 Table 2.
  • Page 4 List of figures AN3996 List of figures Figure 1. Main application loop flowchart ..........7 Figure 2.
  • Page 5: Application Description

    AN3996 Application description Application description Hardware required The following STM8SVLDISCOVERY on-board resources are used: LED, LD1 User push button, B1 No additional hardware is required to make this application software run on the STM8SVLDISCOVERY. Application schematics Refers to UM1482 STM8SVLDISCOVERY for implementation details.
  • Page 6: Software Description

    Software description AN3996 Software description The application software uses the STM8S standard firmware library to control general purpose functions and peripherals: Clock (CLK) The clock control enables and delivers the correct clock frequency to the CPU and peripherals. At power-on, the master clock source is automatically selected as HSI clock with prescaler division factor equal to 8, This setup is not changed by the application code: = 2 MHz.
  • Page 7: Application Software Flowcharts

    AN3996 Software description Application software flowcharts This section gives an overview of the application software main loop as well as of the function that controls LD1 blinking speed. 2.2.1 Main loop flowchart Figure 1 shows the flowchart of the application software main loop. Figure 1.
  • Page 8: Blinking_Statemachine Flowchart

    Software description AN3996 2.2.2 Blinking_StateMachine flowchart Figure 2 shows the detailed flowchart of the Blinking_StateMachine() function part of the main routine. The Blinking_StateMachine() function implements the algorithm that controls the LED blinking speed depending on the state selected by the push button. At application start-up, the state machine is in its default state, LD1 toggles every 1 s period, then BlinkSpeed is incremented at each push button detection.
  • Page 9: Revision History

    AN3996 Revision history Revision history Table 2. Document revision history Date Revision Changes 31-Oct-2010 Initial release. Doc ID 022386 Rev 1 9/10...
  • Page 10 No license, express or implied, by estoppel or otherwise, to any intellectual property rights is granted under this document. If any part of this document refers to any third party products or services it shall not be deemed a license grant by ST for the use of such third party products or services, or any intellectual property contained therein or considered as a warranty covering the use in any manner whatsoever of such third party products or services or any intellectual property contained therein.

Table of Contents