Go to Post Life is more fun if you take some risks every so often. - Andy Baker [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 14-01-2003, 14:33
Goya Goya is offline
Registered User
#0019 (Big Red)
 
Join Date: Jan 2003
Location: Greenwich, CT
Posts: 35
Goya is an unknown quantity at this point
Send a message via AIM to Goya
PBASIC Syntax

Quick Question - When using a DO...LOOP WHILE, is the following syntax acceptable?

Do

drive_R = 254
drive_L = 254

Loop While sForward = 1


Or do I need to use parentheses? Or possibly brackets?

Thanks in advance,
  #2   Spotlight this post!  
Unread 14-01-2003, 14:45
rbayer's Avatar Unsung FIRST Hero
rbayer rbayer is offline
Blood, Sweat, and Code
no team (Teamless Orphan)
 
Join Date: Mar 2002
Rookie Year: 2001
Location: Minnetonka, MN
Posts: 1,087
rbayer is a glorious beacon of lightrbayer is a glorious beacon of lightrbayer is a glorious beacon of lightrbayer is a glorious beacon of lightrbayer is a glorious beacon of light
Send a message via AIM to rbayer
That's just fine. It tokenizes perfectly for me.
__________________
New C-based RoboEmu2 (code simulator) available at: http://www.robbayer.com/software.php
  #3   Spotlight this post!  
Unread 14-01-2003, 14:49
Goya Goya is offline
Registered User
#0019 (Big Red)
 
Join Date: Jan 2003
Location: Greenwich, CT
Posts: 35
Goya is an unknown quantity at this point
Send a message via AIM to Goya
Hmm, well, I only tried on RoboEMU. This might be an issue. I'll try a RC soon and I'll report the results.
  #4   Spotlight this post!  
Unread 14-01-2003, 14:54
rbayer's Avatar Unsung FIRST Hero
rbayer rbayer is offline
Blood, Sweat, and Code
no team (Teamless Orphan)
 
Join Date: Mar 2002
Rookie Year: 2001
Location: Minnetonka, MN
Posts: 1,087
rbayer is a glorious beacon of lightrbayer is a glorious beacon of lightrbayer is a glorious beacon of lightrbayer is a glorious beacon of lightrbayer is a glorious beacon of light
Send a message via AIM to rbayer
One thing: syntacticly that is correct. In terms of working on an RC, it's going to give you a BASIC RUN error. To avoid this, put a SERIN and SEROUT inside the loop. Or, ditch the DO...WHILE and router everything through your normal serin and serout. I suppose a gosub could accomplish the same thing from within the DO WHILE...
__________________
New C-based RoboEmu2 (code simulator) available at: http://www.robbayer.com/software.php
  #5   Spotlight this post!  
Unread 14-01-2003, 15:32
Goya Goya is offline
Registered User
#0019 (Big Red)
 
Join Date: Jan 2003
Location: Greenwich, CT
Posts: 35
Goya is an unknown quantity at this point
Send a message via AIM to Goya
Actually, I had a GOSUB GoSerout within the Do .... Loop that I removed before posting. That didn't work because it wouldn't RETURN to my Loop, or it would accidentally hit that GoSerout during the MainLoop.

In this case, I placed a SERIN and a SEROUT within theh Do ... Loop itself. Question - Can I remove values of the SERIN, SEROUT commands that I don't use? For example, everything except PWM1 - 4?

Thanks a lot,
  #6   Spotlight this post!  
Unread 14-01-2003, 16:42
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
Quote:
Originally posted by Goya
Can I remove values of the SERIN, SEROUT commands that I don't use? For example, everything except PWM1 - 4?
I THINK you can get away with leaving off values as long as they are the last N parameters. I think the two 255s at the start of the serout will cause the RC to treat it as all good.
__________________
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
  #7   Spotlight this post!  
Unread 14-01-2003, 16:48
Ian W. Ian W. is offline
College? What?
no team (Gompei and the Herd)
Team Role: College Student
 
Join Date: Jan 2002
Rookie Year: 2002
Location: Worcester, MA | Smithtown, NY
Posts: 1,464
Ian W. is a name known to allIan W. is a name known to allIan W. is a name known to allIan W. is a name known to allIan W. is a name known to allIan W. is a name known to all
Send a message via AIM to Ian W.
the two 255's indicate the beginning of a new serout. i learned that the hard way . don't be stupid like me, make sure no 255's come in sequence after the initial ones . i also think the uP may put a 127/0 to any unused outputs, but don't count me on this one, cause i'm not 100% sure.
__________________
AIM --> Woloi
Email --> ian@woloschin.com
  #8   Spotlight this post!  
Unread 14-01-2003, 16:58
rbayer's Avatar Unsung FIRST Hero
rbayer rbayer is offline
Blood, Sweat, and Code
no team (Teamless Orphan)
 
Join Date: Mar 2002
Rookie Year: 2001
Location: Minnetonka, MN
Posts: 1,087
rbayer is a glorious beacon of lightrbayer is a glorious beacon of lightrbayer is a glorious beacon of lightrbayer is a glorious beacon of lightrbayer is a glorious beacon of light
Send a message via AIM to rbayer
Quote:
Originally posted by Ian W.
the two 255's indicate the beginning of a new serout. i learned that the hard way . don't be stupid like me, make sure no 255's come in sequence after the initial ones . i also think the uP may put a 127/0 to any unused outputs, but don't count me on this one, cause i'm not 100% sure.
You are correct.

You CAN remove stuff from the SEROUT. You CANNOT remove stuff from the serin or you will get BASIC INIT errors.

As for the gosub, it is possible, but takes some reworking of the other parts of the code. You main loop would have to be:

Do
gosub mySerin

'normal code goes here, including your loop that you posted originally.

gosub mySerout
Loop

mySerin:
Serin ...
return

mySerout:
Serout ...
return
__________________
New C-based RoboEmu2 (code simulator) available at: http://www.robbayer.com/software.php
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:29.

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