background image

UM0501

Demonstration applications

Doc ID 14320 Rev 3

13/23

   

   

   

2.8 PWM 

demo 

1

This mode demonstrates the Timer peripheral operating in PWM mode. Make sure that the 
JP14 jumper is installed in the bottom position (closer to the LCD).

1.

Entering the melody (see 

Figure 11

):

The first LCD line shows the position of the note to enter.

o

 = Edit mode, the note is selected by using the 

RV1

 potentiometer.

x

 = Protect mode, the note cannot be changed.

The second LCD line shows the notes to be played with the following convention:

a/A

 = LA

b/B

 = SI

c/C

 = DO

d/D

 = RE

e/E

 = MI

f/F

 = FA

g/G

 = SOL

s/S

 = silence or pause

A lowercase letter represent a brief note, and an uppercase letter a long note.

To modify a note, press the joystick 

LEFT

 or 

RIGHT

 to navigate the notes, and use the 

RV1

 potentiometer. Then press 

SEL

 to confirm.

Once all the notes have been defined, enter an end mark to play the melody.

*

 = End of notes, the melody is played only once.

8

 = End of melody, the melody is played in a loop with varying octaves and note 

durations.

Figure 11.

Defining the melody to be played

2. 

Playing and saving the melody

Press 

SEL

 on the joystick to play the tune indefinitely.

Press the joystick 

UP

 to stop the melody. 

Note:

Keep the joystick pressed 

UP 

for a short time to allow the action to be taken into account.

The second time 

UP

 is pressed, a message is displayed asking you whether you want 

to save the melody or not (see 

Figure 12

).

a) 

If you press the 

KEY

 button, the melody is saved in the external EEPROM. 

b) 

If you press 

UP

 on the joystick, you exit from the demo without saving the melody.

o

aaaBBBccdEE*

Summary of Contents for STM8/128-EVAL

Page 1: ...d on the STM8S firmware library and provides an example of how to use this library It is divided into various smaller demonstration applications demos In case the STM8 128 EVAL evaluation board is not...

Page 2: ...nu overview 9 2 2 Welcome screen and main menu 9 2 3 Help mode 10 2 4 ADC demo 1 10 2 5 ADC demo 2 11 2 6 ADC demo 3 11 2 7 TIMER demo 12 2 8 PWM demo 1 13 2 9 PWM demo 2 14 2 10 BEEPER demo 15 2 11 M...

Page 3: ...e keywords in bold indicate user actions on the joystick 5 way switch The KEY button 1 way switch and the RV1 potentiometer follow the conventions shown in Table 1 Up Up Up Up Up Up Left Right Left Ri...

Page 4: ...s and sub menus To navigate the menus and sub menus perform the following actions as required RIGHT Navigates to the next menu or sub menu items on the right LEFT Navigates to the next menu or sub men...

Page 5: ...the first line the ST logo is displayed moving on the second line and a melody is played see Figure 3 The introduction melody can be changed by using either PWM demo 1 or PWM demo 2 see Section 2 8 an...

Page 6: ...er on the evaluation board The converted value is displayed in different ways see Figure 6 On the LCD first line in percentage of the ADC range in hexadecimal and decimal format On the LCD second line...

Page 7: ...SART1 USART2 and buzzer as described in the previous section 2 6 ADC demo 3 This is the same as ADC demo 1 and ADC demo 2 except that the microphone U8 is used Note The JP5 jumper must be installed fo...

Page 8: ...stick to start the timer The remaining time is displayed on the LCD screen see Figure 9 Figure 9 Remaining time message 3 When the value reaches 00 10 a sound is heard for each second elapsed When the...

Page 9: ...ess the joystick LEFT or RIGHT to navigate the notes and use the RV1 potentiometer Then press SEL to confirm Once all the notes have been defined enter an end mark to play the melody End of notes the...

Page 10: ...stored in the Flash memory see Figure 13 1 Navigate between the melodies by pressing the joystick LEFT or RIGHT and press SEL to select and play the melody see Figure 13 Figure 13 Selecting a melody 2...

Page 11: ...e is entered the LSI clock is calibrated The message shown in Figure 14 is displayed at the end of calibration Figure 14 End of calibration message After a short time another message shows the current...

Page 12: ...layed see Figure 17 Figure 17 Card detected 2 Then the MicroSD card is initialized followed by a Write block 512 bytes and a Read block operation See Figure 18 for the messages displayed consecutively...

Page 13: ...t stops the first number then the second number etc You hit the jackpot if you get 4 identical numbers see Figure 20 Figure 20 Hitting the jackpot If you get 3 or 2 identical numbers you win a consola...

Page 14: ...e HSI clock frequency by a divider factor 1 2 4 8 1 The new clock frequency is then displayed You can monitor the master clock frequency with an oscilloscope connected to the MCO pin Note If you selec...

Page 15: ...o stw project by selecting File Open Workspace and browsing the demo project under STM8 128 EVAL_Demo Demo project STVD Cosmic b Configure the Debug instrument Click Debug Instrument Target Settings i...

Page 16: ...used in each demo Table 2 Peripherals used Peripheral Demo ADC2 ADC TIMER and PWM demos EXTIT MicroSD demo GPIO All demos buttons LEDs Clock Controller All demos BEEPER Beeper demo SPI All demos LCD M...

Page 17: ...b routines stm8_interrupt_vector c this file provides the interrupt vector table demo_xxx h header for the demo_xxx c file demo_xxx c this file provides all functions related to the xxx demo functions...

Page 18: ...ory Table 3 Document revision history Date Revision Changes 08 Dec 2008 1 Initial release 02 Mar 2009 2 Added Section 3 Upgrading the demonstration firmware 17 Jun 2009 3 Added note about JP5 in Secti...

Page 19: ...ARRANTIES OF MERCHANTABILITY FITNESS FOR A PARTICULAR PURPOSE AND THEIR EQUIVALENTS UNDER THE LAWS OF ANY JURISDICTION OR INFRINGEMENT OF ANY PATENT COPYRIGHT OR OTHER INTELLECTUAL PROPERTY RIGHT UNLE...

Reviews: