Go to Post Unsure if I'll get it to work, but that's no reason to not try. - DonRotolo [more]
Home
Go Back   Chief Delphi > Old Forum Archives > 2001
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
 
 
Thread Tools Rate Thread Display Modes
  #1   Spotlight this post!  
Unread 24-06-2002, 00:53
archiver archiver is offline
Forum Archival System
#0047 (ChiefDelphi)
 
Join Date: May 2001
Location: Pontiac, MI
Posts: 21,214
archiver has a reputation beyond reputearchiver has a reputation beyond reputearchiver has a reputation beyond reputearchiver has a reputation beyond reputearchiver has a reputation beyond reputearchiver has a reputation beyond reputearchiver has a reputation beyond reputearchiver has a reputation beyond reputearchiver has a reputation beyond reputearchiver has a reputation beyond reputearchiver has a reputation beyond repute
PBASIC HELP, ASAP!!

Posted by bill whitley at 2/14/2001 5:39 PM EST


Student on team #70, Auto City Bandits, from Powers Catholic High School and Kettering University.



Can anyone double check this code? Tell me if it will work.

if p3_wheel > 240 then relay5_fwd = 1

if p3_wheel 240 then JUMP2
relay5_fwd = 0
relay5_rev = 0

JUMP2:

if p4_wheel > 240 then relay6_fwd = 1

if p4_wheel 240 then JUMP3
relay6_fwd = 0
relay6_rev = 0

JUMP3:

I am concerned about ending the IF THEN statements.


__________________
This message was archived from an earlier forum system. Some information may have been left out. Start new discussion in the current forums, and refer back to these threads when necessary.
  #2   Spotlight this post!  
Unread 24-06-2002, 00:53
archiver archiver is offline
Forum Archival System
#0047 (ChiefDelphi)
 
Join Date: May 2001
Location: Pontiac, MI
Posts: 21,214
archiver has a reputation beyond reputearchiver has a reputation beyond reputearchiver has a reputation beyond reputearchiver has a reputation beyond reputearchiver has a reputation beyond reputearchiver has a reputation beyond reputearchiver has a reputation beyond reputearchiver has a reputation beyond reputearchiver has a reputation beyond reputearchiver has a reputation beyond reputearchiver has a reputation beyond repute
MORE PBASIC HELP, ASAP!!

Posted by bill whitley at 2/14/2001 5:43 PM EST


Student on team #70, Auto City Bandits, from Powers Catholic High School and Kettering University.


In Reply to: PBASIC HELP, ASAP!!
Posted by bill whitley on 2/14/2001 5:39 PM EST:



By default, does joystick 1 (y axis) control PWM 1?
also, do joysticks 2-4 operate the same way? (y axis controls PWM?)

Bill
Team #70
"Who needs an EE or CE when you have chiefdelphi.com?"


__________________
This message was archived from an earlier forum system. Some information may have been left out. Start new discussion in the current forums, and refer back to these threads when necessary.
  #3   Spotlight this post!  
Unread 24-06-2002, 00:53
archiver archiver is offline
Forum Archival System
#0047 (ChiefDelphi)
 
Join Date: May 2001
Location: Pontiac, MI
Posts: 21,214
archiver has a reputation beyond reputearchiver has a reputation beyond reputearchiver has a reputation beyond reputearchiver has a reputation beyond reputearchiver has a reputation beyond reputearchiver has a reputation beyond reputearchiver has a reputation beyond reputearchiver has a reputation beyond reputearchiver has a reputation beyond reputearchiver has a reputation beyond reputearchiver has a reputation beyond repute
EVEN MORE PBASIC HELP, ASAP!!

Posted by bill whitley at 2/14/2001 5:47 PM EST


Student on team #70, Auto City Bandits, from Powers Catholic High School and Kettering University.


In Reply to: MORE PBASIC HELP, ASAP!!
Posted by bill whitley on 2/14/2001 5:43 PM EST:



Is this necessary???

PWM1 = p1_y
PWM2 = p2_y
PMW3 = p3_y
PWM4 = p4_y

Do we need to define PWM1 as a var byte?


__________________
This message was archived from an earlier forum system. Some information may have been left out. Start new discussion in the current forums, and refer back to these threads when necessary.
  #4   Spotlight this post!  
Unread 24-06-2002, 00:53
archiver archiver is offline
Forum Archival System
#0047 (ChiefDelphi)
 
