Go to Post Temp wiring is always bad but it is made worse when dealing with a $1000 part. You wouldn't try to lash a makeshift power source to your PC. - Al Skierkiewicz [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 18-12-2002, 22:32
Adam Shapiro's Avatar
Adam Shapiro Adam Shapiro is offline
Registered User
FRC #0555 (Montclair Robotics)
Team Role: Alumni
 
Join Date: Jan 2002
Rookie Year: 2001
Location: Montclair, NJ
Posts: 401
Adam Shapiro has much to be proud ofAdam Shapiro has much to be proud ofAdam Shapiro has much to be proud ofAdam Shapiro has much to be proud ofAdam Shapiro has much to be proud ofAdam Shapiro has much to be proud ofAdam Shapiro has much to be proud ofAdam Shapiro has much to be proud ofAdam Shapiro has much to be proud of
Send a message via AIM to Adam Shapiro
Else Statements!!!

Who else is annoyed about working with a language that doesn't have an else statement? I know that I, for one, can not stand having to write if statements that jump over other if statements that jump over gotos... Your thoughts?
__________________
Mentor to Teams 555, 1929, and 2070!
Currently working in hardware design at Cisco.
Cornell University DARPA Urban Challenge - http://www.cornellracing.com
Co-Captain Team 555 - 2003,2004,2005
Trust, Love, and Magic
  #2   Spotlight this post!  
Unread 18-12-2002, 22:35
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
Equivalent of else:

if <<something>> then trueLabel
<<stuff for else>>
goto endIfBlock

trueLabel:
<<trueStuff>>

endIfBlock:


It's really not that bad once you get used to it.
__________________
New C-based RoboEmu2 (code simulator) available at: http://www.robbayer.com/software.php
  #3   Spotlight this post!  
Unread 18-12-2002, 22:36
Joe Matt's Avatar
Joe Matt Joe Matt is offline
Wake Up Get Up Get Out There
no team
 
Join Date: Dec 2001
Rookie Year: 2001
Location: CAK
Posts: 5,067
Joe Matt has a reputation beyond reputeJoe Matt has a reputation beyond reputeJoe Matt has a reputation beyond reputeJoe Matt has a reputation beyond reputeJoe Matt has a reputation beyond reputeJoe Matt has a reputation beyond reputeJoe Matt has a reputation beyond reputeJoe Matt has a reputation beyond reputeJoe Matt has a reputation beyond reputeJoe Matt has a reputation beyond reputeJoe Matt has a reputation beyond repute
I'm learning it now, so yeah, it sucks. That's what AppleScript is for.
__________________
  #4   Spotlight this post!  
Unread 18-12-2002, 22:44
Adam Shapiro's Avatar
Adam Shapiro Adam Shapiro is offline
Registered User
FRC #0555 (Montclair Robotics)
Team Role: Alumni
 
Join Date: Jan 2002
Rookie Year: 2001
Location: Montclair, NJ
Posts: 401
Adam Shapiro has much to be proud ofAdam Shapiro has much to be proud ofAdam Shapiro has much to be proud ofAdam Shapiro has much to be proud ofAdam Shapiro has much to be proud ofAdam Shapiro has much to be proud ofAdam Shapiro has much to be proud ofAdam Shapiro has much to be proud ofAdam Shapiro has much to be proud of
Send a message via AIM to Adam Shapiro
I agree that it isn't that bad after a while but still, it is quite annoying. Too many goto's. I would much rather work in just about any other language where I could use else statements, not to mention code blocks (C++, etc.). On the other hand, being so simple makes PBasic extrememly easy to pick up (took me about 2 days to get it down really well...).
__________________
Mentor to Teams 555, 1929, and 2070!
Currently working in hardware design at Cisco.
Cornell University DARPA Urban Challenge - http://www.cornellracing.com
Co-Captain Team 555 - 2003,2004,2005
Trust, Love, and Magic
  #5   Spotlight this post!  
Unread 19-12-2002, 10:34
Jnadke Jnadke is offline
Go Badgers!
#0093
Team Role: Alumni
 
Join Date: Jan 2002
Location: Appleton, WI
Posts: 775
Jnadke is on a distinguished road
Send a message via ICQ to Jnadke Send a message via AIM to Jnadke Send a message via Yahoo to Jnadke
Hehe... you think this is bad? Try working on Assembly.
__________________
The best moments of our lives fall in two categories: those that did happen and those that did not.
  #6   Spotlight this post!  
Unread 19-12-2002, 13:31
Unsung FIRST Hero
Matt Leese Matt Leese is offline
Been-In-FIRST-Too-Long
FRC #1438 (The Aztechs)
Team Role: Engineer
 
Join Date: May 2001
Rookie Year: 1998
Location: Long Beach, CA
Posts: 937
Matt Leese has a reputation beyond reputeMatt Leese has a reputation beyond reputeMatt Leese has a reputation beyond reputeMatt Leese has a reputation beyond reputeMatt Leese has a reputation beyond reputeMatt Leese has a reputation beyond reputeMatt Leese has a reputation beyond reputeMatt Leese has a reputation beyond reputeMatt Leese has a reputation beyond reputeMatt Leese has a reputation beyond reputeMatt Leese has a reputation beyond repute
Send a message via AIM to Matt Leese
Quote:
Originally posted by Jnadke
Hehe... you think this is bad? Try working on Assembly.
Some of us like assembly. Then again, I suppose x86 assembly is pretty bad (4 registers and a horribly complex addressing mode) as is ARM (where you have to manually stall the pipeline as it doesn't do branch prediction).

Matt
  #7   Spotlight this post!  
Unread 19-12-2002, 15:48
Adam Shapiro's Avatar
Adam Shapiro Adam Shapiro is offline
Registered User
FRC #0555 (Montclair Robotics)
Team Role: Alumni
 
Join Date: Jan 2002
Rookie Year: 2001
Location: Montclair, NJ
Posts: 401
Adam Shapiro has much to be proud ofAdam Shapiro has much to be proud ofAdam Shapiro has much to be proud ofAdam Shapiro has much to be proud ofAdam Shapiro has much to be proud ofAdam Shapiro has much to be proud ofAdam Shapiro has much to be proud ofAdam Shapiro has much to be proud ofAdam Shapiro has much to be proud of
Send a message via AIM to Adam Shapiro
I guess that's true...I once took an attempt at assembly and gave up after only a few minutes. Maybe it just wasn't meant to be...
__________________
Mentor to Teams 555, 1929, and 2070!
Currently working in hardware design at Cisco.
Cornell University DARPA Urban Challenge - http://www.cornellracing.com
Co-Captain Team 555 - 2003,2004,2005
Trust, Love, and Magic
  #8   Spotlight this post!  
Unread 21-12-2002, 16:59
Mongoose's Avatar
Mongoose Mongoose is offline
Registered User
#0948 (Newport Robotics Group (NRG 948))
 
Join Date: Oct 2002
Location: Bellevue, WA
Posts: 45
Mongoose is an unknown quantity at this point
Send a message via AIM to Mongoose
I find it annoying that you skip over the next block of code if a condition is true. It's just not logical. You get used to it. If you really insist, there is a way for a plain old if-statement, though:

if(condition) then doStuff:
goto skipStuff
doStuff:
' Your code here
skipStuff:

Since it's winter break, I'm learning assembly right now for my TI83+ (z80 processor). It's not all that bad.
  #9   Spotlight this post!  
Unread 21-12-2002, 23:13
Adam Shapiro's Avatar
Adam Shapiro Adam Shapiro is offline
Registered User
FRC #0555 (Montclair Robotics)
Team Role: Alumni
 
Join Date: Jan 2002
Rookie Year: 2001
Location: Montclair, NJ
Posts: 401
Adam Shapiro has much to be proud ofAdam Shapiro has much to be proud ofAdam Shapiro has much to be proud ofAdam Shapiro has much to be proud ofAdam Shapiro has much to be proud ofAdam Shapiro has much to be proud ofAdam Shapiro has much to be proud ofAdam Shapiro has much to be proud ofAdam Shapiro has much to be proud of
Send a message via AIM to Adam Shapiro
How are you learning it? I'm guessing online tutorials (that's pretty much how I learned all the programming I know...). I think I'll probably take another crack at it during vacation and see what happens...wish me luck...
__________________
Mentor to Teams 555, 1929, and 2070!
Currently working in hardware design at Cisco.
Cornell University DARPA Urban Challenge - http://www.cornellracing.com
Co-Captain Team 555 - 2003,2004,2005
Trust, Love, and Magic
  #10   Spotlight this post!  
Unread 22-12-2002, 01:27
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
The basis for this jump is the machine that was in the first BASIC Stamp - the PIC from Microchip. Its only decision is a flag-test followed by a skip over the next instruction to the instruction after that. It has one register you can load, and it is busy ! The on-board RAM is set up in 'files' : 8 bit locations you assembler allows you to name, and they do get cramped.

[compare Alpha to Beta]
MOVF,W Beta 'move contents of 'file' (ram location) I call beta to W (work reg)
SUBWF,W ALPHA 'subtract W contents from 'file' I call Alpha
BTFSS CARRY ' Bit Test flag(here, a carry), Skip if carry is set
GOTO CARCLEAR ' This instruction skipped if carry was set, else jump occurs
MOV..... ' IT was set, Alpha >= Beta
......
CARCLEAR ...... 'It wasn't zero, come to this label Beta > Alpha

-or-

[do..while_not_zero loop]
MOVLW .5 'move 5 (dec) into the tiny 'working register' (W)
MOVWF Index 'move contents of W into a 'file' register I've called Index
GUTS (label)
do something
DECFSZ Index 'decrement Index, skip if dec'ing caused the zero flag to set
GOTO GUTS loops back to guts if not zero
.....

If you don't like jumping if true in PBASIC, you can alway test for a condition you know will *not* occur. You can use preprocessors, high level languages, and other artifice to get you away from the silicon (and don't the people love to), or you can have fun playing in the sand .

Last edited by Lloyd Burns : 22-12-2002 at 01:56.
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
PBASIC language syntax WizardOfAz Programming 14 30-04-2003 10:23
Hints For Rookie Programmers Noah Programming 30 20-02-2003 20:07
Contradictory FIRST Statements Gobiner Rules/Strategy 10 14-01-2003 16:12
TechnoKat Robot archiver 2001 21 24-06-2002 00:28
Logical statements or math formulas Manoel Programming 1 16-02-2002 23:29


All times are GMT -5. The time now is 05:42.

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