Verstehst Du Deinen Code?
Hier mal eine Möglichkeit von vielen:
Code:
$regfile = "m8def.dat"
$crystal = 1000000
$hwstack = 100
$swstack = 100
$framesize = 100
Config Lcd = 16 * 2
Config Lcdpin = Pin , Db4 = Portc.2 , Db5 = Portc.3 , Db6 = Portc.4 , Db7 = Portc.5 , E = Portc.1 , Rs = Portc.0
Config Lcdbus = 4
Cursor Off
Ddrb = &B11111111
Ddrd = &B00000000
const entprellzeit = 2
dim Modus as byte
dim Variablen as byte
Tastelosgelassen Alias Variablen.0
mTaste Alias pind.1
set Portd.1
Do
If mTaste = 0 Then
if tastelosgelassen = 0 then
set tastelosgelassen
gosub moduschange
end if
else ' Entprellen
if tastelosgelassen = 1 then
reset tastelosgelassen
waitms entprellzeit
end if
end if
Loop
end
ModusChange:
incr modus
if modus=4 then modus=0
locate 2,1
if modus = 0 then
lcd "mp3"
end if
if modus = 1 then
lcd "aux"
end if
if modus = 3 then
lcd "Radio"
end if
return
Lesezeichen