Pfad:AVR-DE => Anwendungen => Eieruhr => Quellcode
Eieruhr klein Anwendungen von
AVR-Einchip-Prozessoren AT90S, ATtiny, ATmega und ATxmega
Eieruhr mit ATtiny24 und rot/grünen LEDs
Assembler Quellcode
Logo

Assembler Quellcode für Eieruhr mit ATtiny24

Download asm-Original-Quellcode (22 kB) Gezippte Version dieser Seite (468 kB)

;
; ************************************
; * Eieruhr ATtiny24 mit 2*4 LED MUX *
; * V1 Januar 2018                   *
; * (C)2018 by avr-asm-tutorial.net  *
; ************************************
;
.nolist
.include "tn24adef.inc" ; ATtiny24A
.list
;
; **********************************
;        H A R D W A R E
; **********************************
; ATtiny24(A)
;             ___________
;          1 /           |14
;    3 V o--|VCC      GND|--o 0 V
;          2|            |13
;     CH o--|PB0      PA0|--o L1
;          3|            |12
;     CL o--|PB1      PA1|--o L2
;          4|            |11
;  RESET o--|RESET    PA2|--o L3
;          5|            |10
;    LSP o--|PB2/OC0A PA3|--o L4
;          6|            |9
;     L8 o--|PA7      PA4|--o L5
;          7|            |8
;     L7 o--|PA6      PA5|--o L6
;           |____________|
;
; **********************************
;  P O R T S   A N D   P I N S
; **********************************
;
.equ pLKRO = PORTA ; LED-Kathoden Rot, -Anoden Gruen
.equ pLKRD = DDRA ; Richtungsport LED-Kathoden Rot
.equ pCHO = PORTB ; LED Common High L5..L8
.equ pCHD = DDRB ; Richtungsport LED-Anoden L5..L8
.equ bCH= PORTB0 ; LED-Anoden-Bit L5..L8
.equ pCLO = PORTB ; LED Common Low L1..L4
.equ pCLD = DDRB ; Richtungsport LED-Anoden L1..L4
.equ bCL = PORTB1 ; LED-Anoden-Bit L1..L4
.equ pLspO = PORTB ; Lautsprecherausgabeport
.equ pLspD = DDRB ; Richtungsport Lautsprecher
.equ bLsp = PORTB2 ; Lautsprecher-Bit
;
; **********************************
;     E I N S T E L L U N G E N
; **********************************
;
.equ clock=1000000 ; Define clock frequency
; MUX-Frequenz
.equ fMux = 50 ; in Hz
;
; **********************************
;  F I X  &  B E R E C H N.  K O N S T
; **********************************
; Berechnung des CTC-wertes fuer die Uhr
.equ cPresc1 = 1 ; Prescaler der Uhr/MUX
.equ cCtc1=(clock/cPresc1/4/fMux)-1 ; CTC
;
; **********************************
;       R E G I S T E R S
; **********************************
;
; Benutzt: R0 ausserhalb Interrupts
; frei: R1 to R13
.def rMask = R14 ; Sekunden-Maske
.def rSreg = R15 ; Save/Restore status port
.def rmp = R16 ; Multipurpose ausserhalb Int
.def rimp = R17 ; Interrupt multipurpose
.def rFlag = R18 ; Flaggenregister
     .equ bMin = 0 ; Minutenflagge
	 .equ bSec = 1 ; Sekundenflagge
	 .equ bTO = 2 ; Timeout Note
.def rMin = R19 ; Minutenregister
.def rMuxCnt = R20 ; MUX-Phasenzaehler
.def rMux = R21 ; Multiplexerregister
.def rNote = R22 ; Note zu spielen
.def rSec = R23 ; Sekundenregister
.def rCntL = R24 ; Musik-Dauerzaehler, LSB
.def rCntH = R25 ; dto., MSB
; frei: R27:R26 = X
; benutzt: R29:R28 = Y, Melodienotenzeiger
; benutzt: R31:R30 = Z, Multipurpose ausserh. Int
;
; **********************************
;      C O D E - S E G M E N T
; **********************************
;
.cseg
.org 000000
;
; **********************************
; R E S E T  &  I N T - V E C T O R S
; **********************************
  rjmp Main ; Reset vector
  reti ; EXT_INT0
  reti ; PCI0
  reti ; PCI1
  reti ; WATCHDOG
  reti ; ICP1
  rjmp TC1Isr ; OC1A
  reti ; OC1B
  reti ; OVF1
  rjmp TC0Isr ; OC0A
  reti ; OC0B
  reti ; OVF0
  reti ; ACI
  reti ; ADCC
  reti ; ERDY
  reti ; USI_STR
  reti ; USI_OVF
