|
|
|
![]() |
|
|||||||
|
||||||||
|
|
Thread Tools | Rate Thread | Display Modes |
|
#1
|
||||
|
||||
|
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.... |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|
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 |