Posted by Erik W on Jan 12, 2003 5:43 PM
I have been programming calculators for quite some time, so I wanted to share some of my knowledge. Here is a simple TI-83+ BASIC programming tutorial (will also work on new TI-84+ series) with basics on input/output, looping, and conditions.
It is simple to make a new program. From any section on the TI calculator, press the [PRGM] button. Then press the right arrow twice so NEW is selected. It should look like the image to the right:
Hit [ENTER] and type in a name for the program. You will see the calculator limits the name to 8 letters (left) so pick a name carefully. Hit [ENTER] again and you will get to the screen where you can enter the BASIC code (right), which you will learn later.
To edit a program, from any screen, hit the [PRGM] button, then the right arrow once so EDIT is selected. Then use the up and down arrows to select the program you wish to edit. Hit [ENTER] and you'll be brought to the programming screen.
To run a program, from any screen, hit the [PRGM] button, then use the up and down arrow keys to select the program. Hit [ENTER] twice and the program will run.

Q. How do I lock my programs so they can't be edited?
A. See this tutorial.
Throughout the tutorials, we will be creating a Guess the Number game using information from the lesson you just read. Start by creating a new program called "GUESSNUM".
First go to the main screen by pressing [2nd] and [MODE] (quit). Then, to store a number as a variable you enter the number, then you press the [STO->] button, and then [ALPHA] and the letter you wish to store the number as. Hit [ENTER], and the number will display again showing a successful stored variable. (left)
Make sure you're at the main screen by pressing [2nd] and [MODE] (quit). Then, to recall a variable, simply press [ALPHA], the letter, and hit [ENTER]. (right)
The nice things about variables, is if you need a number in an equation a lot, you just store the number as a variable, and use the variable in place of the number. FOR EXAMPLE: You were given the equation Y2+4Y-9, and your teacher wants you to plug in 629 for Y. All you would do is press [6][2][9] then [STO->] then [ALPHA] and [1](Y) then [ENTER] to store the variable. Once you did that, just plug in the equation and hit enter! ([ALPHA] [1](Y) [X2] [+] [4] [ALPHA] [1](Y) [-] [9] [ENTER])
Every day in class, your teacher has you plug a different number into Y2+4Y-9 and you're just SICK of typing it in every day. Well, you can make a program for it! Go and edit the MATH program you just created. It should be blank. On the first line, type the equation above ([ALPHA] [1](Y) [X2] [+] [4] [ALPHA] [1](Y) [-] [9] [ENTER]) You're not done however, you need to tell the calculator some place to put the answer. Let's store it as "A", so after the equation press [STO->] and [ALPHA] [MATH](A). You have one more thing to do, which is tell the calculator to end the program. So hit [ENTER] for a new line, then hit the [PRGM] button, and scroll down way to the bottom until you come to the "Stop" command. Hit [ENTER] to add that command. Your program should look like the one to the right.
So you have the program, now how to you use it? Press [2nd] and [MODE](QUIT) to get to the main screen. Today's number is 57 so store that as "Y". Next, run the program. It will do the math and display "Done". Finally, to see the answer it came up with, recall the variable "A", which is the variable you specified in the program to store the answer as. Your screen should look like the picture to the left.
Edit the GUESSNUM program you created last lesson. We're going to create a random number between 1 and 50, so on the first line of your program, push [MATH] then press the right arrow three times so PRB is selected. Next, press [5] to select the random integer command. Press [1] then [,] and [5][0]. End the command with the [)] key, and finally store it as the variable "A" by pressing [STO->] then [ALPHA] and [MATH](A).

Hmm.. so how do you display values of variables? Just press [PRGM] then the right arrow to get to the I/O screen, and [3] for the DISP command. Then simply press [ALPHA] and the variable you wish to display the value of.


