Go to Post Teams should make it a practice to protect their Victors (all the electronics, really) from the mechanical folks, with their saws and files and stone axes... - DonRotolo [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
  #16   Spotlight this post!  
Unread 21-02-2003, 19:23
Brian_Lim's Avatar
Brian_Lim Brian_Lim is offline
Registered User
#0907 (EY Cybernetics)
 
Join Date: Jan 2002
Location: Toronto
Posts: 16
Brian_Lim is an unknown quantity at this point
Send a message via ICQ to Brian_Lim Send a message via Yahoo to Brian_Lim
sensors could be shorted

well since I was paranoid, our team taped all the touch sensor pos/neg connections to make sure they didn't short.

some simple code like this can test your sensors

if not (rc_sw1 = 1) then skip1
PWM1 = 254
skip1

just press the sensor, see if it moves PWM1, and change rc_sw1 to rc_sw2, rinse and repeat

actually found one or two that didn't work on ours

907
Brian Lim
__________________
907 is back and we won't go quietly...
brianeyci@hotmail.com
brianeyci@yahoo.ca
ICQ #:147900708
  #17   Spotlight this post!  
Unread 21-02-2003, 19:42
Jeff_Rice's Avatar
Jeff_Rice Jeff_Rice is offline
ElementisRegamusProelium
#1359
Team Role: Programmer
 
Join Date: Dec 2002
Location: Linn County
Posts: 283
Jeff_Rice will become famous soon enoughJeff_Rice will become famous soon enough
Thank you gwross. But I use 2.0. Don't want to mess with a possibly buggy compiler.

If neg_logic <> fun then you_use_twopointfive
fun = 254 - syntax_frustrations
goto end_of_code
you_use_twopointfive:
fun = 254 - syntax_frustrations - compiler_worries + normal_logic
end_of _code

Hmm.
They seem about equal. Oh well. I don't want to download another program. Until next year anyway.

Oops. Went off on a tangent. But anyway, I like converting the switches to a binary nibble. You don't have to use a byte for an analog input, and all you have to do is move their bits to their respective places in the nibble.
__________________
"He said my name is Private Andrew Malone
If you're reading this then I didn't make it home
But for every dream that's shattered another one comes true
This car was once a dream of mine now it belongs to you
And though you may take her and make her your own
You'll always be riding with Private Malone" David Ball, "Private Malone"
  #18   Spotlight this post!  
Unread 21-02-2003, 20:44
wwrye wwrye is offline
Registered User
#0057 (Leopards)
 
Join Date: Jan 2003
Location: Houston
Posts: 18
wwrye is an unknown quantity at this point
Brian, why don't you just use debug to test sensors?
  #19   Spotlight this post!  
Unread 21-02-2003, 21:26
ttedrow's Avatar
ttedrow ttedrow is offline
Herding electrons
AKA: Tim Tedrow
FRC #0281 (EnTech)
Team Role: Mentor
 
Join Date: Jan 2002
Rookie Year: 2000
Location: Greenville, SC
Posts: 165
ttedrow will become famous soon enoughttedrow will become famous soon enough
For those of you that may still be struggling with autonomous code, here is some code snippets that may help.


loopCnt VAR byte 'Loop counter Low byte
loopCntHigh VAR nib 'Loop counter High nibble

StradegyNumber VAR nib 'The Stradegy number selected on robot

Stradegy1 VAR rc_swB.bit5 ' Stradegy Selection Switch 1
Stradegy2 VAR rc_swB.bit6 ' Stradegy Selection Switch 2
Stradegy3 VAR rc_swB.bit7 ' Stradegy Selection Switch 3

loopCnt=0
loopCntHigh=0

MainLoop:

'>>>>>>>>>>>>>>>>>>> LOOP COUNTER <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
IF auton_mode THEN
IF (loopCnt + 1 > 255) THEN
loopCntHigh = loopCntHigh + 1
loopCnt = 0
ELSE
loopCnt = loopCnt + 1
ENDIF
ELSE
loopCnt = 0
loopCntHigh = 0
ENDIF

'>>>>>>>>>> STRADIGY SELECTION <<<<<<<<<<<<<<<<<<<<<<
'This section move the stradegy switches into the StradegyNumber varible for program use
StradegyNumber.Bit0 = Stradegy1
StradegyNumber.Bit1 = Stradegy2
StradegyNumber.Bit2 = Stradegy3

'>>>>>>>>>> AUTONOMOUS MODE <<<<<<<<<<<<<<<<<<<<<
IF auton_mode THEN 'Check for Autonomous mode
SELECT StradegyNumber
CASE 0
'Stradegy 0 code goes here
CASE 1
'Stradegy 1 code goes here
CASE 2
'Stradegy 2 code goes here
CASE 3
'Stradegy 3 code goes here
CASE 4
'Stradegy 4 code goes here
CASE ELSE 'Not a valid stradegy
PWM1 = 127
PWM2 = 127
ENDSELECT 'End the autonomous mode stradegy selection
ELSE 'Not in Autonomous Mode
loopCnt=0 'Reset Loop Counter when not in Autonomous Mode
loopCntHigh=0
ENDIF


Tim Tedrow
__________________
Sr. Design Engineer
Caterpillar Inc.
Greenville, SC

KD4EGM

FRC 281 Greenvillains
Infected with the FIRST virus in 2000

Yes, Chute Door!!!
  #20   Spotlight this post!  
Unread 03-03-2003, 15:47
laurence laurence is offline
Registered User
FRC #1675 (UPS)
Team Role: Engineer
 
Join Date: Jan 2002
Rookie Year: 2000
Location: Milwaukee, WI
Posts: 8
laurence is an unknown quantity at this point
Quote:
Originally posted by SuperDanman
eh, problem there is you're wasting precious bits.
(snip)

Same thing with
program1 CON 0
I see no reason for this. Just make the if statement "IF program = 0...."


Constants do not take up any extra memory or variable space. Check the Parallax manual.
They do make your code much more readable!

However, assuming the above example had a few programs (program1=0, program2=1, program3=2, etc...), it is confusing to stagger your indices like that. Starting it at program0=0 is preferred.
__________________
Laurence
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
2-week FIRST summer program @ WPI ColleenShaver General Forum 20 31-05-2009 03:02
Fried program slots? Jeff Waegelin Programming 18 19-03-2003 18:08
Ahh! Program trick confusing! archiver 2001 9 24-06-2002 02:26
Credits for FIRST program. archiver 2000 6 24-06-2002 00:16
An invitation for HS Juniors archiver 2000 0 23-06-2002 22:51


All times are GMT -5. The time now is 12:54.

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