;
; **********************************
;  I N T - S E R V I C E   R O U T .
; **********************************
;
; TC1 Compare Match Interrupt
;   - steuert MUX und Zeit
;
TC1Isr:
  in rSreg,SREG ; sichern Status
  clr rimp ; Ausgaenge aus = 0
  out pLKRD,rimp
  lsl rMux ; Mux links schieben
  brcc TC1Isr2 ; kein Carry = weiter
  ldi rMux,0x11 ; von vorne beginnen
  dec rMuxCnt ; MUX-Counter abwaerts
  brne TC1Isr1
  ldi rMuxCnt,fMux ; Mux-Counter-Neustart
  dec rSec ; Sekunden abwaerts
  brne TC1Isr1
  ldi rSec,60 ; Sekunden-Neustart
  sbr rFlag,1<<bMin ; Musik starten
  lsl rMin ; Naechste Minute
  brcs TC1Isr1
  ser rMin ; Neu starten
TC1Isr1:
  mov rMask,rMin ; Kopiere Minutenzeiger
  sbrc rMuxCnt,3
  lsl rMask ; Naechste Minute blinken
TC1Isr2:
  mov rimp,rMux ; Mux kopieren
  and rimp,rMask ; UND mit Minutenmaske
  out pLKRO,rimp ; in roten Kathodentreiber
  ; Minute gruen: L-Ausgang 1, Common = 0
  ; Minute rot: L-Ausgang 0, Common = 1
  cbi pCHO,bCH ; L5..L8: Clear Common High
  andi rimp,0xF0 ; hohe Bits isolieren
  brne TC1Isr3
  sbi pCHO,bCH ; L5..L8: Set Common High
TC1Isr3:
  cbi pCLO,bCL ; Clear Common Low
  in rimp,pLKRO ; Lese roten Katodentreiber
  andi rimp,0x0F ; niedrige Bits isolieren
  brne TC1Isr4
  sbi pCLO,bCL ; Set Common Low
TC1Isr4:
  out pLKRD,rMux ; Ausgaenge an
  out SREG,rSreg ; wiederherstellen Status
  reti
;
; TC0 Compare Match Interrupt
;   - Steuert Musikausgabe
;
TC0Isr:
  in rSreg,SREG
  sbiw rCntL,1 ; Dauer abwaerts
  brne TC0Isr1 ; Zaehler nicht Null
  sbr rFlag,1<<bTO ; Setze Flagge
TC0Isr1:
  out SREG,rSreg
  reti
;
; **********************************
;  M A I N   P R O G R A M   I N I T
; **********************************
;
Main:
  ldi rmp,Low(RAMEND)
  out SPL,rmp ; Init LSB stack pointer
  ; Init Common-Ausgaenge
  sbi pCHD,bCH ; L5..L8-Richtung Common Output
  sbi pCLD,bCL ; L1..L4-Richtung Common Output
  ; Starte Flags
  clr rFlag ; Flags loeschen
  ; Starte Mux und Zeitmessung
  ldi rMux,0x88 ; Starte naechste Mux am Anfang
  ldi rSec,60 ; Sekundenzaehler starten
  ldi rMuxCnt,fMux ; Mux-Zaehler starten
  ser rMin ; Minutenzaehler auf Null
  ; Starte TC1 fuer Mux/Zeit
  ldi rmp,High(cCtc1) ; Compare Match
  out OCR1AH,rmp
  ldi rmp,Low(cCtc1)
  out OCR1AL,rmp
  clr rmp ; CTC-Mode
  out TCCR1A,rmp
  ldi rmp,(1<<WGM12)|(1<<CS10) ; CTC, Presc=1
  out TCCR1B,rmp
  ldi rmp,1<<OCIE1A ; Compare A Int
  out TIMSK1,rmp
  ; Starte Lautsprecher fuer Musikausgabe
  cbi pLspO,bLsp ; Ausgang auf Null
  sbi pLspD,bLsp ; Ausgang aktiv
  ; Starte erste Melodie
  rcall Musik
  ; Sleep, Interrupts
  ldi rmp,1<<SE ; Sleep Mode Idle
  out MCUCR,rmp
  sei ; Enable interrupts
;
; **********************************
;    P R O G R A M   L O O P
; **********************************
;
Loop:
  sleep ; Schlafen legen
  nop ; Aufwachen
  sbrc rFlag,bMin ; Minute um?
  rcall Musik ; Minute um, starte Musik
  sbrc rFlag,bTO ; Note fertig?
  rcall SpieleNote ; Spiele naechste Note
  rjmp loop
;
; Musik spielen
;
Musik:
  cbr rFlag,1<<bMin
  ldi ZH,High(2*MelodieTab)
  ldi ZL,Low(2*MelodieTab)
  clr R0
  inc R0
  mov rmp,rMin
Musik1:
  cpi rmp,0xFF
  breq Musik2
  adiw ZL,2
  or rmp,R0
  sec
  rol R0
  rjmp Musik1
Musik2:
  lpm YL,Z+
  lpm YH,Z
;
; Spiele die naechste Note
;
SpieleNote:
  cbr rFlag,1<<bTO ; Flagge zuruecksetzen 
  mov ZH,YH ; Kopiere Musiknoten-Zeiger
  mov ZL,YL
  lpm rNote,Z+ ; Lese Notennummer
  lpm R0,Z+ ; Lese Dauermultiplikator
  cpi rNote,Ende ; Endezeichen erreicht?
  brne SpieleNote1 ; Nein
  ; Ende Musikspielen
  ldi rmp,(1<<COM0A1)|(1<<WGM01) ; OCR clear, CTC
  out TCCR0A,rmp
  ldi rmp,0 ; TC0-Interrupts aus
  out TIMSK0,rmp
  ret
SpieleNote1:
  mov YH,ZH ; Zeiger auf naechste Note
  mov YL,ZL
  ldi ZH,High(2*Timertabelle)
  ldi ZL,Low(2*Timertabelle)
  clr rmp ; Kopiere Notennummer
  add ZL,rNote ; Note einmal addieren
  adc ZH,rmp ; Carry und MSB addieren
  add ZL,rNote ; Note zweimal addieren
  adc ZH,rmp ; Carry und MSB addieren
  add ZL,rNote ; Note dreimal addieren
  adc ZH,rmp ; Carry und MSB addieren
  add ZL,rNote ; Note viermal addieren
  adc ZH,rmp ; Carry und MSB addieren
  lpm rmp,Z+ ; Lese Compare-A-Wert
  out OCR0A,rmp ; in Compare-A-Portregister
  lpm rmp,Z+ ; Lese Vorteiler
  out TCCR0B,rmp ; in Kontrollregister B
  lpm rCntL,Z+ ; Lese Dauer LSB
  lpm rCntH,Z ; dto., MSB
  mov ZH,rCntH ; kopiere nach Z
  mov ZL,rCntL
SpieleNote2:
  dec R0 ; Vervielfacher Dauer abwaerts
  breq SpieleNote3
  add rCntL,ZL ; Addiere Dauer
  adc rCntH,ZH
  rjmp SpieleNote2
SpieleNote3:
  ldi rmp,(1<<COM0A0)|(1<<WGM01) ; Toggle, CTC
  cpi rNote,p ; Pause?
  brcs SpieleNote4
  ldi rmp,(1<<COM0A1)|(1<<WGM01) ; Clear, CTC
SpieleNote4:
  out TCCR0A,rmp ; in Kontrollregister A
  ldi rmp,1<<OCIE0A ; Compare Match A Interrupt
  out TIMSK0,rmp
  ret
;
; Notentabelle
;   Notenkuerzel
;   nX = Note
;   n = Oktave
;     2m: Oktave - 2
;     m: Oktave - 1
;     Ohne: Oktave 0
;     1..7: Oktave n
;
Notentabelle:
.equ nA2m = 0 ; A2, f = 27,5 Hz
.equ nH2m = 1 ; H2, f = 30,8677 Hz
.equ nC1m = 2 ; C1, f = 32,7032 Hz
.equ nD1m = 3 ; D1, f = 36,7081 Hz
.equ nE1m = 4 ; E1, f = 41,2034 Hz
.equ nF1m = 5 ; F1, f = 43,6535 Hz
.equ nG1m = 6 ; G1, f = 48,9994 Hz
.equ nA1m = 7 ; A1, f = 55 Hz
.equ nH1m = 8 ; H1, f = 61,7354 Hz
.equ nCm = 9 ; C, f = 65,4064 Hz
.equ nDm = 10 ; D, f = 73,4162 Hz
.equ nEm = 11 ; E, f = 82,4069 Hz
.equ nFm = 12 ; F, f = 87,3071 Hz
.equ nGm = 13 ; G, f = 97,9989 Hz
.equ nAm = 14 ; A, f = 110 Hz
.equ nHm = 15 ; H, f = 123,471 Hz
.equ nc = 16 ; c, f = 130,813 Hz
.equ nd = 17 ; d, f = 146,832 Hz
.equ ne = 18 ; e, f = 164,814 Hz
.equ nf = 19 ; f, f = 174,614 Hz
.equ ng = 20 ; g, f = 195,998 Hz
.equ na = 21 ; a, f = 220 Hz
.equ nh = 22 ; h, f = 246,942 Hz
.equ nc1 = 23 ; c1, f = 261,626 Hz
.equ nd1 = 24 ; d1, f = 293,665 Hz
.equ ne1 = 25 ; e1, f = 329,628 Hz
.equ nf1 = 26 ; f1, f = 349,228 Hz
.equ ng1 = 27 ; g1, f = 391,995 Hz
.equ na1 = 28 ; a1, f = 440 Hz
.equ nh1 = 29 ; h1, f = 493,883 Hz
.equ nc2 = 30 ; c2, f = 523,251 Hz
.equ nd2 = 31 ; d2, f = 587,33 Hz
.equ ne2 = 32 ; e2, f = 659,255 Hz
.equ nf2 = 33 ; f2, f = 698,456 Hz
.equ ng2 = 34 ; g2, f = 783,991 Hz
.equ na2 = 35 ; a2, f = 880 Hz
.equ nh2 = 36 ; h2, f = 987,767 Hz
.equ nc3 = 37 ; c3, f = 1046,5 Hz
.equ nd3 = 38 ; d3, f = 1174,66 Hz
.equ ne3 = 39 ; e3, f = 1318,51 Hz
.equ nf3 = 40 ; f3, f = 1396,91 Hz
.equ ng3 = 41 ; g3, f = 1567,98 Hz
.equ na3 = 42 ; a3, f = 1760 Hz
.equ nh3 = 43 ; h3, f = 1975,53 Hz
.equ nc4 = 44 ; c4, f = 2093 Hz
.equ nd4 = 45 ; d4, f = 2349,32 Hz
.equ ne4 = 46 ; e4, f = 2637,02 Hz
.equ nf4 = 47 ; f4, f = 2793,83 Hz
.equ ng4 = 48 ; g4, f = 3135,96 Hz
.equ na4 = 49 ; a4, f = 3520 Hz
.equ nh4 = 50 ; h4, f = 3951,07 Hz
.equ nc5 = 51 ; c5, f = 4186,01 Hz
.equ nd5 = 52 ; d5, f = 4698,65 Hz
.equ ne5 = 53 ; e5, f = 5274,05 Hz
.equ nf5 = 54 ; f5, f = 5587,67 Hz
.equ ng5 = 55 ; g5, f = 6271,93 Hz
.equ na5 = 56 ; a5, f = 7040 Hz
.equ nh5 = 57 ; h5, f = 7902,13 Hz
.equ nc6 = 58 ; c6, f = 8372,02 Hz
.equ nd6 = 59 ; d6, f = 9397,28 Hz
.equ ne6 = 60 ; e6, f = 10548,08 Hz
.equ nf6 = 61 ; f6, f = 11175,3 Hz
.equ ng6 = 62 ; g6, f = 12543,86 Hz
.equ na6 = 63 ; a6, f = 14080 Hz
.equ nh6 = 64 ; h6, f = 15804,26 Hz
.equ nc7 = 65 ; c7, f = 16744,03 Hz
.equ nd7 = 66 ; d7, f = 18794,56 Hz
.equ ne7 = 67 ; e7, f = 21096,16 Hz
.equ nf7 = 68 ; f7, f = 22350,59 Hz
.equ ng7 = 69 ; g7, f = 25087,71 Hz
; Pausen
.equ p = 70 ; Pause 1/16
; Ende
.equ Ende = 0xFF
;
; Timertabelle fuer Noten
;   Byte 1 = Compare-Wert
;   Byte 2 = Prescaler-Wert
;   Byte 3 = LSB Repeat-Wert fuer 1/16-tel Note
;   Byte 4 = dto., MSB
;
Timertabelle:
.dw 1095, 3 ;  A2, Presc=256, Cmp=71, Fist=27,509 Hz, Fsoll=27,5, #0
.dw 1087, 4 ;  H2, Presc=256, Cmp=63, Fist=31,002 Hz, Fsoll=30,8677, #1
.dw 1007, 4 ;  C1, Presc=64, Cmp=239, Fist=32,688 Hz, Fsoll=32,7032, #2
.dw 981, 5 ;  D1, Presc=64, Cmp=213, Fist=36,678 Hz, Fsoll=36,7081, #3
.dw 958, 5 ;  E1, Presc=64, Cmp=190, Fist=41,118 Hz, Fsoll=41,2034, #4
.dw 947, 5 ;  F1, Presc=64, Cmp=179, Fist=43,645 Hz, Fsoll=43,6535, #5
.dw 927, 6 ;  G1, Presc=64, Cmp=159, Fist=49,135 Hz, Fsoll=48,9994, #6
.dw 910, 7 ;  A1, Presc=64, Cmp=142, Fist=55,018 Hz, Fsoll=55, #7
.dw 895, 8 ;  H1, Presc=64, Cmp=127, Fist=61,516 Hz, Fsoll=61,7354, #8
.dw 887, 8 ;  C, Presc=64, Cmp=119, Fist=65,651 Hz, Fsoll=65,4064, #9
.dw 874, 9 ;  D, Presc=64, Cmp=106, Fist=73,703 Hz, Fsoll=73,4162, #10
.dw 863, 10 ;  E, Presc=64, Cmp=95, Fist=82,237 Hz, Fsoll=82,4069, #11
.dw 857, 11 ;  F, Presc=64, Cmp=89, Fist=87,781 Hz, Fsoll=87,3071, #12
.dw 848, 12 ;  G, Presc=64, Cmp=80, Fist=97,656 Hz, Fsoll=97,9989, #13
.dw 839, 14 ;  A, Presc=64, Cmp=71, Fist=110,035 Hz, Fsoll=110, #14
.dw 831, 15 ;  H, Presc=64, Cmp=63, Fist=124,008 Hz, Fsoll=123,471, #15
.dw 828, 16 ;  c, Presc=64, Cmp=60, Fist=130,208 Hz, Fsoll=130,813, #16
.dw 821, 18 ;  d, Presc=64, Cmp=53, Fist=147,406 Hz, Fsoll=146,832, #17
.dw 815, 21 ;  e, Presc=64, Cmp=47, Fist=166,223 Hz, Fsoll=164,814, #18
.dw 813, 22 ;  f, Presc=64, Cmp=45, Fist=173,611 Hz, Fsoll=174,614, #19
.dw 808, 24 ;  g, Presc=64, Cmp=40, Fist=195,313 Hz, Fsoll=195,998, #20
.dw 804, 28 ;  a, Presc=64, Cmp=36, Fist=217,014 Hz, Fsoll=220, #21
.dw 765, 31 ;  h, Presc=8, Cmp=253, Fist=247,036 Hz, Fsoll=246,942, #22
.dw 751, 33 ;  c1, Presc=8, Cmp=239, Fist=261,506 Hz, Fsoll=261,626, #23
.dw 725, 37 ;  d1, Presc=8, Cmp=213, Fist=293,427 Hz, Fsoll=293,665, #24
.dw 702, 41 ;  e1, Presc=8, Cmp=190, Fist=328,947 Hz, Fsoll=329,628, #25
.dw 691, 44 ;  f1, Presc=8, Cmp=179, Fist=349,162 Hz, Fsoll=349,228, #26
.dw 671, 49 ;  g1, Presc=8, Cmp=159, Fist=393,082 Hz, Fsoll=391,995, #27
.dw 654, 55 ;  a1, Presc=8, Cmp=142, Fist=440,141 Hz, Fsoll=440, #28
.dw 639, 62 ;  h1, Presc=8, Cmp=127, Fist=492,126 Hz, Fsoll=493,883, #29
.dw 631, 65 ;  c2, Presc=8, Cmp=119, Fist=525,21 Hz, Fsoll=523,251, #30
.dw 618, 73 ;  d2, Presc=8, Cmp=106, Fist=589,623 Hz, Fsoll=587,33, #31
.dw 607, 82 ;  e2, Presc=8, Cmp=95, Fist=657,895 Hz, Fsoll=659,255, #32
.dw 601, 87 ;  f2, Presc=8, Cmp=89, Fist=702,247 Hz, Fsoll=698,456, #33
.dw 592, 98 ;  g2, Presc=8, Cmp=80, Fist=781,25 Hz, Fsoll=783,991, #34
.dw 583, 110 ;  a2, Presc=8, Cmp=71, Fist=880,282 Hz, Fsoll=880, #35
.dw 575, 123 ;  h2, Presc=8, Cmp=63, Fist=992,063 Hz, Fsoll=987,767, #36
.dw 572, 131 ;  c3, Presc=8, Cmp=60, Fist=1041,667 Hz, Fsoll=1046,5, #37
.dw 565, 147 ;  d3, Presc=8, Cmp=53, Fist=1179,245 Hz, Fsoll=1174,66, #38
.dw 559, 165 ;  e3, Presc=8, Cmp=47, Fist=1329,787 Hz, Fsoll=1318,51, #39
.dw 557, 175 ;  f3, Presc=8, Cmp=45, Fist=1388,889 Hz, Fsoll=1396,91, #40
.dw 552, 196 ;  g3, Presc=8, Cmp=40, Fist=1562,5 Hz, Fsoll=1567,98, #41
.dw 548, 220 ;  a3, Presc=8, Cmp=36, Fist=1736,111 Hz, Fsoll=1760, #42
.dw 509, 247 ;  h3, Presc=1, Cmp=253, Fist=1976,285 Hz, Fsoll=1975,53, #43
.dw 495, 262 ;  c4, Presc=1, Cmp=239, Fist=2092,05 Hz, Fsoll=2093, #44
.dw 469, 294 ;  d4, Presc=1, Cmp=213, Fist=2347,418 Hz, Fsoll=2349,32, #45
.dw 446, 330 ;  e4, Presc=1, Cmp=190, Fist=2631,579 Hz, Fsoll=2637,02, #46
.dw 435, 349 ;  f4, Presc=1, Cmp=179, Fist=2793,296 Hz, Fsoll=2793,83, #47
.dw 415, 392 ;  g4, Presc=1, Cmp=159, Fist=3144,654 Hz, Fsoll=3135,96, #48
.dw 398, 440 ;  a4, Presc=1, Cmp=142, Fist=3521,127 Hz, Fsoll=3520, #49
.dw 383, 494 ;  h4, Presc=1, Cmp=127, Fist=3937,008 Hz, Fsoll=3951,07, #50
.dw 375, 523 ;  c5, Presc=1, Cmp=119, Fist=4201,681 Hz, Fsoll=4186,01, #51
.dw 362, 587 ;  d5, Presc=1, Cmp=106, Fist=4716,981 Hz, Fsoll=4698,65, #52
.dw 351, 659 ;  e5, Presc=1, Cmp=95, Fist=5263,158 Hz, Fsoll=5274,05, #53
.dw 345, 698 ;  f5, Presc=1, Cmp=89, Fist=5617,978 Hz, Fsoll=5587,67, #54
.dw 336, 784 ;  g5, Presc=1, Cmp=80, Fist=6250 Hz, Fsoll=6271,93, #55
.dw 327, 880 ;  a5, Presc=1, Cmp=71, Fist=7042,254 Hz, Fsoll=7040, #56
.dw 319, 988 ;  h5, Presc=1, Cmp=63, Fist=7936,508 Hz, Fsoll=7902,13, #57
.dw 316, 1047 ;  c6, Presc=1, Cmp=60, Fist=8333,333 Hz, Fsoll=8372,02, #58
.dw 309, 1175 ;  d6, Presc=1, Cmp=53, Fist=9433,962 Hz, Fsoll=9397,28, #59
.dw 303, 1319 ;  e6, Presc=1, Cmp=47, Fist=10638,298 Hz, Fsoll=10548,08, #60
.dw 301, 1397 ;  f6, Presc=1, Cmp=45, Fist=11111,111 Hz, Fsoll=11175,3, #61
.dw 296, 1568 ;  g6, Presc=1, Cmp=40, Fist=12500 Hz, Fsoll=12543,86, #62
.dw 292, 1760 ;  a6, Presc=1, Cmp=36, Fist=13888,889 Hz, Fsoll=14080, #63
.dw 288, 1976 ;  h6, Presc=1, Cmp=32, Fist=15625 Hz, Fsoll=15804,26, #64
.dw 286, 2093 ;  c7, Presc=1, Cmp=30, Fist=16666,667 Hz, Fsoll=16744,03, #65
.dw 283, 2349 ;  d7, Presc=1, Cmp=27, Fist=18518,519 Hz, Fsoll=18794,56, #66
.dw 280, 2637 ;  e7, Presc=1, Cmp=24, Fist=20833,333 Hz, Fsoll=21096,16, #67
.dw 278, 2794 ;  f7, Presc=1, Cmp=22, Fist=22727,273 Hz, Fsoll=22350,59, #68
.dw 276, 3136 ;  g7, Presc=1, Cmp=20, Fist=25000 Hz, Fsoll=25087,71, #69

