ST AN3277 Application note

ST AN3277 Application note

AN3277

Application Note

Adjustable buzzer frequency using STM8S-DISCOVERY touch sensing key

Application overview

This application note provides a short description of how 3BEEP application software can use a Beeper peripheral to take advantage of the STM8S-DISCOVERY touch sensing key, TS1.

Once the STM8S105C6T6 is powered-up through a USB cable connected to the host PC, the LED LD1 switches on, meaning that the programming has been completed successfully.

Each time the TS1 key is pressed, the Beeper emits a beep at different frequencies, 1 KHz, 2 KHz and 4 KHz respectively.

The fourth time TS1 is pressed, the Beeper stops emitting.

A Beeper cycle can then be restarted by pressing TS1 again.

Alternate function remapping must be performed on the STM8S105C6T6 before the Beeper peripheral can be used in this manner. This is described in UM0834.

Even though the STM8S-DISCOVERY is built around an STM8S105C6T6, it allows evaluation of the main features of all the STM8S MCUs.

Reference documents

STM8S-DISCOVERY evaluation board user manual (UM0817).

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

October 2010

Doc ID 17979 Rev 1

1/13

www.st.com

Contents

AN3277

 

 

Contents

1

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

. 5

 

1.1

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

5

 

1.2

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

5

 

1.3

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

6

2

Option byte configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

7

3

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

8

 

3.1

Touch sensing library configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

8

 

3.2

Standard STM8S firmware library configuration . . . . . . . . . . . . . . . . . . . .

9

 

3.3

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

10

3.3.1 Main loop flowchart . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10 3.3.2 ExtraCode_StateMachine flowchart . . . . . . . . . . . . . . . . . . . . . . . . . . . 11

4

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

12

2/13

Doc ID 17979 Rev 1

AN3277

List of tables

 

 

List of tables

Table 1. Beeper configuration. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6 Table 2. Touch sensing library configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8 Table 3. Document revision history . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12

Doc ID 17979 Rev 1

3/13

List of figures

AN3277

 

 

List of figures

Figure 1. Application schematics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5 Figure 2. Main application loop flowchart. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10 Figure 3. ExtraCode_StateMachine flowchart . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11

4/13

Doc ID 17979 Rev 1

Loading...
+ 9 hidden pages