Go to Post Darn IFI and AndyMark for making quality products! :) - Gabe [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
  #1   Spotlight this post!  
Unread 16-01-2006, 23:07
Chris_Elston's Avatar
Chris_Elston Chris_Elston is offline
Controls Engineer
AKA: chakorules
FRC #1501 (Team THRUST)
Team Role: Engineer
 
Join Date: Feb 2004
Rookie Year: 2001
Location: Huntington, Indiana
Posts: 746
Chris_Elston has a reputation beyond reputeChris_Elston has a reputation beyond reputeChris_Elston has a reputation beyond reputeChris_Elston has a reputation beyond reputeChris_Elston has a reputation beyond reputeChris_Elston has a reputation beyond reputeChris_Elston has a reputation beyond reputeChris_Elston has a reputation beyond reputeChris_Elston has a reputation beyond reputeChris_Elston has a reputation beyond reputeChris_Elston has a reputation beyond repute
Strange Problem, varible not subtracting?

Ok, this is one of those stupid simple problems that we don't get it. In this post is FIVE screen shots of our code and a zip file of the project in easyC along with the screen shots again.

What we are trying to do is subtract two varibles, then assign it to another varible in easyC. Sounds simple right?

In screen shot #1 you see the varible we are having problems with:

enc_Right_Difference = 10-5

Then in the terminal window, you see enc_Right_Difference = 5. This is correct. No problems here.

In screen shot #2 you see the varible enc_Right_Difference = Count minus 100. And the terminal window reports a 100 difference between the two varible. No problems here.

In screen shot #3 you see the varible enc_Right_Difference = 100 - Old_Count. And the terminal window reports a 100....uh oh problems here....But wait...Shouldn't enc_Right_Old_Count get updated by enc_Right_Count?? Two lines down. Hmm.....It's not updating varible enc_Right_Old_Count so then now enc_Right_Difference is ALWAYS equal to 100. No good.

In screen shot #4 you see enc_Right_Old_Count is now assigned to a constant 50, and the terminal screen shows that indeed that varible is 50, BUT WAIT....just above back up two line for varible enc_Right_Difference = 100 - enc_Right_Old_Count. The controller KNOWS THAT enc_Right_Old_Count is equal to 50, but why isn't it SUBTRACTING????

Are we losing our minds?

In screen shot #5 is our orginal code before doing all this research debugging to a terminal window...

Why won't in screen shot #4 it subtract? It's like that varible gets blown away.

Is it because when it returns a varible at the bottom is loses it's orginal value? Just trying to help our kids understand it and it stumped me too....
Attached Thumbnails
Click image for larger version

Name:	screen1.jpg
Views:	44
Size:	53.2 KB
ID:	3832  Click image for larger version

Name:	screen2.jpg
Views:	39
Size:	55.2 KB
ID:	3833  Click image for larger version

Name:	screen3.jpg
Views:	32
Size:	51.8 KB
ID:	3834  Click image for larger version

Name:	screen4.jpg
Views:	39
Size:	53.4 KB
ID:	3835  Click image for larger version

Name:	screen5.jpg
Views:	36
Size:	57.3 KB
ID:	3836  

__________________
Team T.H.R.U.S.T. 1501
Download all of our past robot's source code here:Repository

Favorite CD quote:
"That can't be their 'bot. not nearly enough (if any) rivets to be a 1501 machine." ~RogerR: Team #1369
 


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
Need a realistic Statics Problem sanddrag Technical Discussion 10 05-12-2005 15:07
Strange system problem Bill Becker Control System 16 12-04-2005 17:19
Strange Multi-Turn Potentiometer Problem Yellow Eyes Electrical 10 24-02-2005 13:53
Strange Encoder Problem AIBob Electrical 3 20-02-2005 22:20
Strange Auto Problem NotQuiteFree Programming 6 20-02-2005 17:12


All times are GMT -5. The time now is 10:52.

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