Hi I'm new and I never really attempted any programming on my calulator before but recently I discovered it and I'm taken aback by its functionality and how much easier it is for me in my chemistry class

the premise of the program I am trying to create is an equation converter between two variables much like how you convert temp from c to f, and f to c, I am trying to emulate that for Kc to Kp and Kp to Kc

I'm basing it off of this: http://tech.reboot.pro/showthread.php?tid=1697

So far I have everything up to label 1 complete, but I wrote out the rest of what I want to do, except didn't enter everything into my calculator yet.

Can anyone tell me what I'm doing wrong? Is there way to test if this code works on my computer aside from typing everything manually on my calculator?

Thanks

Code:

[b]:Lbl 0
:ClrHome
:Menu("Kc→Kp",1,"Kp→Kc",2,"EXIT",3)
:Lbl 1
:Input "Kc: ",A
:Input "T: ",B
:Input "n: ",C
:A((0.0821*B)^C)→X
:Disp "Kp= "
:Output (X)
:Pause
:Goto 0[/b]
Lbl 2
:Input "Kp: ",A
:Input "T: ",B
:Input "n: ",C
A/((0.0821*B)^C)→X
:Disp "Kc= "
:Output (X)
:Pause
:Goto θ
:Lbl 3
:ClrHome
:Stop
The only thing that looks immediately incorrect to me is your use of the Output( command. This command takes three arguments: the output row, output column, and the value to display.

If you want to display the value of X immediately after the string "Kp=", you could do this:


Code:
Output(4,3,X
Recommended fix: instead of

Code:

:Output (X)
:Pause

say

Code:

:Disp X
:Pause

(or, better yet)

Code:
 
:Pause X
Quote:
Is there way to test if this code works on my computer aside from typing everything manually on my calculator?


I'd recommend typing it into Sourcecoder, exporting the code to an .8xp file, and then downloading that to your calculator.

Sourcecoder: https://www.cemetech.net/sc/

For connecting the Calc to your computer, use TI Graphlink
Welcome to Cemetech! Very Happy

Code:
:Menu("Kc→Kp",1,"Kp→Kc",2,"EXIT",3)

The menu syntax is Menu("menu-name","choice1",lbl1,"choice2",lbl2,..."choice7",lbl7 so you might need to change the line of code above to something like this:

Code:
:Menu("CHEMISTRY","Kc>Kp",1,"Kp>Kc",2,"EXIT",3

Note that you can't use the → command in strings (in your case a menu) so I replaced it with a ">"


Code:
:Goto θ

I think you meant:

Code:
:Goto 0

Putting all the revisions together from me and the others that posted, and tossing in some optimization, here is the product:

Code:
:Lbl 0
:Input "T:",B
:Input "n:",C
:ClrHome
:Menu("CHEMISTRY","Kc>Kp",1,"Kp>Kc",2,"EXIT",3
:Lbl 1
:Input "Kc:",A
:A(0.0821*B)^C→X
:Disp "Kp="
:Output(4,3,X
:Pause
:Goto 0
:Lbl 2
:Input "Kp:",A
:A/(0.0821*B)^C→X
:Disp "Kc="
:Output(4,3,X
:Pause
:Goto 0
:Lbl 3
:ClrHome
:Stop
Moar optimization:

Code:
:While 1
:ClrHome
:Input "T:",B
:Input "n:",C
:ClrHome
:Menu("CHEMISTRY","Kc>Kp",1,"Kp>Kc",2,"EXIT",3
:Lbl 1
:Input "Kc:",A
:Pause "Kp=",A(0.0821B)^C
:End
:Lbl 2
:Input "Kp:",A
:Pause "Kc=",A/(0.0821B)^C
:End
:Lbl 3


It looks a bit different now, but I removed large parts out of the display code, and the screen cleanup. I also think it makes sense to remove the labels and put the program into "one time mode" rather than a loop, since users are likely to only use it once. And it would save 7 more bytes.
Nik wrote:
Moar optimization:

Code:
:While 1
:ClrHome
:Input "T:",B
:Input "n:",C
:ClrHome
:Menu("CHEMISTRY","Kc>Kp",1,"Kp>Kc",2,"EXIT",3
:Lbl 1
:Input "Kc:",A
:Pause "Kp=",A(0.0821B)^C
:End
:Lbl 2
:Input "Kp:",A
:Pause "Kc=",A/(0.0821B)^C
:End
:Lbl 3
...


That's not how the second argument of Pause works. Pause without arguments waits indefinitely for user to press Enter. Pause with one argument displays value in argument, updates Ans variable, and waits for Enter keypress. Pause with two arguments (TI-84+CE only) does the same the displays value from the first argument for the period of time specified in the second argument (rounded up to nearest tenth of a second). See http://tibasicdev.wikidot.com/pause.

This is how it should be:

Code:
:While 1
:ClrHome
:Input "T:",B
:Input "n:",C
:ClrHome
:Menu("CHEMISTRY","Kc>Kp",1,"Kp>Kc",2,"EXIT",3
:Lbl 1
:Input "Kc:",A
:Disp "Kp="
:Pause A(0.0821B)^C
:End
:Lbl 2
:Input "Kp:",A
:Disp "Kc="
:Pause A/(0.0821B)^C
:End
:Lbl 3
ReGuess wrote:
[...]

Wow, that's my bad. I missed that it has two arguments, or, rather, totally ignore it. Sorry for that, of course it should only have one argument.
It's okay. If it hadn't been for your mistake, I would've never known about the 2nd argument. I just knew it only has 1 argument on the previous calcs.
whoa...!?!?

thank you everyone for your responses, I wasn't expecting this much

I will try everything out, thank you for all your advice, I will look through everything everyone posted thoroughly

L
I'm not sure which calculator you're using, but if you aren't sure what a command needs work to correctly, just scroll to that command in the menu and press [+]. I don't remember if this only works with the color screen calculators though... Smile
TheLastMillennial wrote:
I'm not sure which calculator you're using, but if you aren't sure what a command needs work to correctly, just scroll to that command in the menu and press [+]. I don't remember if this only works with the color screen calculators though... Smile

You'll need to download Catalog Help for Millennial's method to work if you are using a non-color calculator. Smile I think CSE's and CE's already have it built in...
  
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