Join Date: May 2001
Location: Pontiac, MI
Posts: 21,214
archiver has a reputation beyond reputearchiver has a reputation beyond reputearchiver has a reputation beyond reputearchiver has a reputation beyond reputearchiver has a reputation beyond reputearchiver has a reputation beyond reputearchiver has a reputation beyond reputearchiver has a reputation beyond reputearchiver has a reputation beyond reputearchiver has a reputation beyond reputearchiver has a reputation beyond repute
Re: EVEN MORE PBASIC HELP, ASAP!!

Posted by Joe Ross at 2/14/2001 6:22 PM EST


Engineer on team #330, Beach Bot, from Hope Chapel Academy and NASA/JPL , J&F Machine, and Raytheon.


In Reply to: EVEN MORE PBASIC HELP, ASAP!!
Posted by bill whitley on 2/14/2001 5:47 PM EST:



: Is this necessary???

: PWM1 = p1_y
: PWM2 = p2_y
: PMW3 = p3_y
: PWM4 = p4_y

: Do we need to define PWM1 as a var byte?

If you are using the default program then you don't need to do this. It is handled in the serout command.


__________________
This message was archived from an earlier forum system. Some information may have been left out. Start new discussion in the current forums, and refer back to these threads when necessary.
  #5   Spotlight this post!  
Unread 24-06-2002, 00:53
archiver archiver is offline
Forum Archival System
#0047 (ChiefDelphi)
 
Join Date: May 2001
Location: Pontiac, MI
Posts: 21,214
archiver has a reputation beyond reputearchiver has a reputation beyond reputearchiver has a reputation beyond reputearchiver has a reputation beyond reputearchiver has a reputation beyond reputearchiver has a reputation beyond reputearchiver has a reputation beyond reputearchiver has a reputation beyond reputearchiver has a reputation beyond reputearchiver has a reputation beyond reputearchiver has a reputation beyond repute
Re: EVEN MORE PBASIC HELP, ASAP!!

Posted by Stephen at 2/14/2001 10:15 PM EST


Other on team #122, NASA Knights, from Grafton High School (Robotics team is at NHGS) and NASA.


In Reply to: EVEN MORE PBASIC HELP, ASAP!!
Posted by bill whitley on 2/14/2001 5:47 PM EST:



I recomend you not make PWM1(or any PWM) a variable. It just, simply put, wastes those 26 variables. Just go to the serout command, and where PWM1 is, just put p1_y. This also works for other things, I'll give you one more example. We have a servo, that will be 156 when nothing is pressed (closed position), and 10 when p1_sw_top is pressed (open position), instead of wasting a variable and putting an again wasteful if loop in, I just went to the serout command, and at PWM4 wrote
((p1_sw_top ^ 1)*146)+10
hope that helped, if you need any more help, feel free to e-mail me at Steven3554@yahoo.com
: Is this necessary???

: PWM1 = p1_y
: PWM2 = p2_y
: PMW3 = p3_y
: PWM4 = p4_y

: Do we need to define PWM1 as a var byte?


__________________
This message was archived from an earlier forum system. Some information may have been left out. Start new discussion in the current forums, and refer back to these threads when necessary.
  #6   Spotlight this post!  
Unread 24-06-2002, 00:53
archiver archiver is offline
Forum Archival System
#0047 (ChiefDelphi)
 
Join Date: May 2001
Location: Pontiac, MI
Posts: 21,214
archiver has a reputation beyond reputearchiver has a reputation beyond reputearchiver has a reputation beyond reputearchiver has a reputation beyond reputearchiver has a reputation beyond reputearchiver has a reputation beyond reputearchiver has a reputation beyond reputearchiver has a reputation beyond reputearchiver has a reputation beyond reputearchiver has a reputation beyond reputearchiver has a reputation beyond repute
Something to be said for readable code...

Posted by Nate Smith at 2/15/2001 12:02 PM EST


Other on team #66, Frostbite, from Willow Run High School and GM Powertrain.


In Reply to: Re: EVEN MORE PBASIC HELP, ASAP!!
Posted by Stephen on 2/14/2001 10:15 PM EST:



: I recomend you not make PWM1(or any PWM) a variable. It just, simply put, wastes those 26 variables. Just go to the serout command, and where PWM1 is, just put p1_y. This also works for other things, I'll give you one more example. We have a servo, that will be 156 when nothing is pressed (closed position), and 10 when p1_sw_top is pressed (open position), instead of wasting a variable and putting an again wasteful if loop in, I just went to the serout command, and at PWM4 wrote
: ((p1_sw_top ^ 1)*146)+10

