Thread: variable?
View Single Post
  #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.