.dw 256*(1<<CS02)+243, 1 ; Pause1/16, #70
;
; Melodientabelle
;
MelodieTab:
  .dw 2*Melodie0,2*Melodie1,2*Melodie2
  .dw 2*Melodie3,2*Melodie4,2*Melodie5
  .dw 2*Melodie6,2*Melodie7,2*Melodie8
;
; Melodien
;
Melodie0: ; Ode an die Freude
  ;   Freu-    de       schoe-    ner       Goet-     ter-      fun-     ken
  .db nh,4,p,2,nh,4,p,2,nc1,4,p,2,nd1,4,p,2,nd1,4,p,2,nc1,4,p,2,nh,4,p,2,na,4,p,2
  ;   Toch-    ter      aus      E-       ly-      si-      um,
  .db ng,4,p,2,ng,4,p,2,na,4,p,2,nh,4,p,2,nh,6,p,2,na,2,p,2,na,8;
  .db Ende,Ende
;
Melodie1: ; Marmor, Stein und Eisen bricht
  ;   Wei-     ne       nicht ,  wenn     der      Re-       gen      faellt,  dam,     dam,     dam,      dam
  .db na,2,p,2,na,4,p,2,na,4,p,2,ng,2,p,2,na,4,p,2,nc1,2,p,2,na,4,p,2,na,6,p,2,na,4,p,2,nh,8,p,8,nd1,4,p,2,nc1,8,p,8
  ;   Mar-      mor,      Stein     und       Ei-       sen       bricht,   a-        ber       un-       se-       re        Lie-        be        nicht.
  .db na1,2,p,2,na1,4,p,2,na1,6,p,2,na1,4,p,2,ng1,2,p,2,nf1,4,p,2,nf1,6,p,2,ng1,2,p,2,ng1,4,p,2,ng1,4,p,2,nf1,2,p,2,ng1,4,p,2,na1,4,ne1,4,nf1,4,p,2,ne1,6,p,8
  ;   Al-       les,      al-       les       geht      vor-      bei,      doch      wir       sind      uns       treu
  .db na1,4,p,1,na1,4,p,4,na1,4,p,1,na1,4,p,4,ng1,2,p,2,nf1,4,p,2,nf1,6,p,6,ng1,4,p,2,ng1,4,p,2,nf1,2,p,2,ng1,4,p,2,na1,12
