background image

UM0501

Demonstration applications

Doc ID 14320 Rev 3

17/23

   

   

   

Figure 19.

Reading 512 bytes from the MicroSD card

2.12 GAME 

demo

This little game is a kind of “fruit machine”.

When you press 

SEL

 the numbers start rolling. Use the 

KEY

 button to stop each number. 

The first time the 

KEY 

button is pressed it 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 consolation prize (see 

Figure 21

).

Figure 21.

Winning a consolation prize

If all the numbers are different, you lose (see 

Figure 22

).

Figure 22.

Losing the game

UP

: Press the joystick 

UP

 to exit this menu.

LEFT or RIGHT

to see data

Addr: 0x0001
Data: 0x01

5 5 5 5

JACKPOT : 10000$

7 7 8 6

You Win : 10$!

1 2 3 4

YOU LOSE :-(

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: