Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Eine Melodie mit dem Piepser abspielen
- // ACHTUNG: Die Bibliothek PRO-BOT128_Lib_V2.cc ändern!
- /*
- void BEEP(word Tone, word Periode)
- {
- Timer_T0FRQ(Tone,PS_64);
- DELAY_MS(Periode);
- //Timer_T0Stop();
- Timer_Disable(0);
- }
- */
- // Symbolische Konstanten definieren
- // Noten
- #define C 210
- #define D 190
- #define E 165
- #define F 155
- #define G 135
- #define H 120
- // Notenlängen
- #define ACHTEL 200
- #define VIERTEL 400
- #define HALBE 800
- #define PAUSE 50
- void main(void)
- {
- PRO_BOT128_INIT();
- LCD_Init();
- DELAY_MS(100);
- // Platz für eigene Programmteile, die einmalig ausgeführt werden:
- // Begrüßung
- LCD_Locate(1,1);
- LCD_WriteText("Beeper-Programm");
- // Hier piept's wohl:
- BEEP(C, ACHTEL);
- DELAY_MS(PAUSE);
- BEEP(D, ACHTEL);
- DELAY_MS(PAUSE);
- BEEP(E, ACHTEL);
- DELAY_MS(PAUSE);
- BEEP(F, ACHTEL);
- DELAY_MS(PAUSE);
- BEEP(G, VIERTEL);
- DELAY_MS(PAUSE);
- BEEP(G, VIERTEL);
- DELAY_MS(PAUSE);
- BEEP(H, ACHTEL);
- DELAY_MS(PAUSE);
- BEEP(H, ACHTEL);
- DELAY_MS(PAUSE);
- BEEP(H, ACHTEL);
- DELAY_MS(PAUSE);
- BEEP(H, ACHTEL);
- DELAY_MS(PAUSE);
- BEEP(G, HALBE);
- DELAY_MS(PAUSE);
- BEEP(H, ACHTEL);
- DELAY_MS(PAUSE);
- BEEP(H, ACHTEL);
- DELAY_MS(PAUSE);
- BEEP(H, ACHTEL);
- DELAY_MS(PAUSE);
- BEEP(H, ACHTEL);
- DELAY_MS(PAUSE);
- BEEP(G, HALBE);
- DELAY_MS(PAUSE);
- // Endlos-Schleife
- do
- {
- }
- while(1);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement