Cały mój program wygląda tak:
Zaloguj się, aby zobaczyć kod
$regfile = "m48pdef.dat"
$crystal = 1000000
Config Lcdpin = Pin , Db4 = Portc.3 , Db5 = Portc.2 , Db6 = Portc.1 , Db7 = Portc.0 , E = Portc.4 , Rs = Portc.5
Config Lcd = 16 * 2
Set portb.6
Set Portb.7
Set portd.5
Config PIND.0 = Input
Config PIND.1 = Input
Config PIND.3 = Input
Config PIND.4 = Input
Config PIND.5 = Output
Config PINB.6 = Output
Config PINB.7 = Output
Config PINB.1 = Output
Config PINB.0 = Output
Config Rc5 = PIND.2
Speaker Alias PortB.1
Dim A As Byte
Dim Address As Byte , Command As Byte
Enable Interrupts
Cursor off
Cls
Lcd "OCZEKIWANIE NA"
Lowerline
Lcd "SYGNAL RC5..."
Do
Getrc5(address , Command)
If Address <> 255 Then
Command = Command And &B01111111
Locate 1 , 1 : Lcd "Address: " ; Address ; " "
Locate 2 , 1 : Lcd "Command: " ; Command ; " "
End If
If command = 1 Then
Reset PORTB.6
Cls
Lcd "Dioda ON"
End If
If command = 2 Then
Set PortB.6
Cls
Lcd "Dioda OFF"
End If
If command = 3 Then
Reset PORTB.7
Cls
Lcd "Dioda ON"
End If
If command = 4 Then
Set PORTB.7
Cls
Lcd "Dioda OFF"
End If
If command = 5 Then
Reset PORTD.5
Cls
Lcd "Dioda ON"
End If
If command = 6 Then
Set PORTD.5
Cls
Lcd "Dioda OFF"
End If
If command = 12 Then
Set PORTB.6
Set PORTB.7
Set portd.5
Reset Portb.0
Cls
Lcd " OFF"
End If
If command = 14 Then
Cls
Lcd " ON"
Reset PORTB.6
Reset PORTB.7
Reset portd.5
Set Portb.0
Sound Speaker , 124 , 84 'H2(1/16)
Sound Speaker , 110 , 95 'A2(1/16)
Sound Speaker , 248 , 84 'H2(1/8)
Waitms 125 'P(1/16)
Sound Speaker , 165 , 126 'E2(1/8)
Waitms 250 'P(1/8)
Waitms 125 'P(1/16)
Sound Speaker , 131 , 80 'C3(1/16)
Sound Speaker , 124 , 84 'H2(1/16)
Sound Speaker , 131 , 80 'C3(1/16)
Waitms 125 'P(1/16)
Sound Speaker , 124 , 84 'H2(1/16)
Waitms 125 'P(1/16)
Sound Speaker , 220 , 95 'A2(1/8)
Waitms 125 'P(1/16)
Waitms 250 'P(1/8)
Sound Speaker , 131 , 80 'C3(1/16)
Sound Speaker , 124 , 84 'H2(1/16)
Sound Speaker , 262 , 80 'C3(1/8)
Waitms 125 'P(1/16)
Sound Speaker , 165 , 106 'E2(1/8)
Cls
Lcd " ON"
End If
If command = 7 Then
Set Portb.0
Cls
Lcd "Silnik ON"
End If
If command = 8 Then
Reset Portb.0
Cls
Lcd "Silnik OFF"
End If
If command = 9 Then
Cls
Lcd ""
lowerline
Lcd " HEHEHE"
End If
If command = 0 Then
Cls
Lcd " Milego"
lowerline
Lcd " Dnia"
End If
If command = 16 Then
Cls
Lcd " MUZYKA"
Lowerline
Lcd " ON "
Reset Portb.6
Waitms 100
Reset Portb.7
Waitms 100
Reset Portd.5
Waitms 100
Set Portb.6
Waitms 100
Set Portb.7
Waitms 100
Set Portd.5
Waitms 100
Sound Speaker , 124 , 84 'H2(1/16)
Sound Speaker , 110 , 95 'A2(1/16)
Sound Speaker , 248 , 84 'H2(1/8)
Waitms 125 'P(1/16)
Sound Speaker , 165 , 126 'E2(1/8)
Waitms 250 'P(1/8)
Waitms 125 'P(1/16)
Sound Speaker , 131 , 80 'C3(1/16)
Sound Speaker , 124 , 84 'H2(1/16)
Sound Speaker , 131 , 80 'C3(1/16)
Waitms 125 'P(1/16)
Sound Speaker , 124 , 84 'H2(1/16)
Waitms 125 'P(1/16)
Sound Speaker , 220 , 95 'A2(1/8)
Waitms 125 'P(1/16)
Waitms 250 'P(1/8)
Sound Speaker , 131 , 80 'C3(1/16)
Sound Speaker , 124 , 84 'H2(1/16)
Sound Speaker , 262 , 80 'C3(1/8)
Waitms 125 'P(1/16)
Sound Speaker , 165 , 106 'E2(1/8)
End If
If command = 17 Then
Cls
Set Pinb.6
Wait 1
Set PINB.7
Reset PINB.6
Set PinD.5
Wait 1
Reset PIND.5
End If
If command = 52 Then
Cls
Lcd ""
Lowerline
Lcd ""
End If
If command = 55 Then
Cls
For A = 1 To 16
Locate 1 , A
Lcd "ELPOLAKO"
Locate 2 , A
Lcd "LOGO JA MAM TO"
Waitms 300
Cls
Next A
End If
If command = 54 Then
Cls
End If
Loop
End
"myślę o przesunięciu napisu do końca LCD, po czym bardzo szybki powrót napisu tak, by ostatnia litera słowa pojawiła się jako pierwszy znak"
A jak napisac program, tak aby działo się to automatycznie?
Dodam jeszcze tylko, ze mam płytke złożoną typowo do nauki