While I agree that in some cases, it is easiest to just put the variable(in the case of PWM1 = p1_y) or maybe a SHORT formula directly in the serout command, I've also seen some code in my workings with the Innovation First controller that takes several lines to accomplish(i.e. smooth the joystick input, implement a dead zone, etc., etc...) that would be a NIGHTMARE to try and code all into the serout. And even if it can be shortened enough to warrant putting it in the serout, which is easier to quickly understand(i.e. making a quick fix between matches)?

- PWM4 = ((p1_sw_top ^ 1) * 148)+10

OR
- serout USERCPU,OUTBAUD, [255,255,p1_y,relayA,p2_y,p3_y,((p1_sw_top ^ 1) * 148)+10,p4_y,p1_x,p2_x,p3_x,p4_x,p1_wheel,p2_wheel ,p3_wheel,p4_wheel,127,127,127,127]

As a 3rd semester CS major, I have very quickly learned the importance of easy-to-understand code, even if it results in a slightly larger or smaller program.

Just my thoughts...

Nate

__________________
This message was archived from an earlier forum system. Some information may have been left out. Start new discussion in the current forums, and refer back to these threads when necessary.
  #7   Spotlight this post!  
Unread 24-06-2002, 00:53
archiver archiver is offline
Forum Archival System
#0047 (ChiefDelphi)
 
Join Date: May 2001
Location: Pontiac, MI
Posts: 21,214
archiver has a reputation beyond reputearchiver has a reputation beyond reputearchiver has a reputation beyond reputearchiver has a reputation beyond reputearchiver has a reputation beyond reputearchiver has a reputation beyond reputearchiver has a reputation beyond reputearchiver has a reputation beyond reputearchiver has a reputation beyond reputearchiver has a reputation beyond reputearchiver has a reputation beyond repute
Re: Something to be said for readable code...

Posted by Stephen at 2/15/2001 6:26 PM EST


Other on team #122, NASA Knights, from Grafton High School (Robotics team is at NHGS) and NASA.


In Reply to: Something to be said for readable code...
Posted by Nate Smith on 2/15/2001 12:02 PM EST:



I agree with you in that one should write clean code, but when one starts to run out of the alloted 26 variables, clean code becomes less important and working code becomes the major line of thought. Just my opinions, I don't know what they teach to CS majors (I'm only a freshman in highschool), but I imagine that when they do teach you things, they don't teach them on the premise that you are restricted in your variable space.


__________________
This message was archived from an earlier forum system. Some information may have been left out. Start new discussion in the current forums, and refer back to these threads when necessary.
  #8   Spotlight this post!  
Unread 24-06-2002, 00:53
archiver archiver is offline
Forum Archival System
#0047 (ChiefDelphi)
 
Join Date: May 2001
Location: Pontiac, MI
Posts: 21,214
archiver has a reputation beyond reputearchiver has a reputation beyond reputearchiver has a reputation beyond reputearchiver has a reputation beyond reputearchiver has a reputation beyond reputearchiver has a reputation beyond reputearchiver has a reputation beyond reputearchiver has a reputation beyond reputearchiver has a reputation beyond reputearchiver has a reputation beyond reputearchiver has a reputation beyond repute
Re: Something to be said for readable code...

Posted by Nate Smith at 2/15/2001 6:55 PM EST


Other on team #66, Frostbite, from Willow Run High School and GM Powertrain.


In Reply to: Re: Something to be said for readable code...
Posted by Stephen on 2/15/2001 6:26 PM EST:



: I agree with you in that one should write clean code, but when one starts to run out of the alloted 26 variables, clean code becomes less important and working code becomes the major line of thought. Just my opinions, I don't know what they teach to CS majors (I'm only a freshman in highschool), but I imagine that when they do teach you things, they don't teach them on the premise that you are restricted in your variable space.

Actually, a project that I had in my assembler class last semester was half graded based on size, with the smallest program getting all the points, and then going from there...you'd be surprised what ideas people came up with in order to shave a few bytes off their programs...

And a little more on topic, remember that you don't necessarily have 26 variables, but rather 26 bytes....so if you can get away with using a nibble or even a bit for something(not a PWM output obviously, but for some other things) then that gives you a little more room to play with...and don't forget those ever-helpful aliases...

Nate
__________________
This message was archived from an earlier forum system. Some information may have been left out. Start new discussion in the current forums, and refer back to these threads when necessary.
  #9   Spotlight this post!  
