Hey Dirk,
Kannst du mir mal auf die Sprünge helfen? Ich habe jetzt einfach "Servo(1) = x" hingemacht, und lasse alle 10ms die variable auf 150 hochzählen. Doch wie kann ich sie nun wieder so runterzählen, dass es eine Endlosschleife wird?
Code:
$regfile "m16def.dat"
$crystal = 16000000
$baud = 9600
$swstack = 16
$hwstack = 16
$framesize = 16
Dim B As Word
Dim X As Byte
Dim Y As Byte
Config Portd.4 = Output
Config Portd.5 = Output
Config Porta.4 = Output
Config Porta.5 = Output
Config Porta.6 = Output
Config Portc.7 = Output
Config Portc.6 = Output
Config Portc.5 = Output
M1 Alias Porta.5
M2 Alias Porta.6
M3 Alias Portc.6
M4 Alias Portc.5
Config Portb.0 = Output
Config Servos = 1 , Servo1 = Portb.0 , Reload = 10
Enable Interrupts
X = 0
Y = 0
Do
Servo(1) = X
1:
Incr X
Waitms 10
While X = 150
Decr X
Waitms 10
Wend
While X = 50
Incr X
Waitms 10
Goto 1
Wend
Loop
Lesezeichen