@ Fusebitversteller,
ich hatte heute morgen doch mal wieder keine Ruhe und habe am Code weitergearbeitet. Mit Sicherheit sind noch Fehler drin aber der Code lässt sich mit Bascom compilieren. Das ist ja schon mal was. Jetzt muss ich mir nur noch eine PS/2 Buchse besorgen, dann kann ich den Versuchsaufbau starten.
Hier schon mal mein Code. Sei doch bitte so nett und wirf einen Blick drüber. Wenn später alles korrekt läuft, werde ich alles als Komplettprojekt posten.
Gruß Michael
Code:
' Tastaturemulator
' mit ATMEGA 8
'02-04-2009
$regfile = "m8def.dat"
$crystal = 3686400
$baud = 9600
$hwstack = 32 ' default use 32 for the hardware stack
$swstack = 10 ' default use 10 for the SW stack
$framesize = 40 ' default use 40 for the frame
Config Portb = Output ' PortB als Ausgang definiert und auf High gesetzt
Portb = 255
Config Portc = Input ' PC.0 bis PC.4 / Tasteranschlüsse
Portc = 255
Config Pind.3 = Output ' Data
Config Pind.7 = Output ' Clock
Enable Interrupts ' you need to turn on interrupts yourself since an INT is used
Config Atemu = Int1 , Data = Pind.3 , Clock = Pind.7
' ^------------------------ used interrupt
' ^----------- pin connected to DATA
' ^-- pin connected to clock
'Note that the DATA must be connected to the used interrupt pin
Do
Waitms 200
If Pinc.0 = 0 Then
Sendscankbd Pfeil_hoch
Else
If Pinc.1 = 0 Then
Sendscankbd Pfeil_runter
Else
If Pinc.2 = 0 Then
Sendscankbd Pfeil_rechts
Else
If Pinc.3 = 0 Then
Sendscankbd Pfeil_links
Else
If Pinc.4 = 0 Then
Sendscankbd Enter
Else
End If
End If
End If
End If
End If
Loop
Return
Pfeil_hoch:
Data 5 , &HE0 , &H75 , &HE0 , &HF0 , &H75
Pfeil_runter:
Data 5 , &HE0 , &H72 , &HE0 , &HF0 , &H72
Pfeil_rechts:
Data 5 , &HE0 , &H74 , &HE0 , &HF0 , &H74
Pfeil_links:
Data 5 , &HE0 , &H6B , &HE0 , &HF0 , &H6B
Enter:
Data 3 , &H5A , &HF0 , &H5A
Lesezeichen