fat32
29.06.2007, 04:20
hallo, bei folgendem Code sollte eigentlich je nach gedrückter Taste ne
LED unterschiedlich oft angehen. Tut sie aber nicht :-(
Was ist da los?
$regfile = "m32def.dat"
$framesize = 32
$swstack = 32
$hwstack = 32
$crystal = 1000000
Config Portc.0 = Output
Config Porta = Input
Porta = 1
Config Portb = Input
Portb = 1
Dim Taste As Integer
Dim Taste2 AS Word
Dim J AS Integer
J = 0
Declare Sub ausgeben(byval impulse As Integer)
Taste = 0
Do
if Pinb.0 = 1 Then
Portc.0 = 1
Taste = 4
elseif Pinb.1 = 1 Then
Portc.0 = 1
Taste = 3
elseif Pinb.2 = 1 Then
Portc.0 = 1
Taste = 2
elseif Pinb.3 = 1 Then
Portc.0 = 1
Taste = 1
elseif Pinb.4 = 1 Then
Portc.0 = 1
Taste = 8
elseif Pinb.5 = 1 Then
Portc.0 = 1
Taste = 7
elseif Pinb.6 = 1 Then
Portc.0 = 1
Taste = 6
elseif Pinb.7 = 1 Then
Portc.0 = 1
Taste = 5
'elseif Pina.0 = 1 Then
' Portc.0 = 1
' Taste2 = "="
'elseif Pina.1 = 1 Then
' Portc.0 = 1
' Taste2 = "C"
elseif Pina.2 = 1 Then
Portc.0 = 1
Taste = 0
elseif Pina.3 = 1 Then
Portc.0 = 1
Taste = 9
'elseif Pina.4 = 1 Then
' Portc.0 = 1
' Taste2 = "+"
'elseif Pina.5 = 1 Then
' Portc.0 = 1
' Taste2 = "-"
'elseif Pina.6 = 1 Then
' Portc.0 = 1
' Taste2 = "*"
'elseif Pina.7 = 1 Then
' Portc.0 = 1
' Taste2 = "/"
end if
if Taste = 0 then
'des geits itt
else
call ausgeben (Taste)
end if
Loop
End
Sub ausgeben(byval Impulse As Byte) 'Schrittmotor links drehen
For J = 1 To Impulse
Portc.0 = 1
waitms 200
Portc.0 = 0
waitms 200
Next
End Sub
fat32
LED unterschiedlich oft angehen. Tut sie aber nicht :-(
Was ist da los?
$regfile = "m32def.dat"
$framesize = 32
$swstack = 32
$hwstack = 32
$crystal = 1000000
Config Portc.0 = Output
Config Porta = Input
Porta = 1
Config Portb = Input
Portb = 1
Dim Taste As Integer
Dim Taste2 AS Word
Dim J AS Integer
J = 0
Declare Sub ausgeben(byval impulse As Integer)
Taste = 0
Do
if Pinb.0 = 1 Then
Portc.0 = 1
Taste = 4
elseif Pinb.1 = 1 Then
Portc.0 = 1
Taste = 3
elseif Pinb.2 = 1 Then
Portc.0 = 1
Taste = 2
elseif Pinb.3 = 1 Then
Portc.0 = 1
Taste = 1
elseif Pinb.4 = 1 Then
Portc.0 = 1
Taste = 8
elseif Pinb.5 = 1 Then
Portc.0 = 1
Taste = 7
elseif Pinb.6 = 1 Then
Portc.0 = 1
Taste = 6
elseif Pinb.7 = 1 Then
Portc.0 = 1
Taste = 5
'elseif Pina.0 = 1 Then
' Portc.0 = 1
' Taste2 = "="
'elseif Pina.1 = 1 Then
' Portc.0 = 1
' Taste2 = "C"
elseif Pina.2 = 1 Then
Portc.0 = 1
Taste = 0
elseif Pina.3 = 1 Then
Portc.0 = 1
Taste = 9
'elseif Pina.4 = 1 Then
' Portc.0 = 1
' Taste2 = "+"
'elseif Pina.5 = 1 Then
' Portc.0 = 1
' Taste2 = "-"
'elseif Pina.6 = 1 Then
' Portc.0 = 1
' Taste2 = "*"
'elseif Pina.7 = 1 Then
' Portc.0 = 1
' Taste2 = "/"
end if
if Taste = 0 then
'des geits itt
else
call ausgeben (Taste)
end if
Loop
End
Sub ausgeben(byval Impulse As Byte) 'Schrittmotor links drehen
For J = 1 To Impulse
Portc.0 = 1
waitms 200
Portc.0 = 0
waitms 200
Next
End Sub
fat32