If you remember, last lesson we made a math program which required us to manually type in "A" to see what the result was. Using the DISP command, we'll make it say "THE ANSWER" then display the value of A. Open the MATH program and go to the line with Stop on it. Press [2nd] [DEL] (ins) then [ENTER] to insert a new line between the two. Go up to the line and press [PRGM], go to the I/O menu, and hit [3]. Next, type "ANSWER" followed by [,] and then the letter A by pressing [ALPHA] [MATH] (A). It should look like the image to the left. Exit and run the program, using 100 for Y. It should look like the image to the right.
Q. How can I clear the screen in the program?
A. To clear the home screen, use the ClrHome command by pressing the [PRGM] button, going to the I/O menu, and pressing [8].
Edit the GUESSNUM program. We're going to tell the person that they have to pick a number between 1 and 50. Hit enter to create a new line in the program, and then hit the [PRGM] button, press the right arrow button once so I/O is selected, then press [3]. Press [2nd] [ALPHA] for an alpha lock, then type in "PICK A NUMBER","FROM 1 TO 50". (you will need to take off the alpha lock for the numbers by pressing [ALPHA])

Inside a program on a blank line, press [PRGM] then the right arrow to get to the I/O screen, and [1] for the INPUT command. Next, press [ALPHA] then the variable you want to store the inputted data to. When run, a question mark will appear waiting for you to enter a number. Enter the number, and it will be stored as the variable you specified.

The PROMPT command is an alternate way to input data, but is slightly different which you will see in a second. Inside a program on a blank line, press [PRGM] then the right arrow to get to the I/O screen, and [2] for the PROMPT command. Next, press [ALPHA] then the variable you want to store the inputted data to. Now, When run, a question mark will appear waiting for you to enter a number. In front of the question mark, unlike the INPUT command, it tells what variable it is storing the inputted data to.

Back to the math program, you now know how to make it ask you for Y instead of manually entering it. Go ahead and open the math program. On the first line press [2nd] [DEL] (INS) and [ENTER] to create a new line. Then press the [PRGM] button, go to the I/O menu, and press [2]. Next, press [ALPHA] then [1] (Y). Exit, and run the program. Cool huh.
Q. How come I get an error when I try to input text? Q. Can I make the input cursor appear anywhere on the screen?
A. Nope
Edit the GUESSNUM program. Now it's time to get the person's guess. Go to the last line of the GUESSNUM program and hit [ENTER]. Press [PRGM] then go to the I/O menu, and press [1]. Next, press [ALPHA] then [APPS] (B).


The most simple way to compare something is the IF statement. How it works, is if the IF statement is true, it runs what is on the next line, otherwise it skips it. We'll make a simple program to check if your name is "Erik" or not. First prompt for someone to enter your name (remember you have to store text as a string). Then to get the IF command, when inside a program, press [PRGM] then [1]. Following the IF statement we want to put Str1, which is what the user entered their information as, so press [VARS] [7] [1]. Next, to get the symbols to compare, press [2nd]+[MATH](TEST) then press [1] for the equal sign. Next type "Erik" with the quotes. In the next line, we'll display "ERIK!!!" to show our happiness of greeting him. Following that line, we'll display a simple "Hi" which will show to you if your name is or isn't Erik.


The IF statement is fine, unless you want to do more than one thing if something is true. That's where the IF-THEN statement comes in. The way it works, is following the IF statement, instead of the command you wish to run, you put THEN ([PRGM] [2]), then the commands, followed by END ([PRGM] [7]) to tell the calculator that is the end of all the commands you want to do if the IF statement is true. So let's modify the above program to stop if the name entered is "Erik", so the generic "Hi" isn't displayed. So open up the program you made above, and move the cursor to the line that says DISP "ERIK!!!" and press [2nd] [DEL](INS) then [ENTER] to insert a new line. Then press the up arrow to get to that line, and press [PRGM] [2] to get the THEN statement. Then scroll down to the DISP "HI" line and insert two blank lines. In the first blank line, put a stop there to end the program by doing [PRGM] [ALPHA] [COS](F). The on the next line do [PRGM] [7]. The code should look like the code to the left. Now if we run the program, and enter "ERIK" as the name, the program displays "ERIK!!!" and stops before the generic "HI" is displayed. (See the images on the right).


