es geht hab zwar immer noch meine schwierig keiten mit den datentypen aber es geht hier der code der ist jetzt so gemacht das ich in der einen for next schleicf nicht merh +0.1 mach sondern nur noch ganzahlige wert sodas alles keine gleit kommas mehr brauch wer noch paar optimierungs vorschläge machen kann und will die mir nicht das ganze programm auf den kopfstelle.
Code:
      $regfile = "m16def.dat"
$crystal = 7372800
 Dim A As Double
 Dim B As Double
 Dim C As Double
 Dim Comfeld(12) As Byte
 Dim X As Long
 Dim Y As Long
 Dim Z As Double
 Dim W As Double
 Dim K As Double
 Dim M As Double
 Dim N As Double
 Dim Auflosung As Long
 Dim Xstart As Long
 Dim Ystart As Long
 Dim Zstart As Long

 Dim Xziel As Long
 Dim Yziel As Long
 Dim Zziel As Long
 Dim Zwischenwert1 As Long
 Dim Zwischenwert2 As Long
 Dim Zwischenwert3 As Long
 Dim Zwischenwert4 As Long
 Dim Zwischenwert5 As Long
 Dim Zwischenwert6 As Long
 Dim Aa As Long
 Dim Bb As Long

 Dim Xzwischenziel As Double
 Dim Yzwischenziel As Double
 Dim Zzwischenziel As Double
  Dim Realposx As Long
  Dim Realposy As Long
  Dim Realposz As Long
  Dim Stposx As Long
  Dim Stposy As Long
  Dim Stposz As Long
 Dim Motoraus As Long
 Dim Absx As Long
 Dim Absy As Long
 Dim Absz As Long
 Dim Pc1alt As Long
 Dim Pc0alt As Long
 Dim F0 As Bit
 Dim F1 As Bit : Dim F2 As Bit : Dim F3 As Bit : Dim F4 As Bit
 Dim F5 As Bit : Dim F6 As Bit : Dim F7 As Bit : Dim F8 As Bit

  Auflosung = 2
Config Porta = Output
Config Portd = Input
'Config Portd.6 = Output
Config Portc = Input
Config Portb.1 = Input
Config Portb.0 = Output
   Realposx = 1
   Realposy = 1
Realposz = 1

   'Enable

    Xziel = 120                                             '10 umdreungen
    Yziel = 30
     Porta = 255

    Portc = 255
    Stposx = 1                                              'Realposx
    Stposy = 1                                              'Realposy
    Stposz = 1                                              'Realposz


     For Aa = 0 To 20 Step 5
     Bb = Aa - 20

     Zwischenwert1 = Stposx * Bb
     Zwischenwert2 = Xziel * Aa
     Zwischenwert3 = Stposy * Bb
     Zwischenwert4 = Yziel * Aa
     Zwischenwert5 = Zwischenwert2 - Zwischenwert1          'zwischen punkt erechnungs zeug
     Zwischenwert6 = Zwischenwert4 - Zwischenwert3

     X = Zwischenwert5 / 2                                  'realpos damit ich immer vom wirklichen wert ausgehe und der fehler nicht größer wird
     Y = Zwischenwert6 / 2

     X = X / 10
     Y = Y / 10
     'X = 50.5
     Motoraus = 0
     'X = Int(x)
     X = X - Realposx
     If X = 0 Then : Porta.0 = 0 : Else : Porta.0 = 1 : End If
    Do
   If Pinc.0 = 0 Then Pc0alt = 1
   If Pinc.0 = 1 And Pc0alt = 1 Then : Pc0alt = 0 : X = X + 1 : Realposx = Realposx - 1 : End If       'pos holen

   If Pinc.1 = 0 Then Pc1alt = 1
   If Pinc.1 = 1 And Pc1alt = 1 Then : Pc1alt = 0 : X = X - 1 : Realposx = Realposx + 1 : End If       'pos holen
   If X = 0 Then : Porta.1 = 0 : Else : Porta.1 = 1 : End If

      Absx = X                                              'abs(x)

    If X > 0 Then : Porta.4 = 0 : Porta.5 = 1 : Waitus 50 : End If       'Pos anfahren
    If X < 0 Then : Porta.4 = 1 : Porta.5 = 0 : Waitus 50 : End If       'pos anfahre
    If Absx < 15 Then : Porta.4 = 0 : Porta.5 = 0 : End If
    If X = 0 Then Motoraus = Motoraus + 1
    Loop Until Motoraus = 1000                              'sicher gehen das der motor wirklich steht und keinen schwung mehr hat
    Next Aa
    Do
    Loop