;
  .db Ende,Ende
;
Melodie2: ; When I'm sixty four
  ;   When     I         get      old-     er       loo-     sing     my       hair...   ma-      ny        years... from     now,
  .db nc,4,p,1,nhm,4,p,1,nc,4,p,1,ne,4,p,2,ne,4,p,2,ne,4,p,1,nf,4,p,1,ne,4,p,1,na,8,p,2, na,2,p,2,nc1,4,p,2,na,6,p,2,nf,4,p,2,nh,8,p,8
  ;   will     you      still    be        send-    ing      me       a         val-     en-      tine...  birth-   day      greet-   ings,    bott-     le        of       wine?
  .db ng,4,p,1,na,4,p,1,na,4,p,1,nc1,4,p,2,ng,4,p,1,na,4,p,1,na,4,p,1,nc1,4,p,2,ng,2,p,2,ng,4,p,2,nf,6,p,2,ng,4,p,2,na,4,p,2,na,4,p,2,nh,4,p,2,nc1,4,p,1,nc1,4,p,1,nh,4,p,1,na,6,p,8
  ;   If       I'd       been     out...   till     quar-    ter      to       three... would     you       lock     the      door?
  .db nc,4,p,1,nhm,4,p,1,nc,4,p,1,ne,4,p,2,nc,4,p,2,ne,4,p,1,nf,4,p,1,ne,4,p,1,na,6,p,2,nc1,2,p,2,nc1,3,p,2,nh,4,p,2,nf,4,p,1,na,8,p,8
  ;   will     you      still    need      me,      will     you      still    feed     me,      when      I'm       six-      ty        four?
  .db na,4,p,1,nf,4,p,1,na,4,p,1,nc1,6,p,2,nh,4,p,2,na,4,p,1,nf,4,p,1,na,4,p,1,ng,6,p,1,nf,4,p,2,nc1,2,p,2,nc1,3,p,2,nc1,2,p,2,nc1,4,p,2,na,8
