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.
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.
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.
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.
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.
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.
Need help?
Do you have a question about the STM8SVLDISCOVERY and is the answer not in the manual?
Questions and answers