The above program is fine, unless we don't want to stop the program when someone entered "Erik" and we still don't want to display the generic "HI" when another name is entered. This calls for the IF-THEN-ELSE statement. If something is true, it runs the commands between the IF and ELSE statement, and if it is false, it displays the commands between the ELSE and END statement, and then continues to run after the END statement. Modify the program to look like the code to the left to fix up our program. (To get the ELSE command, you press [PRGM] [3])
We're almost done. There is one more thing you might want to do, and that is to compare more than two things. For example, maybe you want to see if Str1 is equal to "ERIK" or "KEVIN". To do that, you will be using the OR statement. Open back up your NAME program, and move your cursor to the end of the If Str1="ERIK" line. Then press [2nd]+[MATH](TEST), Press the [->] button to go to the LOGIC menu, then press [2] for OR. Notice there is also AND if your IF statement were to require you to use that. Then after the word OR, press [VARS] [7] [1] for Str1 again, [2nd]+[MATH](TEST) then [1] for the equal sign, and then type "KEVIN". Then you might also want to change Disp "ERIK!!!" to something else since that will display if the name is either ERIK or KEVIN.


Now, since you know IF statements, we're going to add a few to check if the person got it exactly, was too high, or too low. We're going to put IF statements inside an IF-THEN-ELSE statement, going something like this: IF the number was correct, THEN tell them that they were and stop the program, ELSE see IF they were too high and tell them, or see IF they were too low, and tell them. Then we'll END the IF-THEN-ELSE statement as required.
The LBL command marks places in the program you can GOTO. Create a new program, and press [PRGM] [9] for the LBL command. Then after the command, you can either have two letters, two numbers, or a number and a letter. Let's use A1 for the sake of this example, so on the same line, press [ALPHA] [MATH](A) then the number [1].

Before we learn the GOTO command, in the program above, have the user input a number as A, then check if that number is 5 and if it is, stop the program. Now, if the person is trying to guess a number like 5 or something, instead of re-running the program over and over, if the program didn't stop, you can make it goto the first line to run again. On the last line of the program, press [PRGM] [0] then type A1, which is the name of the label you made earlier. Now when you run the program, it keeps running until you type 5.