;
  .db Ende,Ende
;
Melodie3: ; Smoke on the water
  ;   Smoke     on        the       wa-       ter
  .db ne1,8,p,2,nd1,4,p,1,nc1,4,p,2,ne1,4,p,2,nc1,4,p,8
  ;   A        Fi-      re       in       the      sky
  .db ng,2,p,2,nh,4,p,1,ng,4,p,2,nh,4,p,1,ng,4,p,2,nf,4,ng,4
;
  .db Ende,Ende
;
Melodie4: ; The wall
  ; We don't need no ed- u- ca- tion
  .db nd,2,p,2,ne,4,p,2,nf,4,p,2,ne,4,p,2,nd,4,p,2,ne,4,p,1,nf,6,p,2,ne,4,p,8
  ;   We       don't    need     no       thought  control
  .db nd,2,p,2,ne,4,p,2,nf,4,p,2,ne,4,p,2,nd,4,p,2,ne,4,p,2
  ;   dark     sar-     ca-      sm       in       the      class-   room
  .db nd,4,p,2,ne,4,p,1,nf,4,p,1,ne,4,p,4,nd,4,p,2,ne,6,p,2,nf,4,p,2,ne,4,p,8
  ;   teach    or       leave    them     kids     a-    lone
  .db nd,4,p,2,ne,4,p,1,nf,6,p,2,ne,4,p,4,nd,4,p,2,ne,4,p,1,nf,8
