Go to Post FIRST is an opportunity for me to tackle problems that have long been solved. - Madison [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

 
 
 
Thread Tools Rate Thread Display Modes
Prev Previous Post   Next Post Next
  #3   Spotlight this post!  
Unread 28-03-2003, 00:13
DougHogg DougHogg is offline
Robot-A-Holic
FRC #0980 (The ThunderBots)
Team Role: Coach
 
Join Date: Jan 2002
Rookie Year: 2002
Location: S. California
Posts: 324
DougHogg has much to be proud ofDougHogg has much to be proud ofDougHogg has much to be proud ofDougHogg has much to be proud ofDougHogg has much to be proud ofDougHogg has much to be proud ofDougHogg has much to be proud ofDougHogg has much to be proud of
Re: autonomous code variable?

Quote:
Originally posted by manodrum
will a WORD variable hold more than 254? i'm at a last resort of counting loops for our autonomous code so i need a counter...also if anyone has any simple autonomous code that works and would like to share, i just need to see how you worked it into the main code and detecting if auton_mode = 1
and all that jazz...
Thanks,
manodrum
Hi,

Here is some of our code.

(Warning: I am not one of the programmers.)

We have multi-bank code. See Innovation FIRST site for an explanation and example.

We have our autonomous code in bank 2.

Below is how we jump to bank 1 where our driver controlled code is, when autonomous is over.


'---------- Aliases for the Pbasic Mode Byte (PB_mode) -------------------------------
'----------------------------------------------------------------------------------------------
' Bit 7 of the PB_mode byte (aliased as comp_mode below) indicates the status
' of the Competition Control, either Enabled or Disabled. This indicates the
' starting and stopping of rounds at the competitions.
' Comp_mode is indicated by a solid "Disabled" LED on the Operator Interface.
' Comp_mode = 1 for Enabled, 0 for Disabled.
'
' Bit 6 of the PB_mode byte (aliased as auton_mode below) indicates the status
' of the Autonomous Mode, either Autonomous or Normal. This indicates when
' the robot must run on its own programming. When in Autonomous Mode, all
' OI analog inputs are set to 127 and all OI switch inputs are set to 0 (zero).
' Auton_mode is indicated by a blinking "Disabled" LED on the Operator Interface.
' Auton_mode = 1 for Autonomous, 0 for Normal.
'
' Autonomous Mode can be turned ON by setting the RC to Team 0 (zero).
'
' Bit 5 of the PB_mode byte (aliased as user_display_mode below) indicates when
' the user selects the "User Mode" on the OI. PB_mode.bit5 is set to 1 in "User Mode".
' When the user selects channel, team number, or voltage, PB_mode.bit5 is set to 0
' When in "User Mode", the eight Robot Feedback LED are turned OFF.
' Note: "User Mode" is identified by the letter u in the left digit (for 4 digit OI's)
' Note: "User Mode" is identified by decimal places on the right two digits (for 3 digit OI's)

comp_mode VAR PB_mode.bit7
auton_mode VAR PB_mode.bit6
user_display_mode VAR PB_mode.bit5


'After our autonomous routine, we wait for autonomous to end.

WaitQuitAutonomous:

do
Gosub SerialInput

' Quit autonomous mode when it's time

Gosub TestQuitAutonomous

Gosub SerialOutput
loop


TestQuitAutonomous:

' (Test if its time to run the main loop (competition code)

if auton_mode = 0 then Run 1 ' (If autonomous is turned off, we jump to bank 1 and run the driver controlled program)
if AutonomousSwitch = 0 then Run 1 ' (We have a switch on our robot which allows us to turn off autonomous mode)

' Keep going in autonomous mode
Return

Hope that helps.
__________________
FIRST Team 980, The ThunderBots
2002: S. California Rookie All Stars
2004: S. California: Regional Champion,
Championship Event: Galileo 2nd seed,
IRI: Competition Winner, Cal Games: Competition Winner
2005: Arizona: 1st seed
Silicon Valley: Regional Champion (Thanks Teams 254 and 22)
S. California: Regional Runners Up (Thanks Teams 22 and 968)

Last edited by DougHogg : 28-03-2003 at 00:17.
 


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
26 variable limit Gusman1188 Programming 9 12-02-2003 22:38
Coupling the Chiaphua & a variable Drill output Jeff Sharpe Motors 9 13-01-2003 20:21
Variable Amperage in DC Circuit. How? Jordan A. Electrical 4 01-11-2002 20:26
Dashboard programs and the char variable Ian W. Programming 13 26-06-2002 02:07
what teams have a variable transmissions? Greg Perkins Technical Discussion 4 06-03-2002 06:10


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

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