Can anyone help me with this? A glitch appeared when running a TI-Basic program on an 84+CSE, and it had always run successfully before. In a For( loop the index variable kept resetting to 0, although no code referenced that variable: it was just a count of how many times the loop should run. Lots of other things took place in the loop, however, so I ended up adding loads of instructions to display the value of the variable at various points so I could track down when it went wrong. The conclusion made no sense, but prompted me to write these test programs:

Code:
For(R,1,5
ClrDraw
Text(10,10,R
End

This one prints 1, then repeatedly 0 until I hit ON: the loop can never end.

Next I tried,

Code:
For(R,1,5
ClrDraw
Disp R
End

which displays digits 1-5 down the right of the Home Screen, as it should. So ClrDraw by itself did not set R to 0.

Then

Code:
For(R,1,5
ClrDraw:DispGraph
Disp R
End

which is apparently the same as the previous one, except for alternately visiting the [blank] Graph Screen and the Home Screen, but now displays an endless sequence of 0s on the Home Screen, until I Break.

Next I try

Code:
For(R,1,5
DispGraph
Disp R
End

where the loop "works", showing that ClrDraw is required for this fault to occur.

Then finally,

Code:
For(S,1,5
ClrDraw
Text(10,10,S
End

which is the same as the first program here, but with a different name for the variable. This displays the digits 1 - 5 successively on the Graph Screen.
So in the main program I was originally debugging, I altered the index variable from R to S, and it now works properly. But none of this makes sense to me: what is going on?
Footnote: None of these test programs is running from Archive, and I have no evidence to associate this with any Doors CSE issues.
I'm not equipped to do any testing of my own at the moment, but I suspect your problem stems from the system implicitly using some variables internally when doing graph operations.

If you're in polar mode, modifying the graph will probably modify R and θ; using ClrDraw presumably resets both to zero. I suspect you'd see similar behavior with X and Y in function graphing mode.
Thanks, you solved it! I feel so stupid wasting over an hour being puzzled by that, and not noticing I was in Polar mode. I knew the program had run many times before without that fault.
  
Register to Join the Conversation
Have your own thoughts to add to this or any other topic? Want to ask a question, offer a suggestion, share your own programs and projects, upload a file to the file archives, get help with calculator and computer programming, or simply chat with like-minded coders and tech and calculator enthusiasts via the site-wide AJAX SAX widget? Registration for a free Cemetech account only takes a minute.

» Go to Registration page
Page 1 of 1
» All times are UTC - 5 Hours
 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum

 

Advertisement