hmmmm......glaube das Programm gibt keinen sinn würde das anders schreiben, du wiederholst dich auch in dem Programm


mach das eher sodie Pins musste dann so an passen wie du sie hast)
Code:
$regfile = "m32def.dat" 
$crystal = 7372800

'pwm

Config Timer1 = Pwm , Pwm = 8 , Compare A Pwm = Clear Down ,compare B Pwm = Clear Down , Prescale = 8

dim z as word

'richtung
Config Pind.5 = Output
links alias portd.5
config pind.4  =output
rechts alias portd.4

do
  links = 0                                            ' PD.4 ist aus
  rechts = 1                                            ' PD.5 ist an
  Pwm1a = Z                                                 ' pwm1a(pinb.1) = a
   Z = 170
  
loop
end

probiers mal so vielleicht klappt es ja.

gruß
patrick