Go to Post These predictions are just a bit of fun. Neither these, nor the division threads, are meant to be comprehensive. Don't like 'em? Go out there and prove them wrong! - Looking Forward [more]
Home
Go Back   Chief Delphi > Technical > Programming
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
Closed Thread
Thread Tools Rate Thread Display Modes
  #1   Spotlight this post!  
Unread 15-01-2003, 16:07
Brian48216
 
Posts: n/a
PBASIC Syntax Documentation

I am a programmer from team 623. I was wondering if there is any website/document with DEFINITIVE information on the syntax of the PBASIC programming language. I've been to Innovation First and I got the programming reference guide, but the syntax isn't explained too well. I can do some guess work by looking at the sample programs but I still need more info.

Aside from that, a have a more specific question about the MIN and MAX keywords in the sample program. What do they do exactly? Right now that is the keyword that I really need info on.

Note: Im posting under a fellow team member's name. Later, when I get my new computer, I will be posting as "EbonySeraphim."
  #2   Spotlight this post!  
Unread 15-01-2003, 16:33
Jeremy_Mc's Avatar
Jeremy_Mc Jeremy_Mc is offline
GitHubber
no team
Team Role: Mentor
 
Join Date: Feb 2002
Rookie Year: 2002
Location: Orlando, FL
Posts: 496
Jeremy_Mc will become famous soon enoughJeremy_Mc will become famous soon enough
MIN and MAX set a min and max value for a variable...

you could use it to limit how fast your motors go (like maybe you wanted them to stop for 3 seconds you could set the max and min to 127...)

i might be wrong (i'm pretty new to PBASIC) but from the samples i've looked at that's what it looks like


*jeremy
__________________
GitHub - Collaborate on code, documentation, etc. - http://github.com
  #3   Spotlight this post!  
Unread 15-01-2003, 17:21
Lloyd Burns Lloyd Burns is offline
Registered User
FRC #1246 (Agincourt Robotics)
Team Role: Engineer
 
Join Date: Jun 2001
Rookie Year: 1997
Location: Toronto
Posts: 292
Lloyd Burns is an unknown quantity at this point
MIN and MAX

These two statememts ask PBASIC to check if the result of the calculation they follow is a minimum of, ar a maximum of the stated value.

x = 30 * datav MIN 60 MAX 120

will do the operation 30 times datav, then if datav was only 1 or zero, MIN would return a value of 60. If datav is 2, 3 or 4, the result is passed through. If datav > 4 then MAX will replace the product with 120

Since the Stamp only uses integer arithmetic, there are no other values of datav to worry about. Heh heh heh, not so fast !

Some people mess it up with MIN 0. if a=4 and b=5 in your program and x = a - b MIN 0 is used, the result a-b is more than zero, because -1 is 255 in the 8-bit world. 255 passes MIN 0 with flying colours. Similarly, with byte variables, (253 + 3) MAX 256 appears to do nothing giving 1 as a result.

To work around this eight-bit under/overflow, we add 2000, so the arithmetic has to be done 16 bits wide.

x = (((a + 2000) - b) MIN 2000) - 2000

will return 0, because the result of the original subtraction was 1999, a positive integer, but it will be replaced by MIN with 2000, the MINimum allowable value.
  #4   Spotlight this post!  
Unread 15-01-2003, 18:53
Joe Ross's Avatar Unsung FIRST Hero
Joe Ross Joe Ross is offline
Registered User
FRC #0330 (Beachbots)
Team Role: Engineer
 
Join Date: Jun 2001
Rookie Year: 1997
Location: Los Angeles, CA
Posts: 8,600
Joe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond repute
The PBASIC manual is availible from Parallax. Note that this does not cover the pbasic 2.5 syntax. If you want to use that, you will need to search other posts. However, it is not necessary to use the new syntax (and things like min and max didn't change) so the manual is all your really need.
  #5   Spotlight this post!  
Unread 15-01-2003, 20:21
Greg Ross's Avatar
Greg Ross Greg Ross is offline
Grammar Curmudgeon
AKA: gwross
FRC #0330 (Beach 'Bots)
Team Role: Mentor
 
Join Date: Jun 2001
Rookie Year: 1998
Location: Hermosa Beach, CA
Posts: 2,245
Greg Ross has a reputation beyond reputeGreg Ross has a reputation beyond reputeGreg Ross has a reputation beyond reputeGreg Ross has a reputation beyond reputeGreg Ross has a reputation beyond reputeGreg Ross has a reputation beyond reputeGreg Ross has a reputation beyond reputeGreg Ross has a reputation beyond reputeGreg Ross has a reputation beyond reputeGreg Ross has a reputation beyond reputeGreg Ross has a reputation beyond repute
Send a message via AIM to Greg Ross Send a message via Yahoo to Greg Ross
The 2.5 syntax is covered in the PBASIC 2 Enhanced Syntax Notes.pdf which is in the .zip file you downloaded to get the 2.5 editor.
__________________
Greg Ross (The Grammar Curmudgeon formerly known as gwross)
S/W Engineer, Team 330, the Beach 'Bots
<--The Grammar Curmudgeon loves this cartoon.
“Life should not be a journey to the grave with the intention of arriving safely in a pretty and well preserved body, but rather to skid in broadside in a cloud of smoke, thoroughly used up, totally worn out, and loudly proclaiming "Wow! What a Ride!" Hunter S. Thompson
"Playing a practical joke means doing something mean and calling it funny." Me
Closed Thread


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
BS2 syntax (PBASIC) on the new controllers? Maybe! Jeremy_Mc Programming 0 25-10-2003 15:00
PBASIC Syntax Question Raven_Writer Programming 4 20-08-2003 08:07
PBASIC language syntax WizardOfAz Programming 14 30-04-2003 10:23
Pbasic 2.5 syntax Rickertsen2 Programming 10 15-02-2003 08:56
Another PBASIC Question Ian W. Programming 4 31-01-2002 21:36


All times are GMT -5. The time now is 04:00.

The Chief Delphi Forums are sponsored by Innovation First International, Inc.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi