Shop OBEX P1 Docs P2 Docs Learn Events
Trouble with ServoPAL — Parallax Forums

Trouble with ServoPAL

VGVG Posts: 32
edited 2009-02-23 05:42 in Propeller 1
Hi All,
··· I am using ServoPAL with my proto board to control·pan servo. jumpin.gif

1. With single pulse the ServoPAL supposed to rotate the servo.· That is not happening.·The servo is not rotating to the required position (500 to 2500). I tried different values beyond this range with no luck. I am using HiTec HS-425BB servo as well as TowerPro SG-50. No luck with either one.

2. With the repeat loop below the servo·rotates clockwise·and stops and zitters at the end. It is not reversing·for·appropriate position values.

The ServoPAL itself seems to be working fine with the BOE-Bot and the BS2 script provided.

What am I doing wrong.

Below is the code:
...
...
...
·· InitS(Pin_IrServo)· 'Initialize servo Pal
·· repeat············· ' Infinite loop
··· SetServoPos(2000)············ '·· <
··· Pause_ms(20)

·
PUB InitS(PinPAL)
· m_PinPAL := PinPAL
·
· ' Wait for ServoPAL to initialize
· dira[noparse][[/noparse]m_PinPAL]~
· repeat until ina[noparse][[/noparse]m_PinPAL] == 1
· ' Reset ServoPAL
· outa[noparse][[/noparse]m_PinPAL]~
· dira[noparse][[/noparse]m_PinPAL]~~
· Pause_ms(100)
· outa[noparse][[/noparse]m_PinPAL]~~
· Pause_ms(100)
· m_Init := true


··
PUB Release
· if m_Init
··· dira[noparse][[/noparse]m_PinPAL]~



PUB SetServoPos(pos) | pw
· if m_Init
··· pw := pos
··· SetPulseWidth(pw)
·


PUB SetPulseWidth(PulseWidth)
· if m_Init
··· outa[noparse][[/noparse]m_PinPAL]~
··· Pause_us(PulseWidth)
··· outa[noparse][[/noparse]m_PinPAL]~~

PRI Pause_ms(msDelay)
· waitcnt(cnt + ((clkfreq / 1000) * msDelay))

PRI Pause_us(usDelay)
· waitcnt(cnt + ((clkfreq / 1000000) * usDelay))···


Edit: Made corrections.

Post Edited (VG) : 2/24/2009 5:40:02 AM GMT
Sign In or Register to comment.