This is the last step in our Guess the Number program. Put the cursor in front of the line that says Input B and press [2nd] [DEL](INS) and [ENTER] to insert a new line. Then in that new line, press [PRGM] [9] and [ALPHA] [MATH](A). Then go to the way end of the program, press [ENTER], and press [PRGM] [0] and [ALPHA] [MATH](A). Now go ahead and try your program!listed in: ti calculators, tutorial
Webmaster's Response: Everything in the catalog is described in the back of the TI-83+ Manual. If you lost yours, it can be downloaded at the TI website.
Posted by Erik on January 1, 2005 10:41 PM
How can I get a cursor to set anywhere in the screen I want to?
Posted by Sainath on March 16, 2005 10:53 PM
Webmaster's Response: Are you asking for things like text input? No, you can't.
Posted by Erik on March 16, 2005 10:53 PM
Can you add comments to TI 83+ BASIC programs? If so how? Thanks
Posted by Anonymous on June 3, 2005 10:57 PM
Webmaster's Response: Yes you can. A string surrounded by quotation marks on its own line is ignored by the calculator when the program is run.
Example:
:Disp "HI"
:"THIS IS IGNORED"
:Disp "ABCD"
Posted by Erik on June 3, 2005 10:59 PM
I noticed that if you write a program that has two answers, such as the square root of a positive number, it only returns one answer. Do you know a way to solve this?
Posted by T on July 20, 2005 11:00 PM
Webmaster's Response: The calculator doesn't do this automaticly for you. You'll have to do something like this:
:Disp "ENTER NUMBER"
:Input X
:Disp "SQUARE ROOT:"
:If X>0
:Then
:Disp √(X)
:Disp -√(X)
:Else
:Disp "IMAGINARY NUMBER"
:End
Posted by Erik on July 20, 2005 11:01 PM
is there any way to get more than 0-9 and a-z?
Posted by ~boo~ on January 19, 2006 11:06 PM
Webmaster's Response: The TI 83+ Language Localization App gives you the opportunity to use foreign characters.
Posted by Erik on January 19, 2006 11:06 PM
Are there any programs you can make yourslef with out linking to a computer? I need the coding for any interesting or cool programs.
Posted by Jarade Springer on February 13, 2006 11:08 PM
Webmaster's Response: You can view the code for any of the BASIC programs, say on TI Calc using the Graph Link software, then type it manually in your calculator.
Posted by Erik on February 13, 2006 11:09 PM
I am an intermediate programmer for the TI-84. But I am having trouble making a program that disables people from editing your program that you made.
Posted by Collin Cerbus on April 25, 2006 6:21 PM
Webmaster's Response: I'm not sure, but I'll let you know if I figure it out. If anyone knows feel free to reply.
Posted by Erik on April 25, 2006 9:41 PM
Erik,
Thanks for the Programming Basics lessons.
I'd like to share a couple hardcopies with fellow students. Do you have a version that will print without all the "Google"dy-gook? and won't split screen dumps over page breaks?
Thanks Again,
Ren
Posted by Ren on April 5, 2007 10:09 AM
Erik,
A suggestion...
If you get around to writing another programming lesson for the TI calcs, could you include the FOR(,,,) loop and the WHILE(condition) and
REPEAT(condition) commands?
I have them penciled in the margin of my original hardcopy of your webpages.
Sincerely,
Ren
Posted by Ren on April 5, 2007 10:16 AM
Thanks for your comments. For a better print out, you can try by just selecting the main content starting at the title, and using Internet Explorer. It doesn't appear to split images between pages like Firefox does.
As for a more "advanced" tutorial... we'll see how much time I get. It's started, I just need time to finish.
Posted by Erik on April 5, 2007 4:01 PM
My son's TI-83 has frozen. He changed the batteries the other night and when he turned it back on it was just a blank black screen. It was definitely on because the black dots were on the screen. How do we fix this. He needs it for the last month of school (and then never again!!)
Posted by Glenda on April 24, 2007 7:07 PM
There are two ways you can do a hard reset of your calculator.
- First try leaving out the main and backup batteries for 3 hours before you re-insert them.
- If that doesn't work, take out one AAA battery, and hold down the [del] key when you reinsert it. Ignore the message on the screen. Re-remove one AAA battery, and without holding down any keys reinsert it. If the message on the screen says "Waiting...Please install calculator software now" you will need to re-install the TI Operating System using the TI-Connect Software and link cable.
Posted by Erik on April 24, 2007 8:28 PM
Can someone tell me what im doing wrong? Im trying to make a Hang-Man game and i do good with the first time i ask someone to put in a number that represents a letter (a=1 ect.) But when I do it again, the output that corresponds with what they put in the first time dissapears. How can I make it remember what they put in or how can I make it stay displayed? Also is it able to clear the screen without clearing their imput? Ive tried everything I could think of. Thanks for the help.
Posted by Scott on May 28, 2007 11:53 AM
Scott- I would suggest adding each input to a string (See FAQ under lesson 4), then re-printing that string using OUTPUT each time a new letter is entered.
Posted by Erik W
on November 6, 2007 8:21 PM
Additional comments are no longer being accepted for this post.
This is an okay site, but i would appreciate it more if u explained like what everything means in the catelog in the calculator, but i REALLY APPRECIATE the strng thing, ive wanted to make a program for chemistry where i jsut have to input the element symbol and it would give me info for it. THNX A LOT FOR THAT!!!!!!
Posted by Anonymous on January 1, 2005 10:39 PM