;
  .db Ende,Ende
;
Melodie5: ; Emanuela
  ;   Lass     die       Fin-      ger       von      E-
  .db nf,4,p,4,nc1,4,p,4,nc1,4,p,1,nc1,4,p,1,na,4,p,1,nf,6,p,4
  ;   ma-       nu-       e-        la  
  .db nc1,4,p,4,nd1,2,p,4,nc1,4,p,4,na,4
;
  .db Ende,Ende
;
Melodie6: ; Morse
  ;  J          r   g    e  n
  ; .---  ..--  .-.  --.  .  -.
  .db nc3,2,p,2,nc3,6,p,2,nc3,6,p,2,nc3,6,p,8 ; J
  .db nc3,2,p,2,nc3,2,p,2,nc3,6,p,2,nc3,6,p,8; 
  .db nc3,2,p,2,nc3,6,p,2,nc3,2,p,8 ; r
  .db nc3,6,p,2,nc3,6,p,2,nc3,2,p,8 ; g
  .db nc3,2,p,8 ; e
  .db nc3,6,p,2,nc3,2 ; n
;
  .db Ende,Ende
;
Melodie7:
  ;   Voel- ker       hoert     die      Sig-     na-      le! 
  .db ne1,6,nd1,4,p,2,nc1,8,p,2,ng,6,p,2,ne,2,p,2,na,8,p,2,nf,4,p,4
  ;   Auf   zum       letzt-   ten      Ge-      fecht!
  .db nd1,6,nc1,4,p,2,nh,8,p,2,na,6,p,2,ng,2,p,2,ng,8,p,4
  ;   Die      In-       ter-      na-       tio-     na-       le 
  .db ng,4,p,2,ne1,6,p,2,ne1,2,p,2,nd1,4,p,2,ng,4,p,2,nc1,8,p,2,nh,6,p,2
  ;   er-      kaempft  das      Men-     schen-    recht!
  .db nh,2,p,2,na,6,p,2,ng,2,p,2,na,4,p,2,nd1,4,p,2,nd1,8
  .db Ende,Ende
;
Melodie8: ; Tonleiter
  .db nA2m,4,p,2,nH2m,4,p,2,p,8
  .db nC1m,4,p,2,nD1m,4,p,2,nE1m,4,p,2,nF1m,4,p,2,nG1m,4,p,2,nA1m,4,p,2,nH1m,4,p,2,p,8
  .db nCm,4,p,2,nDm,4,p,2,nEm,4,p,2,nFm,4,p,2,nGm,4,p,2,nAm,4,p,2,nHm,4,p,2,p,8
  .db nc,4,p,2,nd,4,p,2,ne,4,p,2,nf,4,p,2,ng,4,p,2,na,4,p,2,nh,4,p,2,p,8
  .db nc1,4,p,2,nd1,4,p,2,ne1,4,p,2,nf1,4,p,2,ng1,4,p,2,na1,4,p,2,nh1,4,p,2,p,8
  .db nc2,4,p,2,nd2,4,p,2,ne2,4,p,2,nf2,4,p,2,ng2,4,p,2,na2,4,p,2,nh2,4,p,2,p,8
  .db nc3,4,p,2,nd3,4,p,2,ne3,4,p,2,nf3,4,p,2,ng3,4,p,2,na3,4,p,2,nh3,4,p,2,p,8
  .db nc4,4,p,2,nd4,4,p,2,ne4,4,p,2,nf4,4,p,2,ng4,4,p,2,na4,4,p,2,nh4,4,p,2,p,8
  .db nc5,4,p,2,nd5,4,p,2,ne5,4,p,2,nf5,4,p,2,ng5,4,p,2,na5,4,p,2,nh5,4,p,2,p,8
  .db nc6,4,p,2,nd6,4,p,2,ne6,4,p,2,nf6,4,p,2,ng6,4,p,2,na6,4,p,2,nh6,4,p,2,p,8
  .db nc7,4,p,2,nd7,4
  .db Ende,Ende
  .db p,2,ne7,4,p,2,nf7,4,p,2,ng7,4,p,8
;
; End of source code
;



Seitenanfang




Lob, Tadel, Fehlermeldungen, Genöle und Geschimpfe oder Spam bitte über das Kommentarformular an mich.

©2018 by http://www.avr-asm-tutorial.net