28107 Parallax Inc, 28107 Datasheet

KIT BOE-BOT DIGITAL ENCODER

28107

Manufacturer Part Number
28107
Description
KIT BOE-BOT DIGITAL ENCODER
Manufacturer
Parallax Inc
Datasheet

Specifications of 28107

Accessory Type
Digital Encoder
Product
Microcontroller Accessories
Lead Free Status / RoHS Status
Lead free / RoHS Compliant
For Use With/related Products
Boe-Bot®
Lead Free Status / Rohs Status
Lead free / RoHS Compliant
Sample Program (Star_Pattern.BS2)
'{$STAMP BS2}
'{$PBASIC 2.5}
'Program to traverse a 5-pointed star. Straight sections are about 25" long.
'Angle of each turn is 144-degrees. Use it to test the encoders. If the left one
'fails to function, the Boe-Bot will just continue going in a straight line
'without stopping. If the right one fails, it will continue to circle in the turn.
'Ideally, it will come to rest at the point and direction in which it started.
'But it's uncalibrated, so that's somewhat unlikely!
'---------[Constants]----------------------------------------------------------
RIGHT
LEFT
SenseR
SenseL
MotorR
MotorL
Sense
Motor
'---------[Variables]----------------------------------------------------------
Prev
New
Side
Counter
i
'---------[Program begins here.]-----------------------------------------------
PAUSE 3000
FOR i = 1 TO 5
NEXT
END
'---------[Subroutines]--------------------------------------------------------
Update:
Counter(LEFT) = 0
DO WHILE (Counter(LEFT) < 50)
LOOP
PAUSE 500
Counter(RIGHT) = 0
DO WHILE (Counter(RIGHT) < 20)
LOOP
PAUSE 500
FOR Side = RIGHT TO LEFT
NEXT
RETURN
PULSOUT MotorL, 850
PULSOUT MotorR, 650
GOSUB Update
PAUSE 20
PULSOUT MotorR, 650
GOSUB Update
PAUSE 20
New(Side) = INS.LOWBIT(Sense + Side)
IF (New(Side) ^ Prev(Side)) THEN
ENDIF
Prev(Side) = New(Side)
Counter(Side) = Counter(Side) + 1
CON 0
CON 1
PIN 10
PIN 11
PIN 12
PIN 13
CON SenseR
CON MotorR
VAR Bit(2)
VAR Bit(2)
VAR Bit
VAR Word(2)
VAR Byte
'Constants defining direction subscripts.
'Righthand encoder input.
'Lefthand encoder input. (MUST be SenseR + 1.)
'Righthand motor output.
'Lefthand motor output. (MUST be MotorR + 1.)
'Base address for encoders.
'Base address for motors.
'Previous readings from encoders.
'Current readings from encoders.
'Side index (LEFT or RIGHT).
'Pulse counters for encoders.
'FOR/NEXT index
'Time to remove finger from reset button...
'Initialize LEFT counter.
'Pulse the servos to go straight
'by 50 pulse edges (about 25").
'Update the encoder counts.
'20 ms pulse gap.
'Wait 1/2 second before turn.
'Initialize RIGHT counter.
'Pulse the RIGHT servo to turn a 40% circle.
'Update the encoder counts.
'20 ms pulse gap.
'Wait 1/2 second before next side.
'Update pulse counts from the encoders.
'Just call it often enough to catch all the
'changes.
'For both encoders...
'Read new encoder value.
'Different from last value?
'
'
Yes: Update with new value.
Update counter.
599 Menlo Drive, Suite 100 • Rocklin, CA 95765 • USA
888-512-1024 (toll-free) • 916-624-8333 • 916-624-8003 (fax)
Boe-Bot Digital
Encoder Kit
#28107
#28107
Document revision: 2005 Aug 23
support@parallax.com
www.parallax.com

Related parts for 28107

28107 Summary of contents

Page 1

... Yes: Update with new value. Counter(Side) = Counter(Side ENDIF NEXT RETURN Boe-Bot Digital Encoder Kit Update counter. 599 Menlo Drive, Suite 100 • Rocklin, CA 95765 • USA 888-512-1024 (toll-free) • 916-624-8333 • 916-624-8003 (fax) www.parallax.com #28107 #28107 support@parallax.com Document revision: 2005 Aug 23 ...

Page 2

... But try it anyway to see how close it gets. More complicated examples, including coordinated motion, X-Y position and direction odometry, calibration techniques, and the theory behind them, may be downloaded from the Parallax website at: www.parallax.com/detail.asp?product_id=28107 Direction of Motion About 0.5" ...

Related keywords