November 22, 2024, 07:25:46 PM

News:

Be sure to checkout our Vixen interfaces in the Library forum -- if you want PC automation at near zero cost, EFX-TEK and Vixen is a great combination of tools.


Parallax ServoPAL with Prop-x controller?

Started by BigRez, October 06, 2010, 06:36:16 PM

Previous topic - Next topic

BigRez

Was wondering of the Parallax ServoPAL will work with the EFX-TEK Prop controllers so that our programs do not need to worry about pulsing/refreshing the servos.

What I'm thinking is that the PBasic program could tell the servo (or servos) which location to go to but then not have to worry about refreshing them since the ServoPAL seems to do this.  If so, this could save some program space in a prop-1 which is already close to its max program space.  (I know, I should move it over to my prop-2 but, well, I like the prop-1 so much!)

bsnut

What, I would do is order one and give a try. As, I would say the best teacher is your self 8).. I think it would work on Prop1(BS1). Here is the link for the docs on the servo pal.

http://www.parallax.com/Portals/0/Downloads/docs/prod//robo/ServoPAL_doc.pdf

I would look at stamp editor help file and should tell you if the servo pal will work or not. That is what will do when I get home from work

William Stefan
The Basic Stamp Nut

bsnut

October 06, 2010, 11:16:28 PM #2 Last Edit: October 06, 2010, 11:25:05 PM by bsnut
Mike,

I was looking at the servo pal docs and I noticed that it will work with the Prop1. I sometimes jump the gun on my posts ;D

You should be able to plug it into the Prop1 or Prop2 with no problems from what I see in the docs that I am reading.
William Stefan
The Basic Stamp Nut

BigRez

I don't know...  from what I read in the docs prior to my post, I don't think it'll work as I would like it to.  Maybe I'm just not understanding it. 

What kinda threw me though was that it requires "negative pulses" and that both servos are controlled by the same pin.  I think the same pin thing shouldn't be a problem as I'd just use a variable like pos1 and pos2 for the two servo locations, then issue the pulse commands like the following each time a servo needs to change location:

'Assuming servo is PULSOUT servo, pos1
PULSOUT servo, pos2


The negative pulse thing is what I'm not sure about.

bsnut

Mike,

You state that, the negative pulse thing is what you were not sure about. Here's, what I found out in Basic Stamp editor help file on the PULSOUT instruction.

The polarity of the pulse depends on the state of the pin before the command executes. In the example above, if pin 5 was low, PULSOUT would produce a positive pulse. If the pin was high, PULSOUT would produce a negative pulse.

If the pin is an input, the output state bit, OUT5 (PIN5 on the BS1) won't necessarily match the state of the pin. What happens then? For example: Pin 7 is an input (DIR7 = 0) and pulled high by a resistor as shown below. Suppose that pin 7 is low when we execute the instruction:
PULSOUT 7, 5                          ' generate a pulse on pin 7

The figure below shows the sequence of events on that pin. Initially, pin 7 is high. Its output driver is turned off (because it is in input mode), so the 10 kΩ resistor sets the state on the pin. When PULSOUT executes, it turns on the output driver, allowing OUT7 (PIN7 on the BS1) to control the pin.


William Stefan
The Basic Stamp Nut

JonnyMac

Mike,

You can use that with the Prop-1.   Here's a demo program I wrote when that device came out:

' =========================================================================
'
'   File...... ServoPAL.BS1
'   Purpose... Demo program for the Parallax ServoPal module (#28824)
'   Author.... Jon Williams, EFX-TEK
'              Copyright (c) 2008 EFX-TEK
'              Some Rights Reserved
'              -- see http://creativecommons.org/licenses/by/3.0/
'   E-mail.... jwilliams@efx-tek.com
'   Started...
'   Updated...
'
'   {$STAMP BS1}
'   {$PBASIC 1.0}
'
' =========================================================================


' -----[ Program Description ]---------------------------------------------


' -----[ Revision History ]------------------------------------------------


' -----[ I/O Definitions ]-------------------------------------------------

SYMBOL  Sio             = 7                     ' SETUP = out; no ULN
SYMBOL  Trigger         = PIN6                  ' SETUP = DN
SYMBOL  SPInp           = PIN1                  ' SP status in
SYMBOL  SPCmd           = 1                     ' for pulse outputs
SYMBOL  SPAlarm         = PIN0                  ' SP alarm in



' -----[ Constants ]-------------------------------------------------------

SYMBOL  IsOn            = 1                     ' for active-high in/out
SYMBOL  IsOff           = 0

SYMBOL  Baud            = OT2400


' -----[ Variables ]-------------------------------------------------------

SYMBOL  pos1            = B2                    ' 50 to 250
SYMBOL  pos2            = B3

SYMBOL  alarmSet        = W5                    ' each unit = 0.5 seconds


' -----[ Initialization ]--------------------------------------------------

Reset:
  INPUT SPCmd
  IF SPInp = 0 THEN Reset                       ' wait for ServoPal

  DEBUG "SP alive", CR

  LOW SPCmd                                     ' reset the ServoPal
  PAUSE 100
  HIGH SPCmd

  DEBUG "SP reset -- sending commands", CR


' -----[ Program Code ]----------------------------------------------------

Main:
  pos1 = 150
  pos2 = 150
  alarmSet = 10                                  ' 5 seconds
  GOSUB Update_Servos
  GOSUB Wait_For_Alarm

  pos1 = 125
  pos2 = 125
  alarmSet = 10
  GOSUB Update_Servos
  GOSUB Wait_For_Alarm

  pos1 = 175
  pos2 = 175
  alarmSet = 10
  GOSUB Update_Servos
  GOSUB Wait_For_Alarm

  GOTO Main


' -----[ Subroutines ]-----------------------------------------------------

Update_Servos:
  PULSOUT SPCmd, pos1
  PULSOUT SPCmd, pos2
  PULSOUT SPCmd, alarmSet
  RETURN

' -------------------------------------------------------------------------

' Use only if alarm has been configured

Wait_For_Alarm:
  IF SPAlarm = 0 THEN Wait_For_Alarm
  DEBUG "Alarm detected", CR
  RETURN

' -------------------------------------------------------------------------


' -----[ User Data ]-------------------------------------------------------
Jon McPhalen
EFX-TEK Hollywood Office