180 likes | 188 Views
Join Joe Johnson for a practical PBASIC programming workshop. Learn the fundamentals, debugging techniques, and explore example programs. Don't miss out on this informative session!
E N D
Practical PBASIC Programming Joe Johnson January 6, 2001
Agenda • Joe Johnson -- who is this guy? • The Big Picture • Before the Coding Begins • The Zen of PBASIC • Debug & Dashboard • Example Programs • Miscellany • Wrap Up
Joe Johnson • B.S. Mechanical Engineering • University of Illinois 1984 • M.S. Mechanical Engineering • Purdue University 1986 • Ph.D. Mechanical Engineering • Purdue University 1989 • Delphi (part of GM until 1999) • 1989 - Present
Joe Johnson • Chief Delphi Team Leader • 6th Year • “The Ooga Man” • “He can walk on his hands”
The Big Picture • Innovation First’s Notes: • Must use Parallax Code V1.096 (or higher when avail.) to program “SX” chip properly • Download Program in 2 places: User & Default • Addresses Potential Problem with STAMP2’s
Operator Interface CPU Radio Radio Robot Controller CPU The Big Picture (cont.) • Simplified Block Diagram 3 Digit Display Potentiometers Joy Stick Ports 1-4 Switches Discrete LED’s Dashboard Port Laptop PC Potentiometers Analog Port PWM Pins Valves Gyros Servos Switches Digital Port Relay Pins Motors STAMP2 CPU Discrete LED’s
The Big Picture (cont.) • What is your Role in the World? • CPU in a bubble • Only Indirect Contact with Outside world • Live by the rules others set and you may do great things • Break the rules and you are likely to be cut off
The Big Picture (cont.) • Quick Tour Of Parallax Software (Stampw_v1_096.exe) • Basic Icon Tour • Opening a file • Downloading a file • EEPROM Map • RAM Map
The Big Picture (cont.) • Block Diagram of Default Code Housekeeping Initialization Main Loop
Before the Coding Begins • Get Latest Manual • Version 2.0 of the Stamp Manual is worth the price • Put thought into Operator Interface and Robot Switches/Pots • Define Inputs and Outputs as soon as possible • Number your motors, pots, switches, Victors, Spikes
Before the Coding Begins (cont.) • Neat Wiring Saves time in the long run • Use number tape on everything! • Invest in many paint pens (various colors) • Design your switches & pots in from the start • Build yourself a “yellow dongle”
The Zen of PBASIC • By the Numbers • Word 0 - 64K $0000 - $FFFF • Byte 0-255 $00 - $FF • Nibble 0-15 $0 - $F • Bit 0-1 $0 - $1
The Zen of PBASIC • By the Numbers $FFFF $0000 $8000 $7FFF
The Zen of PBASIC • Min 0 -- What good is it? • () will drive you nuts -- I recommend that you learn what precedence and use it to your advantage • Force yourself to use structure -- comment your code, use Gosub calls, settle on a “style” and keep to it.
Debug & Dashboard • Dashboard is “free” • does not affect program execution • it is FREE from Innovation First • limited ability to display interesting stuff • you can role your one viewer, but … • Debug love it, hate it. • slows execution of PBASIC • can display nearly limitless information, just when you need it most
Example Programs • Cool Tricks to steal from the Default Code • Do THIS for THAT much time • Scaling Pots • Learning Pot Limits • Joystick Wheel as a Throttle • Proportional Feedback
Miscellany • ParallaxInc.com & Read the Manual • Support form other teams • HOT team (Mike Gray in particular) • The BUZZ Team • SharingFIRST web site • ChiefDelphi.com Tech Forums • Call me 248.696.5672
Wrap Up • PBASIC gives you enough rope to hang yourself • Have backup copies of program handy • Make sure the backups are current (use dates in names) • Have fall back positions • Keep your sanity • Go easy on your programmers -- pressure is very high