Reeper
08.10.2005, 17:09
Hallo,
habe jetzt schon die ganze Zeit gesucht, aber nichts gescheites gefunden.
1. Frage:
Wie kann ich Buchstaben, Zahlen und Zeichen in den Atmel einlesen (werden best. als ascii Zeichen erkannt)?
Unter Hilfe in Bascom steht noch was von Pins für die Tastatur, ich meine aber die Tastatur vom Computer [Serieller Anschluss (RXD und TXD) sind mit PC verbunden]
$regfile = "m32def.dat"
' $framesize = 32
'$swstack = 32
'$hwstack = 32
$crystal = 16000000
$baud = 9600
'----------LED------------------
Config Porta = Output
Enable Interrupts
Dim Key As Byte
Do
Print "Test"
Wait 3
Key = Getatkbd()
If Key = 49 Then
Print "1.Led "
Porta.0 = 1
Porta.1 = 0
Porta.2 = 0
Porta.3 = 0
Porta.4 = 0
Porta.5 = 0
Porta.6 = 0
End If
If Key = 50 Then
Print "2.Led "
Porta.0 = 0
Porta.1 = 1
Porta.2 = 0
Porta.3 = 0
Porta.4 = 0
Porta.5 = 0
Porta.6 = 0
End If
If Key = 51 Then
Print "3.Led "
Porta.0 = 0
Porta.1 = 0
Porta.2 = 1
Porta.3 = 0
Porta.4 = 0
Porta.5 = 0
Porta.6 = 0
End If
If Key = 52 Then
Print "4.Led "
Porta.0 = 0
Porta.1 = 0
Porta.2 = 0
Porta.3 = 1
Porta.4 = 0
Porta.5 = 0
Porta.6 = 0
End If
If Key = 53 Then
Print "5.Led "
Porta.0 = 0
Porta.1 = 0
Porta.2 = 0
Porta.3 = 0
Porta.4 = 1
Porta.5 = 0
Porta.6 = 0
End If
If Key = 54 Then
Print "6.Led "
Porta.0 = 0
Porta.1 = 0
Porta.2 = 0
Porta.3 = 0
Porta.4 = 0
Porta.5 = 1
Porta.6 = 0
End If
If Key = 55 Then
Print "7.Led "
Porta.0 = 0
Porta.1 = 0
Porta.2 = 0
Porta.3 = 0
Porta.4 = 0
Porta.5 = 0
Porta.6 = 1
End If
Loop
End
Keydata:
'normal keys lower case
Data 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , &H5E , 0
Data 0 , 0 , 0 , 0 , 0 , 113 , 49 , 0 , 0 , 0 , 122 , 115 , 97 , 119 , 50 , 0
Data 0 , 99 , 120 , 100 , 101 , 52 , 51 , 0 , 0 , 32 , 118 , 102 , 116 , 114 , 53 , 0
Data 0 , 110 , 98 , 104 , 103 , 121 , 54 , 7 , 8 , 44 , 109 , 106 , 117 , 55 , 56 , 0
Data 0 , 44 , 107 , 105 , 111 , 48 , 57 , 0 , 0 , 46 , 45 , 108 , 48 , 112 , 43 , 0
Data 0 , 0 , 0 , 0 , 0 , 92 , 0 , 0 , 0 , 0 , 13 , 0 , 0 , 92 , 0 , 0
Data 0 , 60 , 0 , 0 , 0 , 0 , 8 , 0 , 0 , 49 , 0 , 52 , 55 , 0 , 0 , 0
Data 48 , 44 , 50 , 53 , 54 , 56 , 0 , 0 , 0 , 43 , 51 , 45 , 42 , 57 , 0 , 0
'shifted keys UPPER case
Data 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0
Data 0 , 0 , 0 , 0 , 0 , 81 , 33 , 0 , 0 , 0 , 90 , 83 , 65 , 87 , 34 , 0
Data 0 , 67 , 88 , 68 , 69 , 0 , 35 , 0 , 0 , 32 , 86 , 70 , 84 , 82 , 37 , 0
Data 0 , 78 , 66 , 72 , 71 , 89 , 38 , 0 , 0 , 76 , 77 , 74 , 85 , 47 , 40 , 0
Data 0 , 59 , 75 , 73 , 79 , 61 , 41 , 0 , 0 , 58 , 95 , 76 , 48 , 80 , 63 , 0
Data 0 , 0 , 0 , 0 , 0 , 96 , 0 , 0 , 0 , 0 , 13 , 94 , 0 , 42 , 0 , 0
Data 0 , 62 , 0 , 0 , 0 , 8 , 0 , 0 , 49 , 0 , 52 , 55 , 0 , 0 , 0 , 0
Data 48 , 44 , 50 , 53 , 54 , 56 , 0 , 0 , 0 , 43 , 51 , 45 , 42 , 57 , 0 , 0
2.Frage:
Wie kann ich ein Eingangssignal hochzählen (ähnlich C = i+1).
Will zB. ein Taster einmal drücken und etwas ausführen und beim 2.mal drücken den nächsten Befehl abarbeiten lassen.
habe jetzt schon die ganze Zeit gesucht, aber nichts gescheites gefunden.
1. Frage:
Wie kann ich Buchstaben, Zahlen und Zeichen in den Atmel einlesen (werden best. als ascii Zeichen erkannt)?
Unter Hilfe in Bascom steht noch was von Pins für die Tastatur, ich meine aber die Tastatur vom Computer [Serieller Anschluss (RXD und TXD) sind mit PC verbunden]
$regfile = "m32def.dat"
' $framesize = 32
'$swstack = 32
'$hwstack = 32
$crystal = 16000000
$baud = 9600
'----------LED------------------
Config Porta = Output
Enable Interrupts
Dim Key As Byte
Do
Print "Test"
Wait 3
Key = Getatkbd()
If Key = 49 Then
Print "1.Led "
Porta.0 = 1
Porta.1 = 0
Porta.2 = 0
Porta.3 = 0
Porta.4 = 0
Porta.5 = 0
Porta.6 = 0
End If
If Key = 50 Then
Print "2.Led "
Porta.0 = 0
Porta.1 = 1
Porta.2 = 0
Porta.3 = 0
Porta.4 = 0
Porta.5 = 0
Porta.6 = 0
End If
If Key = 51 Then
Print "3.Led "
Porta.0 = 0
Porta.1 = 0
Porta.2 = 1
Porta.3 = 0
Porta.4 = 0
Porta.5 = 0
Porta.6 = 0
End If
If Key = 52 Then
Print "4.Led "
Porta.0 = 0
Porta.1 = 0
Porta.2 = 0
Porta.3 = 1
Porta.4 = 0
Porta.5 = 0
Porta.6 = 0
End If
If Key = 53 Then
Print "5.Led "
Porta.0 = 0
Porta.1 = 0
Porta.2 = 0
Porta.3 = 0
Porta.4 = 1
Porta.5 = 0
Porta.6 = 0
End If
If Key = 54 Then
Print "6.Led "
Porta.0 = 0
Porta.1 = 0
Porta.2 = 0
Porta.3 = 0
Porta.4 = 0
Porta.5 = 1
Porta.6 = 0
End If
If Key = 55 Then
Print "7.Led "
Porta.0 = 0
Porta.1 = 0
Porta.2 = 0
Porta.3 = 0
Porta.4 = 0
Porta.5 = 0
Porta.6 = 1
End If
Loop
End
Keydata:
'normal keys lower case
Data 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , &H5E , 0
Data 0 , 0 , 0 , 0 , 0 , 113 , 49 , 0 , 0 , 0 , 122 , 115 , 97 , 119 , 50 , 0
Data 0 , 99 , 120 , 100 , 101 , 52 , 51 , 0 , 0 , 32 , 118 , 102 , 116 , 114 , 53 , 0
Data 0 , 110 , 98 , 104 , 103 , 121 , 54 , 7 , 8 , 44 , 109 , 106 , 117 , 55 , 56 , 0
Data 0 , 44 , 107 , 105 , 111 , 48 , 57 , 0 , 0 , 46 , 45 , 108 , 48 , 112 , 43 , 0
Data 0 , 0 , 0 , 0 , 0 , 92 , 0 , 0 , 0 , 0 , 13 , 0 , 0 , 92 , 0 , 0
Data 0 , 60 , 0 , 0 , 0 , 0 , 8 , 0 , 0 , 49 , 0 , 52 , 55 , 0 , 0 , 0
Data 48 , 44 , 50 , 53 , 54 , 56 , 0 , 0 , 0 , 43 , 51 , 45 , 42 , 57 , 0 , 0
'shifted keys UPPER case
Data 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0
Data 0 , 0 , 0 , 0 , 0 , 81 , 33 , 0 , 0 , 0 , 90 , 83 , 65 , 87 , 34 , 0
Data 0 , 67 , 88 , 68 , 69 , 0 , 35 , 0 , 0 , 32 , 86 , 70 , 84 , 82 , 37 , 0
Data 0 , 78 , 66 , 72 , 71 , 89 , 38 , 0 , 0 , 76 , 77 , 74 , 85 , 47 , 40 , 0
Data 0 , 59 , 75 , 73 , 79 , 61 , 41 , 0 , 0 , 58 , 95 , 76 , 48 , 80 , 63 , 0
Data 0 , 0 , 0 , 0 , 0 , 96 , 0 , 0 , 0 , 0 , 13 , 94 , 0 , 42 , 0 , 0
Data 0 , 62 , 0 , 0 , 0 , 8 , 0 , 0 , 49 , 0 , 52 , 55 , 0 , 0 , 0 , 0
Data 48 , 44 , 50 , 53 , 54 , 56 , 0 , 0 , 0 , 43 , 51 , 45 , 42 , 57 , 0 , 0
2.Frage:
Wie kann ich ein Eingangssignal hochzählen (ähnlich C = i+1).
Will zB. ein Taster einmal drücken und etwas ausführen und beim 2.mal drücken den nächsten Befehl abarbeiten lassen.