Problems with build of a generic ServoToggle
nomad
Posts: 276
Problems with build of a generic ServoToggle
hi,
i have a problem to build function for
a generic servotoggle
the programm leg1ServoSequencer110.spin (as attachment)
running verry good in this form.
i want change the
PUB ShoulderServo1 ' generate servopulse Servo1 (swing) Leg1 & Leg2
outa[noparse][[/noparse]0]~~
waitcnt (timebase += pulsetime1)
outa[noparse][[/noparse]0]~
outa~~
waitcnt (timebase += pulsetime4)
outa~
if ina[noparse][[/noparse]8] == 1 'if taster pulsetime + 0,1ms
pulsetime1 += (clkfreq / 100_000)
pulsetime4 += (clkfreq / 100_000)
if ina[noparse][[/noparse]9] == 1 'if taster pulsetime - 0,1ms
pulsetime1 -= (clkfreq / 100_000)
pulsetime4 -= (clkfreq / 100_000)
new_periode1 := periode1 - pulsetime1 'periodendauer - pulsdauer
new_periode4 := periode4 - pulsetime4
waitcnt (timebase += new_periode1) 'wait for periode end
waitcnt (timebase += new_periode4)
into a form of:
PUB servoToggle(Pin, Timebases, Pulsetime, Periode, New_periode)
outa[noparse][[/noparse]Pin]~~
waitcnt (timebase += Pulsetime)
outa[noparse][[/noparse]Pin]~
if UP == TRUE
Pulsetime += (clkfreq / 100_000)
if DOWN == TRUE
Pulsetime -= (clkfreq / 100_000)
New_periode := Periode - Pulsetime
waitcnt (timebase += New_periode)
calling with servoToggle(0,timebase,pulsetime1,periode1,new_periode1)
when i run the programm with this changes (servoToggle), nothing happened.
the servo hum.
every help is welcome
regards
nomad
hi,
i have a problem to build function for
a generic servotoggle
the programm leg1ServoSequencer110.spin (as attachment)
running verry good in this form.
i want change the
PUB ShoulderServo1 ' generate servopulse Servo1 (swing) Leg1 & Leg2
outa[noparse][[/noparse]0]~~
waitcnt (timebase += pulsetime1)
outa[noparse][[/noparse]0]~
outa~~
waitcnt (timebase += pulsetime4)
outa~
if ina[noparse][[/noparse]8] == 1 'if taster pulsetime + 0,1ms
pulsetime1 += (clkfreq / 100_000)
pulsetime4 += (clkfreq / 100_000)
if ina[noparse][[/noparse]9] == 1 'if taster pulsetime - 0,1ms
pulsetime1 -= (clkfreq / 100_000)
pulsetime4 -= (clkfreq / 100_000)
new_periode1 := periode1 - pulsetime1 'periodendauer - pulsdauer
new_periode4 := periode4 - pulsetime4
waitcnt (timebase += new_periode1) 'wait for periode end
waitcnt (timebase += new_periode4)
into a form of:
PUB servoToggle(Pin, Timebases, Pulsetime, Periode, New_periode)
outa[noparse][[/noparse]Pin]~~
waitcnt (timebase += Pulsetime)
outa[noparse][[/noparse]Pin]~
if UP == TRUE
Pulsetime += (clkfreq / 100_000)
if DOWN == TRUE
Pulsetime -= (clkfreq / 100_000)
New_periode := Periode - Pulsetime
waitcnt (timebase += New_periode)
calling with servoToggle(0,timebase,pulsetime1,periode1,new_periode1)
when i run the programm with this changes (servoToggle), nothing happened.
the servo hum.
every help is welcome
regards
nomad