Unread 24-06-2002, 00:53
archiver archiver is offline
Forum Archival System
#0047 (ChiefDelphi)
 
Join Date: May 2001
Location: Pontiac, MI
Posts: 21,214
archiver has a reputation beyond reputearchiver has a reputation beyond reputearchiver has a reputation beyond reputearchiver has a reputation beyond reputearchiver has a reputation beyond reputearchiver has a reputation beyond reputearchiver has a reputation beyond reputearchiver has a reputation beyond reputearchiver has a reputation beyond reputearchiver has a reputation beyond reputearchiver has a reputation beyond repute
Re: EVEN MORE PBASIC HELP, ASAP!!

Posted by Dung Cao at 2/15/2001 7:59 AM EST


Engineer on team #397 from Flint Southwestern Academy and Delphi Automotive - E&C.


In Reply to: EVEN MORE PBASIC HELP, ASAP!!
Posted by bill whitley on 2/14/2001 5:47 PM EST:



I just notice that you are in the Flint area. There are 6 teams in the area more than willing to help. I'm from team 397 (also in Flint). Email me or the team and we'll provide any assitance with programming you may have.

dung.cao@delphiauto.com


__________________
This message was archived from an earlier forum system. Some information may have been left out. Start new discussion in the current forums, and refer back to these threads when necessary.
  #10   Spotlight this post!  
Unread 24-06-2002, 00:53
archiver archiver is offline
Forum Archival System
#0047 (ChiefDelphi)
 
Join Date: May 2001
Location: Pontiac, MI
Posts: 21,214
archiver has a reputation beyond reputearchiver has a reputation beyond reputearchiver has a reputation beyond reputearchiver has a reputation beyond reputearchiver has a reputation beyond reputearchiver has a reputation beyond reputearchiver has a reputation beyond reputearchiver has a reputation beyond reputearchiver has a reputation beyond reputearchiver has a reputation beyond reputearchiver has a reputation beyond repute
Re: MORE PBASIC HELP, ASAP!!

Posted by Joe Ross at 2/14/2001 6:20 PM EST


Engineer on team #330, Beach Bot, from Hope Chapel Academy and NASA/JPL , J&F Machine, and Raytheon.


In Reply to: MORE PBASIC HELP, ASAP!!
Posted by bill whitley on 2/14/2001 5:43 PM EST:



: By default, does joystick 1 (y axis) control PWM 1?
: also, do joysticks 2-4 operate the same way? (y axis controls PWM?)

Yes, but it can easily be changed by changing the serout command if that doesn't work for you.


__________________
This message was archived from an earlier forum system. Some information may have been left out. Start new discussion in the current forums, and refer back to these threads when necessary.
  #11   Spotlight this post!  
Unread 24-06-2002, 00:53
archiver archiver is offline
Forum Archival System
#0047 (ChiefDelphi)
 
Join Date: May 2001
Location: Pontiac, MI
Posts: 21,214
archiver has a reputation beyond reputearchiver has a reputation beyond reputearchiver has a reputation beyond reputearchiver has a reputation beyond reputearchiver has a reputation beyond reputearchiver has a reputation beyond reputearchiver has a reputation beyond reputearchiver has a reputation beyond reputearchiver has a reputation beyond reputearchiver has a reputation beyond reputearchiver has a reputation beyond repute
Re: PBASIC HELP, ASAP!!

Posted by Joe Ross at 2/14/2001 6:18 PM EST


Engineer on team #330, Beach Bot, from Hope Chapel Academy and NASA/JPL , J&F Machine, and Raytheon.


In Reply to: PBASIC HELP, ASAP!!
Posted by bill whitley on 2/14/2001 5:39 PM EST:



: Can anyone double check this code? Tell me if it will work.

: if p3_wheel > 240 then relay5_fwd = 1

: if p3_wheel 240 then JUMP2
: relay5_fwd = 0
: relay5_rev = 0

: JUMP2:

: if p4_wheel > 240 then relay6_fwd = 1

: if p4_wheel 240 then JUMP3
: relay6_fwd = 0
: relay6_rev = 0

: JUMP3:

: I am concerned about ending the IF THEN statements.

The code should tokenize, but it may not do what you want ;-)

The if-then statements look ok, except that I'm not sure that you want to use an "and". The way the code is written now, all the relays will always be set to 0 because p3_wheel and p4_wheel can never be less than 15 AND more than 240. It looks like you want an OR which says if p3_wheel is either less than 15 OR greater than 240, goto the code for p4_wheel.

