Hier mal der erste Code:

Code:
$regfile = "m128def.dat"
$framesize = 42
$swstack = 32
$hwstack = 32
$crystal = 14745600

Encoderled Alias Portb.0
Config Encoderled = Output

Frontled Alias Portc.4
Config Frontled = Output

Frontlled Alias Portc.3
Config Frontlled = Output

Frontrled Alias Portc.2
Config Frontrled = Output

Backlled Alias Portc.1
Config Backlled = Output

Backrled Alias Portc.0
Config Backrled = Output

Buzzer Alias Portb.4
Config Buzzer = Output

Taster Alias Pine.4
Config Taster = Input
Porte.4 = 1




Frontled = 1
Frontlled = 1
Frontrled = 1
Backlled = 1
Backrled = 1
Encoderled = 0

Declare Sub Lineled(byval Status As Byte)
Declare Sub Flled(byval Status As Byte)
Declare Sub Frled(byval Status As Byte)
Declare Sub Blled(byval Status As Byte)
Declare Sub Brled(byval Status As Byte)
Declare Sub Encled(byval Status As Byte)
Declare Sub Bruzzer(byval Ton As Byte , Byval Laenge As Byte)
Declare Sub Intodometrie()
Declare Function Getmicro() As Word
Declare Function Getlsl() As Word
Declare Function Getlsr() As Word
Declare Function Getlinel() As Word
Declare Function Getliner() As Word
Declare Function Getakku() As Word
Dim Encleft As Integer
Dim Encright As Integer



Do

Call Bruzzer(0 , 120)

Loop




End









Sub Lineled(byval Status As Byte)


If Status = 1 Then

   Frontled = 0

   Elseif Status = 0 Then

    Frontled = 1
    End If

End Sub




Sub Flled(byval Status As Byte)

If Status = 1 Then

   Frontlled = 0

   Elseif Status = 0 Then

   Frontlled = 1

 End If

End Sub





Sub Frled(byval Status As Byte)

   If Status = 1 Then

   Frontrled = 0

   Elseif Status = 0 Then

   Frontrled = 1

   End If

End Sub




 Sub Blled(byval Status As Byte)
  If Status = 1 Then
  Backlled = 0
  Elseif Status = 0 Then
  Backlled = 1
  End If

End Sub




Sub Brled(byval Status As Byte)

If Status = 1 Then
Backrled = 0
Elseif Status = 0 Then
Backrled = 1
End If
End Sub

Sub Encled(byval Status As Byte)
If Status = 1 Then
Encoderled = 1
Elseif Status = 0 Then
Encoderled = 1
End If

End Sub



Sub Intodometrie()

Encleft = 0
Encright = 0
Call Encled(1)
On Int7 Encoleft
On Int6 Encoright
Config Int7 = Falling
Config Int6 = Falling
Enable Int7
Enable Int6
Enable Interrupts
End Sub

Sub Bruzzer(byval Ton As Byte , Laenge As Byte)
Dim Count As Byte
For Count = 1 To Laenge
Config Timer0 = Timer , Prescale = 8
Timer0 = Ton
On Ovf0 On_ovf0
Enable Ovf0
Enable Interrupts
Waitms 5
Next Laenge
End Sub



Function Getmicro()
Config Adc = Single , Prescaler = Auto , Reference = Avcc
Start Adc
Getmicro = Getadc(3)
End Function

Function Getlsl()
Config Adc = Single , Prescaler = Auto , Reference = Avcc
Start Adc
Getlsl = Getadc(4)
End Function

Function Getlsr()
Config Adc = Single , Prescaler = Auto , Reference = Avcc
Start Adc
Getlsr = Getadc(5)
End Function

Function Getlinel()
Config Adc = Single , Prescaler = Auto , Reference = Avcc
Start Adc
Getlinel = Getadc(1)
End Function

Function Getliner()
Config Adc = Single , Prescaler = Auto , Reference = Avcc
Start Adc
Getliner = Getadc(2)
End Function

Function Getakku()
Config Adc = Single , Prescaler = Auto , Reference = Avcc
Start Adc
Getakku = Getadc(0)
End Function

Encoleft:
Encleft = Encleft + 1
Return

Encoright:
Encright = Encright + 1
Return


On_ovf0:
   Toggle Buzzer
Return
@bitram nein mich nerft einfach die IDE