Propeller Control Board (28205) Source Codes
Hello Everyone,
This is my first post on the boards, and I'm fairly new to robotics. Currently, I have experience with one other robotic platform (Ridgesoft's Intellibrain) and I was looking to get into something a little more advanced that was also more flexible. My University picked up the Propeller Control Board (28205), and I'm having a hard time using it. I have only been successful in using the LCD screen, and haven't been able to get any other compents to work (GPS, Servos, etc etc). I've read almost the entire manual for the Propeller Manual and am having problems with the Spin language. Could someone post a few examples for the Propeller Control Board (28205), and more specifically a simple code that will make a servo that is hooked up to the Servo 0 position on the board?
Thanks for the help!
-Jimmy
This is my first post on the boards, and I'm fairly new to robotics. Currently, I have experience with one other robotic platform (Ridgesoft's Intellibrain) and I was looking to get into something a little more advanced that was also more flexible. My University picked up the Propeller Control Board (28205), and I'm having a hard time using it. I have only been successful in using the LCD screen, and haven't been able to get any other compents to work (GPS, Servos, etc etc). I've read almost the entire manual for the Propeller Manual and am having problems with the Spin language. Could someone post a few examples for the Propeller Control Board (28205), and more specifically a simple code that will make a servo that is hooked up to the Servo 0 position on the board?
Thanks for the help!
-Jimmy

Comments
For reverse engineering code, take a look in the object exchange (obex.parallax.com) for source code to do all sorts of stuff, including what you want. You'll have to change the pin numbers, but that's about it.
I'll give a very simple set up. Using The Propeller Control Board, I have a parallax continuous rotation servo hooked up to servo position 0. I'm just looking for a chunk of code that will make the thing spin.
I've tried this by creating a motor object from servo4.spin and Servo32v3.spin, and I just haven't gotten anywhere.
Thanks,
-Jimmy
CON _xinfreq = 5_000_000 _clkmode = xtal1 | pll16x CLS = 16, CRSRX = 14, CLREOL = 11 VAR long uS OBJ debug : "FullDuplexSerialPlus" PUB TestIr | servoPin, servo, counter 'Set Pin values servoPin := 11 'For testing, set the pulse value servo := 1500 uS := clkfreq / 1_000_000 'Start serial communication, and wait 6 s for Parallax Serial Terminal connection. debug.Start(31, 30, 0, 57600) waitcnt(clkfreq*6 + cnt) debug.str(string("Begin rotation")) repeat counter from 0 to 500 servoProcess(servoPin, 1500 + counter) waitcnt(clkfreq/1000*20 + cnt) debug.str(string("Done")) repeat PRI servoProcess(pin, length) | w outa[noparse][[/noparse]pin]~ dira[noparse][[/noparse]pin]~~ w := length * uS outa[noparse][[/noparse]pin]~~ ' If pulse width is non-zero waitcnt(w + cnt) ' produce the requested pulse outa[noparse][[/noparse]pin]~I changed the ServoPin values, and still got nothing.
I included a picture of the setup. You can clearly see the servo is plugged into Servo Port #0. The other attachment on the board is the LCD screen, which is hooked into Aux Connection #19
{{ ┌──────────────────────────────────────────┐ │ Servo4017_v1.0.spin │ │ Author: Parallax, Inc. │ │ Copyright (c) 2008 Parallax, Inc. │ │ See end of file for terms of use. │ └──────────────────────────────────────────┘ ┌──────────────────────────────────────────────────────────────────────────────┐ │ Controls up to 8 servos using two Propeller I/O pins and a Johnson decade │ │ counter (4017 or similar) IC. Requires one available cog and two I/O pins. │ └──────────────────────────────────────────────────────────────────────────────┘ Schematic:   10KΩ │┌────────┐ │ └┤VDD Q1├─ Servo 0 MRPin ─┻──────┤MR Q2├─ Servo 1 CPPin ────────┤CP0 Q3├─ Servo 2 │ Q4├─ Servo 3 │ Q5├─ Servo 4 │ Q6├─ Servo 5 ┌─┤!CP1 Q7├─ Servo 6 ├─┤VSS Q8├─ Servo 7 │ └────────┘  Usage: • Connect the CP0 and MR pins from a 4017 to two different Propeller I/O pins and connect !CP1 to Vss • Call Start(CP0, MR) where 'CP' and 'MR' are the Propeller I/O pins that are respectively connected to CP0 and MR of the 4017 • Call Set(Servo, Position) where 'Servo' is a number from 0 to 7 indicating which servo will be moved and 'Position' is a number from 60_000 to 180_000 indicating the position to which the servo will be moved. • Call Enable(n) to enable all servos from 1 to 'n' }} CON _clkmode = xtal1 + pll16x _xinfreq = 5_000_000 MINTIME = 60_000 CENTER = 120_000 MAXTIME = 180_000 PERIOD = 80_000_000 / 50 VAR long Enabled long Cog long CP long MR long Address long ServoData[noparse][[/noparse]8] long Stack[noparse][[/noparse]40] PUB Start(CPPin, MRPin) | Index 'Launch the servo engine in a new cog CP := CPPin MR := MRPin Enabled := 0 repeat Index from 0 to 7 ServoData[noparse][[/noparse]Index] := CENTER return Cog := cognew(RunServos, @Stack) PUB Stop 'Stop the currently running cog, if any if !Cog cogstop(Cog) PUB Enable(Number) 'Enable servos 0 through 'Number' Enabled := Number PUB Set(Number, Value) 'Set the position of servo 'Number' to 'Value' if MINTIME =< Value and Value =< MAXTIME and 0 =< Number and Number =< 7 return ServoData[noparse][[/noparse]Number] := Value PRI RunServos | Index, NextCNT, StartTime, Iterations outa[noparse][[/noparse]MR]~~ 'Initialize pin states outa[noparse][[/noparse]CP]~ dira[noparse][[/noparse]MR]~~ dira[noparse][[/noparse]CP]~~ NextCNT := MINTIME + cnt 'Initialize NextCNT value repeat StartTime := NextCNT 'Reset StartTime value Iterations := Enabled 'Set number of iterations if 1 =< Iterations and Iterations =< 8 outa[noparse][[/noparse]MR]~ 'Ensure that the 4017 is held in not reset repeat Index from 0 to Iterations - 1 outa[noparse][[/noparse]CP]~ 'Falling edge is ignored waitcnt(NextCNT) 'Wait for width of current pulse outa[noparse][[/noparse]CP]~~ 'End current and start next servo pulse NextCNT += ServoData[noparse][[/noparse]Index] outa[noparse][[/noparse]CP]~ 'End of the last pulse waitcnt(NextCNT) 'Hold the 4017 in reset until outa[noparse][[/noparse]MR]~~ 'the next pulse train starts NextCNT := StartTime + PERIODWhen I loaded the following code, some weird stuff happened. The first time I loaded it, the wheel spun successfully. Without changing anything in the code, the blue LED on the board, the LCD screen's backlight, and the servo
will all turn on and off at the same time. They will be turned on just enough to notice, and then cut off for about 2 seconds.
CON _clkmode = xtal1 + pll16x _xinfreq = 5_000_000 OBJ servo : "Servo4017_v1.0" lcd : "Serial_Lcd" PUB Main lcd.init(19, 19200, 2) lcd.backLight(true) lcd.cls lcd.str(string("Testing")) servo.Start(22, 23) servo.Set(0, 180_000) servo.Enable(7) lcd.finalize▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Paul Baker
The batteries were almost dead. That solved the problem. At least the servos are spinning with that code.
Thanks guys
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Paul Baker