The symbol for OR in PBASIC is "|". If you replace the "&" with "|" you should be OK.


__________________
This message was archived from an earlier forum system. Some information may have been left out. Start new discussion in the current forums, and refer back to these threads when necessary.
  #12   Spotlight this post!  
Unread 24-06-2002, 00:53
archiver archiver is offline
Forum Archival System
#0047 (ChiefDelphi)
 
Join Date: May 2001
Location: Pontiac, MI
Posts: 21,214
archiver has a reputation beyond reputearchiver has a reputation beyond reputearchiver has a reputation beyond reputearchiver has a reputation beyond reputearchiver has a reputation beyond reputearchiver has a reputation beyond reputearchiver has a reputation beyond reputearchiver has a reputation beyond reputearchiver has a reputation beyond reputearchiver has a reputation beyond reputearchiver has a reputation beyond repute
Suggestion

Posted by Ed Sparks at 2/14/2001 7:45 PM EST


Engineer on team #34, The Rockets, from Bob Jones High / New Century High and DaimlerChrysler.


In Reply to: PBASIC HELP, ASAP!!
Posted by bill whitley on 2/14/2001 5:39 PM EST:



Bill,

If you find that you are still in big trouble with the programming after repeated attempts, post some detailed information about:

1) How you wired the devices to the controller

i.e. Left Wheel -> PWM1
Right Wheel -> PWM2
Compressor -> relay1
Pressure Switch -> rc_sw1
etc.

2) How you expect the 'bot to act given a program

3) Pictures of the 'bot

4) Which Operator Interface devices you want to use

i.e. Joystick 1(X&Y) operates drive system
Joystick 2(Y) operates arm
Joystick 1 (Trigger) operates ball claw
etc.

5) Which events you plan to attend (so we can find you if any of us are at the same event).


I'm sure this community will make every effort to get you going because:

1) We want you to have FUN ! We DON'T want you to start developing ulsers this early in life.

2) We care that you make points (we want them too after all).

3) We aren't challenged enough with just one robot to build

Not to sound like a wise guy but it kind of sounds like you COULD use an Engineer about now ........

I'll be at the Houston, KSC, and National events.





__________________
This message was archived from an earlier forum system. Some information may have been left out. Start new discussion in the current forums, and refer back to these threads when necessary.
  #13   Spotlight this post!  
Unread 24-06-2002, 00:53
archiver archiver is offline
Forum Archival System
#0047 (ChiefDelphi)
 
Join Date: May 2001
Location: Pontiac, MI
Posts: 21,214
archiver has a reputation beyond reputearchiver has a reputation beyond reputearchiver has a reputation beyond reputearchiver has a reputation beyond reputearchiver has a reputation beyond reputearchiver has a reputation beyond reputearchiver has a reputation beyond reputearchiver has a reputation beyond reputearchiver has a reputation beyond reputearchiver has a reputation beyond reputearchiver has a reputation beyond repute
General PBASIC questions

Posted by Joe Johnson at 2/15/2001 9:11 AM EST


Engineer on team #47, Chief Delphi, from Pontiac Central High School and Delphi Automotive Systems.


In Reply to: Suggestion
Posted by Ed Sparks on 2/14/2001 7:45 PM EST:



Ed has some great advice about how to ask a question about PBASIC.

Let me build on that.

Basically, if you want us to help debug some code, you have to help us understand what the code is supposed to be doing.

SO...

Tell us what INPUTS you have

Tell us what OUTPUTS you want to change

Tell us what FUNCTIONS you are trying top accomplish

This information will make the life of the would-be helper a lot simpler and, more importantly, it will make the advice you get more likely to be helpful.

Good luck.

Joe J.


__________________
This message was archived from an earlier forum system. Some information may have been left out. Start new discussion in the current forums, and refer back to these threads when necessary.
 


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 Off
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
PBASIC ARCTAN function Greg Ross Programming 14 11-05-2003 12:28
Need to learn PBASIC...Where Should I Go? IMDWalrus Programming 5 29-04-2003 16:43
Obscure PBASIC for RoboEmu rbayer Programming 1 28-03-2003 23:57
PBasic 2.5 vs. 2.0 Anthony Kesich Programming 6 09-02-2003 22:06
PBasic Question Melissa H. Programming 28 17-11-2002 18:53


All times are GMT -5. The time now is 01:31.

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