View Single Post
  #4   Spotlight this post!  
Unread 17-05-2005, 12:15
Joe Johnson's Avatar Unsung FIRST Hero
Joe Johnson Joe Johnson is offline
Engineer at Medrobotics
AKA: Dr. Joe
FRC #0088 (TJ2)
Team Role: Engineer
 
Join Date: May 2001
Rookie Year: 1996
Location: Raynham, MA
Posts: 2,642
Joe Johnson has a reputation beyond reputeJoe Johnson has a reputation beyond reputeJoe Johnson has a reputation beyond reputeJoe Johnson has a reputation beyond reputeJoe Johnson has a reputation beyond reputeJoe Johnson has a reputation beyond reputeJoe Johnson has a reputation beyond reputeJoe Johnson has a reputation beyond reputeJoe Johnson has a reputation beyond reputeJoe Johnson has a reputation beyond reputeJoe Johnson has a reputation beyond repute
Re: BASIC programming

Quote:
Originally Posted by Pat Fairbank
...
Here's the official Basic Stamp Reference Manual which documents all of the BASIC commands.
....
I concur.

To be honest, most of the PBASIC language is non-standard BASIC. Knowing BASIC is more of a hindrance than a help sometimes.

Read the PBASIC manual and you'll be off to a good start.

Some advice.

Forget/ignore the PBASIC manual that has anything to do with direct management of the I/O pins. They are pretty much useless because the RC more or less limited the pins of the STAMP2 to those talking to the Master CPU, The Programming Port (actually not a bad way to get a peripheral to talk to the STAMP2 program via RS-232) and some pins that more or less just turned on LEDs.

Get used to the PBASIC line processing method and avoid using too many parentheses. After coding for a while, I would end up with so many layers of nested ('s and )'s that the code was untouchable. Things got better from me once I decided to go with the Zen of PBASIC rather than fighting it.

Know the ins and outs of 16 bit unsigned math. It is a beast that will bite you in unseemly places at exactly the wrong moment. I can't tell you how many strange robot quirks were tracked down to some 16 bit overflow that only happens when the phase of the moon is just right and the tide is high and the robot driver's middle name has a T in it ;-)

Good luck.

Joe J.
__________________
Joseph M. Johnson, Ph.D., P.E.
Mentor
Team #88, TJ2

Last edited by Joe Johnson : 17-05-2005 at 12:17.