.include "m32def.inc" .def temp1=r16 .def temp2=r17 .def temp3=r18 .def temp4=r19 ;benutze r22-r25 in der shuffle funktion als zähler(counter) für programmabläufe deshalb nit mehr benutzen .equ MMC_Write =PORTB ;//Port an der die MMC/SD-Karte angeschlossen ist also des SPI .equ MMC_Read =PINB .equ MMC_Dir =DDRB .equ SPI_DI =6 ;//Port Pin an dem Data Output der MMC/SD-Karte angeschlossen ist .equ SPI_DO =5 ;//Port Pin an dem Data Input der MMC/SD-Karte angeschlossen ist .equ SPI_Clock =7 ;//Port Pin an dem die Clock der MMC/SD-Karte angeschlossen ist (clk) .equ MMC_Chip_Select =4 ;//Port Pin an dem Chip Select der MMC/SD-Karte angeschlossen ist .equ CLOCK = 16000000 .equ BAUD = 9600 .equ UBRRVAL = CLOCK/(BAUD*16)-1 ldi temp1, 0x00 sts vorspulabfrage, temp1 ldi temp1, 0x00 out DDRA, temp1 ldi temp1, 0x00 sts Volume_set, temp1 ;TDA steht am anfang nach TWI_init auf 0db !!! ldi temp1, 0x04 ldi temp2, 0x04 sts BASS_set, temp1 ;anfangsweerte der bass geschichte sts TREBBLE_set, temp2 ldi temp1, 0x01 sts GAIN_set, temp1 ldi temp1, LOW(RAMEND) ; LOW-Byte der obersten RAM-Adresse out SPL, temp1 ldi temp1, HIGH(RAMEND) ; HIGH-Byte der obersten RAM-Adresse out SPH, temp1 start: ; Baudrate einstellen ldi temp1, LOW(UBRRVAL) out UBRRL, temp1 ldi temp1, HIGH(UBRRVAL) out UBRRH, temp1 ; Frame-Format: 8 Bit ldi temp1, (1<1 add temp3, r20 adc temp2, r21 adc temp1, r21 sts addresse, temp1 sts addresse+1, temp2 sts addresse+2, temp3 sts addresse+3, temp4 lds temp1, vorspulabfrage ;abfrage wegen vorspulen, wenn ja keine tastenabfrage cpi temp1, 0xFF breq TASTER_ende rjmp TASTER_anfang TASTER_ende: rjmp greater_DATA next_FAT: rjmp FAT_read0 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; REGISTER: rjmp start ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;nach tasten rückkehr;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;müssen id3tag und root wieder;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;aufgerufen werden;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; TASTER_anfang: in temp1, PINA sbrs temp1, 0 rjmp taste0 sbrs temp1, 1 rjmp taste1 sbrs temp1, 2 rjmp taste2 sbrs temp1, 3 rjmp taste3 rjmp TASTER_ende ;zurückkehren zum datentransfer oder sonstwohin vor tastendruck taste0: ;:_______________________; ;zurückspulen ; ;taser zurück für menu ; ;________________________; rcall tastenwait lds temp1, root_counter_anfang cpi temp1, 0x00 breq TASTER_anfang dec temp1 ;2mal dekrementieren weil lcd_show am ende inkrementiert!!! dec temp1 sts root_counter_anfang, temp1 ret taste1: rcall tastenwait rjmp MENUSTEUERUNG ;stop und ab ins MENU taste2: ;____________________; ;bestätigung im menu ; ;____________________; rcall tastenwait taste2_pause: ;play und pause in temp1, PINA sbrs temp1, 0 rjmp taste0 sbrs temp1, 1 rjmp taste1 sbrs temp1, 2 rjmp TASTER_ende1 sbrs temp1, 3 rjmp taste3 rjmp taste2_pause TASTER_ende1: rcall tastenwait rjmp TASTER_ende taste3: ;_________________________; ;vorspulen ; ;taster vor im menu ; ;_________________________; rcall tastenwait in temp1, PINA sbrs temp1, 3 rjmp taste3_vorspulen ret ;lcd_show inkrementiert ja schon am schluss taste3_vorspulen: ldi temp1, 0xFF sts vorspulabfrage, temp1 rjmp TASTER_ende vorspulabfrage_2: in temp1, PINA sbrc temp1, 3 rjmp vorspulen_ende ret vorspulen_ende: ldi temp1, 0x00 sts vorspulabfrage, temp1 ret tastenwait: ;____________________________________ ; warte 7999992 Zyklen: ldi temp1, $48 WGLOOP0727: ldi temp2, $BC WGLOOP1727: ldi temp3, $C4 WGLOOP2727: dec temp3 brne WGLOOP2727 dec temp2 brne WGLOOP1727 dec temp1 brne WGLOOP0727 ; ----------------------------- ; warte 6 Zyklen: ldi temp1, $02 WGLOOP3727: dec temp1 brne WGLOOP3727 ; ----------------------------- ; warte 2 Zyklen: nop nop ; ============================= ret MENUSTEUERUNG: ;hier muss das menu hin mit play shuffle, laut-leise, höhen-bässe, playlist volume1_schleife: call lcd_clear ldi temp1, 0xB9 call lcd_command_left ldi temp1, 0x48 call lcd_command_left ldi ZL, LOW(volume1*2) ldi ZH, HIGH(volume1*2) ldi temp4, 0x00 volume1_schleife1: lpm temp1, Z+ call lcd_data_left inc temp4 cpi temp4, 0x0F breq volume2_schleife rjmp volume1_schleife1 volume2_schleife: ldi temp1, 0xBA call lcd_command_left ldi temp1, 0x48 call lcd_command_left ldi ZL, LOW(volume2*2) ldi ZH, HIGH(volume2*2) ldi temp4, 0x00 volume2_schleife2: lpm temp1, Z+ call lcd_data_left inc temp4 cpi temp4, 0x0F breq bass_trebble_schleife1 rjmp volume2_schleife2 bass_trebble_schleife1: ldi temp1, 0xB9 call lcd_command_right ldi temp1, 0x48 call lcd_command_right ldi ZL, LOW(bass_trebble1*2) ldi ZH, HIGH(bass_trebble1*2) ldi temp4, 0x00 bass_trebble_loop1: lpm temp1, Z+ call lcd_data_right inc temp4 cpi temp4, 0x0F breq bass_trebble_schleife2 rjmp bass_trebble_loop1 bass_trebble_schleife2: ldi temp1, 0xBA call lcd_command_right ldi temp1, 0x48 call lcd_command_right ldi ZL, LOW(bass_trebble2*2) ldi ZH, HIGH(bass_trebble2*2) ldi temp4, 0x00 bass_trebble_loop2: lpm temp1, Z+ call lcd_data_right inc temp4 cpi temp4, 0x0F breq changes rjmp bass_trebble_loop2 changes: in temp1, PINA sbrs temp1, 0 rjmp MENU_VOLUME_GAIN sbrs temp1, 1 rjmp taste1 sbrs temp1, 2 rjmp TASTER_ende1 sbrs temp1, 3 rjmp MENU_BASS_TREBBLE rjmp changes MENU_VOLUME_GAIN: call tastenwait call lcd_clear ldi temp1, 0xB9 call lcd_command_left ldi temp1, 0x40 call lcd_command_left ldi temp1, 0xFE call lcd_data_left ldi temp1, 0x7C call lcd_data_left ldi temp1, 0x38 call lcd_data_left ldi temp1, 0x10 call lcd_data_left ldi temp1, 0x7C call lcd_data_left ldi temp1, 0x00 call lcd_data_left ldi temp1, 0x00 call lcd_data_left ;zeichen für forward ldi temp1, 0x56 call alphabet_search_left ldi temp1, 0x6F call alphabet_search_left ldi temp1, 0x6C call alphabet_search_left ldi temp1, 0x75 call alphabet_search_left ldi temp1, 0x6D call alphabet_search_left ldi temp1, 0x65 call alphabet_search_left ;VOLUME ldi temp1, 0xBA call lcd_command_left ldi temp1, 0x40 call lcd_command_left ldi temp1, 0x7C call lcd_data_left ldi temp1, 0x10 call lcd_data_left ldi temp1, 0x38 call lcd_data_left ldi temp1, 0x7C call lcd_data_left ldi temp1, 0xFE call lcd_data_left ldi temp1, 0x00 call lcd_data_left ldi temp1, 0x00 call lcd_data_left ;zeichen für backward ldi temp1, 0x47 call alphabet_search_left ldi temp1, 0x61 call alphabet_search_left ldi temp1, 0x69 call alphabet_search_left ldi temp1, 0x6E call alphabet_search_left ;GAIN VOLUME_OR_GAIN: in temp1, PINA sbrs temp1, 0 rjmp MENU_GAIN sbrs temp1, 1 rjmp MENUSTEUERUNG1 sbrs temp1, 2 rjmp MENUSTEUERUNG1 sbrs temp1, 3 rjmp MENU_laut_leise rjmp VOLUME_OR_GAIN MENU_GAIN: rcall tastenwait call lcd_clear ldi temp1, 0xB9 call lcd_command_left ldi temp1, 0x40 call lcd_command_left ldi temp1, 0x78 call alphabet_search_left lds temp1, GAIN_set ldi temp2, 0x30 add temp1, temp2 call alphabet_search_left ;derzeitige gainstärke auf display zeigen GAIN_less_more: in temp1, PINA sbrs temp1, 0 rjmp less_gain sbrs temp1, 1 rjmp MENUSTEUERUNG1 sbrs temp1, 2 rjmp MENUSTEUERUNG1 sbrs temp1, 3 rjmp more_gain rjmp GAIN_less_more less_gain: rcall tastenwait lds temp1, GAIN_set cpi temp1, 0x01 breq GAIN_less_more ;falls schon gain 1 dann zurück menu weil quatsch lsr temp1 sts GAIN_set, temp1 ldi temp1, 0xB9 call lcd_command_left ldi temp1, 0x40 call lcd_command_left ;bildschirm addresse settzen ldi temp1, 0x78 call alphabet_search_left lds temp1, GAIN_set ldi temp2, 0x30 add temp1, temp2 call alphabet_search_left ;bildschirm anzeige neues gain lds temp1, GAIN_set rcall GAIN_TWI rjmp GAIN_less_more more_gain: rcall tastenwait lds temp1, GAIN_set cpi temp1, 0x08 breq GAIN_less_more ;falls schon volume 8 dann zurück menu weil quatsch lsl temp1 sts GAIN_set, temp1 ldi temp1, 0xB9 call lcd_command_left ldi temp1, 0x40 call lcd_command_left ;bildschirm addresse settzen ldi temp1, 0x78 call alphabet_search_left lds temp1, GAIN_set ldi temp2, 0x30 add temp1, temp2 call alphabet_search_left ;bildschirm anzeige neues volume rcall GAIN_TWI rjmp GAIN_less_more GAIN_TWI: ldi temp1, 0xC0 ; Bitrate einstellen out TWBR, temp1 ldi temp1, (1<