TI-83 PROGRAMMING Welcome to programming for the TI-83 calculating system. This file is for all of you eager novice programmers that want to turn pro or at least get a little better. I will do my best to break it down for you so you can get to work. 1.GETTING STARTED: Ok, here we go! First of all, press the PRGM button on your calculator. This is the program command screen where you can do 3 different things. 1-Execute a program 2-Edit an already created program 3-Create a new program These commands are shown on top of the screen like this. EXEC EDIT NEW 1.xxxxxxxxxxx 2.xxxxxxxxxxx 3.xxxxxxxxxxx The xxxxx's represent whatever programs you already have-there may not be any programs on your calculator. For right now, press right twice until the word NEW is highlighted. EXEC EDIT NEW 1:Create New Press enter, and you will be asked to name your program. PROGRAM Name= Type in anything you want, it doesn't matter. For right now, let's just type in demo: PROGRAM Name=DEMO Press enter again, and the program command screen will pop up: PROGRAM: DEMO : This is the program command screen. This is the brain, heart, and soul of any program. Here you can tell what the program will do, think, and feel. Well.... Not really, but it does have a certain dramatic effect to it doesn't it? 2.PROGRAMMING BASIC: THE SIMPLEST OF THEM ALL Ok, you have your program named and your ready to start right? Slow down eager beaver, because there are quite a few things to memorize. Ready? Let's begin. Right now you have your program command screen up, and you should see a little colon to the right of your cursor. This is the beginning of a command line. This is where you will type in whatever you want your program to do. For right now let's take a look at some of the basics your calculator can do. From the command screen, press PRGM again. You should get something that looks similar to this. All of this information will not fit on the screen. You will have to scroll down to see it all! CTL I/O EXEC 1:If* 2:Then* 3:Else* 4:For( 5:While 6:Repeat 7:End* The selections marked with an * are the most relevant and will be explained later on. 8:Pause* 9:Lbl* 0:Goto* A:IS>( B:DS<( C:Menu( D:prgm E:Return F:Stop* G:DelVar H:GraphStyle( These are the program commands. By placing these commands into the program, you can "tell" the calculator what to do. Here are the rest of the commands: CTL I/O EXEC 1:Input* 2:Prompt* 3:Disp* 4:DispGraph 5:DispTable 6:Output(* 7:getkey 8:ClrHome* 9:ClrTable 0:GetCalc( A:Get( B:Send( And..... <==This menu will list the programs that are currently on your calculator. CTL I/O EXEC 1:xxxxxxxxxx 2:xxxxxxxxxx Ok..... these commands each have a special meaning and purpose. Let's move on to the next chapter and find out what they mean. 3. What's it all about? In this chapter, we will discuss what each of the commands from the menu mean. I am not sure what all of them mean, but I will tell you all I know. The commands that I do know should allow you to create any game you like anyway. 1.Prompt- This is the beginning of your program. When you place this into your program, it will ask the participant what a certain variable equals. Ex: You want your program to ask the par. what x equals. Now let's try it in your program. Please do the following steps. 1.From the command screen, open the program menu. 2.Select Prompt 3.After Prompt is placed into your program, press ALPHA X You should see something like this PROGRAM:DEMO :Prompt X Ok, this means that your program will ask the par. what X equals. Press 2nd MODE to quit programming. Let's test out your first program! Press PRGM again and select your program. Press enter twice, and you should see this. PrgmDEMO X = ? Congratulations. You've successfully made your program prompt the participant. It may not seem like much, but you're on your way! Tip: To exit a program at anytime, just press ON and then select quit. 2.Disp- This stands for display. It is used to tell the program to display any type of text or numerals. Ex: You want your program to display "HOW ARE YOU?" after starting the program. Steps: 1.Open your program. 2.Clear everything by pressing CLEAR. 3.Press PRGM and select Disp from the I/O menu. You should receive this effect. Press APLHA " to place the quotations. PROGRAM:DEMO :Disp " Use the ALPHA key to type in the desired text. PROGRAM:DEMO :Disp "HOW ARE YOU?" Ok, let's give it a test run. Exit the command screen and activate your program. You should see this. PrgmDEMO This means that your program has <==performed all of the commands and the program is finished running. HOW ARE YOU? Done If it works, then congratulations. If not, then try and go back and edit your program. 3.IF- IF is used to tell the program what to do if the prompted variable equals a specific number. Ex: You want your program to show "HOW ARE YOU?" if x = 3. For this exercise, we will need to combine all three of the things that you have already learned. STEPS: 1.Open your program for editing. 2.Clear all commands by pressing CLEAR. 3.From the program menu, select Prompt 4.After prompt, Press ALPHA X 5.From the program menu, select IF 6.After IF, type ALPHA X So far, you should have this. To get this symbol, press 2nd MATH and select the desired equation symbol. PROGRAM:DEMO :Prompt X :IF X = 3 7.From the program menu, select Disp. 8.After Disp, type "HOW ARE YOU?" 9.Exit the program editor Let's see if it works! Open your program: prgmDEMO X = ? Press 3 prgmDEMO X = ?3 Press enter. prgmDEMO X =?3 HOW ARE YOU? Done You should get this effect or at least something similar. Otherwise, please go back and edit your program before you move on. You did it! You've just created your first multi-step program! I hope that you have learned a little so far. If you have any questions about what was discussed, feel free to e-mail me at jlconran07@yahoo.com 3. Menus And Labels: So Many Choices So far you have learned how to prompt variables, display text, and use the If condition. Now let's move on to something a little more difficult. Menus and Labels are used to create linear systems. Ex: You want your program to show a menu with one choice. STEPS: 1.Open your program for editing. 2.From the program menu, select MENU( 3.After Menu, type in your menu title IN QUOTATIONS. PROGRAM:DEMO :Menu("DEMO MENU" 4.After the title, place a comma, and type in what your first option will be. PROGRAM:DEMO DO NOT PRESS ENTER AFTER THE TITLE. THE TEXT WILL AUTOMATICALLY START ON A NEW LINE! :Menu("DEMO MENU" ,"DEMO 1" 5.After the first option, add another comma, and assign this option a variable. This is the variable where the program will go once the option is selected. PROGRAM:DEMO :Menu("DEMO MENU" ,"DEMO 1",D Now you need to label what D will do. 6.From the program menu, select Lbl and type D after it. PROGRAM:DEMO :Menu("DEMO MENU" ,"DEMO 1",D :Lbl D Now you need to type what will come after D. For right now, let's just use our favorite phrase "HOW ARE YOU?" Program the following. PROGRAM:DEMO Everything after "Lbl B" will be included in the label. :Menu("DEMO MENU" ,"DEMO 1",D :Lbl D :Disp "HOW ARE YOU?" Ok, let's test it! Activate your program. EFFECT: DEMO MENU 1:DEMO 1 Select the first (and only) option HOW ARE YOU? Done You have created your first menu! Move on to the next section to learn how to use multiple options. 4.More Menus In this section you will learn how to make menus with more than one option. This is done in a much similar way to the one option menus. STEPS: 1.Open your program for editing 2.Clear all data 3.Create a menu and title it "DEMO MENU" PROGRAM:DEMO :Menu("DEMO MENU" 4.Title the first option as "DEMO 1", and label it as D1 PROGRAM:DEMO :Menu("DEMO MENU" ,"DEMO 1",D1 Ok, we already know what this does; it means that your menu will have one option, and it will be labeled as D1. Now, to add another option, simply place a comma after it, and type in the next option. EFFECT: PROGRAM:DEMO :Menu("DEMO MENU" "DEMO 1",D1,"DE MO",D2 You see, it is the exact same thing, except you add a comma between the label and next option. The blue text is the first option and its label, and the red text is the second option and its label. Let's add another one. Simply place a comma after the second label and type in the third option. EFFECT: First Option with Label, Second Option with Label, Third Option with Label. PROGRAM:DEMO :Menu("DEMO MENU" "DEMO 1",D1,"DE MO",D2,"DEMO 3", D3 Now lets label the options. Let's label the first one first. 5.Label D1;"HOW ARE YOU?" EFFECT Again everything after the command lbl will be included in the label! PROGRAM:DEMO :Menu("DEMO MENU" "DEMO 1",D1,"DE MO",D2,"DEMO 3", D3 :Lbl D1 :Disp "How are you?" Now label the second option. PROGRAM:DEMO :Menu("DEMO MENU" "DEMO 1",D1,"DE MO",D2,"DEMO 3", D3 This will be activated if the menu option with this label is chosen. :Lbl D1 :Disp "HOW ARE YOU?"==>==>==> This will be activated if the menu option with this label is chosen. :Lbl D2 :Disp "WHATS UP?"==>==>==>==>==> Finally, label D3 PROGRAM:DEMO :Menu("DEMO MENU" "DEMO 1",D1,"DE MO",D2,"DEMO 3", D3 :Lbl D1 :Disp "HOW ARE YOU?" :Lbl D2 :Disp "WHATS UP?" :Lbl D3 :Disp "IM FINE" 6.Test your menu. EFFECT: PrgmDEMO DEMO MENU 1:DEMO 1 2:DEMO 2 3:DEMO 3 7.Select the first option. HOW ARE YOU? Done 8.Go back and try each option. DEMO MENU 1:DEMO 1 2:DEMO 2 3:DEMO 3 WHATS UP? Done DEMO MENU 1:DEMO 1 2:DEMO 2 3:DEMO 3 IM FINE Done Congratulations, you have just created your first multiple option menu! P.S. I understand that this subject is very confusing. Please e-mail me if you have any questions. Jlconran07@yahoo.com 5. Storing Variables Storing variables is one of the simplest things, but is also one of the most important. When you store a variable, you place data "inside" that variable where it can be used later on. To show you how to do this, I will not be using programming scenarios. Ex: You are doing a series of math problems that use the number 500 frequently. STEPS: 1.Type in the number to be stored. 2.Press the STO key EFFECT: 500--> 3.Decide on a letter to use as a variable; I will use Y, but you can use whatever variable you want. 500-->Y 4.Press enter. 500-->Y Done Now that number is stored as Y, or whatever variable you chose. Let's use it in an equation. How about 300 + 500. Since you have 500 stored as a variable, you don't have to type 500 in anymore. Ex: 300 + Y 800 I know that this appears to have absolutely nothing to do with programming, but trust me it does. You can now use these variables to store data for your game/program. Ex: You want your program to display a series of numbers. STEPS 1.Open your program for editing and clear all current data. 2.Type in the number that you want stored as a variable. PROGRAM:DEMO :500 3.Press the STO key (right above the ON key) 4.Press the key for the variable that you want to store the data as. PROGRAM:DEMO :500==>A When you execute your program, the number data 500 will be stored as A, so whenever you use A in an equation, you will be using the nmber 500. Ex: 200 + A = 700 (Don't worry, this data is not permanent; you can get rid of this data by going into your memory and deleting the variable, or by simply storing it as something else.) Again, I know that this information doesn't seem to be relevant to programming, but it is crucial. 7. Storing Strings Now that you can store number data as variables, you need to learn how to store words as variables. You can't store sentences as variables though. You have to store them as strings. To store words and sentences as strings, you must first type in the desired sentence with quotations around it. "HOW ARE YOU?" Then press the STOR button. VARS, 7, and pick any of the ten string slots. (I will pick string 1 but you can pick any one you want.) "HOW ARE YOU?"-->Str1 Press enter. When the sentence is shown, this signals that it has been stored as a string. "HOW ARE YOU?"-->Str1 "HOW ARE YOU" To recall this information, just go back under VARS, 7, and select the string, and press enter twice. 7.Input- just like Prompt, Input retrieves information from the participant. In contrast, Input stores that information to a variable or string as soon as in retrieves it. Input also asks the participant a question before getting the information. Ex: you want your program to ask the participant how old they are, and then display, "You are X years old" Here we go!! STEPS: 1. Open your program for editing. 2. Clear all current data 3. Open the program menu, press left, and select input from the menu. PROGRAM:DEMO :Input 4. After the command, type in the question to be asked PROGRAM:DEMO :Input "How old a re you?" 5. Now type a comma and the variable that the data will be stored to. This means that the program will ask "HOW OLD ARE YOU?", and that the number that is entered will be stored as X. PROGRAM:DEMO :Input "How old a re you?",X 6. Now make the program display the data it retrieved PROGRAM:DEMO :Input "How old a re you?",X :Disp "YOU ARE" :Disp X :Disp "YEARS OLD" 7. Test your program You can also use this Input feature to retrieve words and sentences. Ex: You want your program to ask the participant what his/her name is, and the display "YOUR NAME IS Str 1" STEPS: 1. Open your program for editing. 2. Clear all current data. You will program this exactly like you did before, but instead of storing the information as a variable, you will store it as a string. PROGRAM:DEMO :Input "NAME?",Str 1 :Disp "YOUR NAME IS :Disp Str 1 3. Test your program. Tip: Only 16 characters can be on a line of text at a time, so you must start a new Disp command every 16 letters. Try and experiment with your own questions and answers! 8. Columns and Rows- Your calculator has a certain number of rows and columns. You can't tell it to display more than 16 characters per row, or more than 8 columns. Ex: Here as a diagram of your calculator XXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXX If you are programming the display command and your text is longer than 16 characters, you still don't have to start a whole new Disp command. Just type in the text until you run out of character space and then end quotation, type a comma, and continue another quotation. EFFECT: PROGRAM:DEMO :Disp "XXXXXXXXX XXXXXXX","XXXX...etc" 10. Output-Output is very similar to Disp, except for the fact that you can choose which column and row that the text appears on. Ex: You want your program to display "A" on the second column and on the third row. STEPS 1. Complete all required steps to have your program open, cleared, and ready to be programmed. 2. Open the program menu, press left, and select Output( PROGRAM:DEMO :Output( 3. Type in the number for the column that you want the text to appear. 4. Add a comma and the number for the row that you want the text to appear. PROGRAM:DEMO :Output(2,3 5. Type in another comma, a quotation mark, and the text to be displayed. PROGRAM:DEMO :Output(2,3,"A" 1111111 1234567890123456 1XXXXXXXXXXXXXXXX 2XXXXXXXXXXXXXXXX 3XAXXXXXXXXXXXXXX 4XXXXXXXXXXXXXXXX 5XXXXXXXXXXXXXXXX 6XXXXXXXXXXXXXXXX 7XXXXXXXXXXXXXXXX 8XXXXXXXXXXXXXXXX You can also use Output to display sentences. (AS LONG AS THE SENTENCES CAN FIT ON THE SCREEN) 11. Then and Else- Then and Else work along with the If command. As you learned, you can use If to tell the program what to do if a variable equals a certain number. You use Then and Else to tell the program what to do is that variable does not equal that number. Ex: You want your program to ask the participant how old are they. If they are 14 the program will say "YOU ARE YOUNG". If not, it will display "THAT'S OLD" STEPS: 1. The usual (lol) 2. Perform the following. PROGRAM:DEMO :Input "HOW OLD A RE YOU?",X :If X=14 All commands after then will be executed if the condition is true. :Then :Disp "YOU ARE Y OUNG" :Else All commands after else will be executed if the condition is false. :Disp "YOU ARE OL D" 11.Stop and End- Use these commands in unison to tell the program to stop all functions and end. Ex: Your program will ask the participant what X equals, and if X equals 2, the program will end. If X does not equal 2, the program will display hello, and then will end. STEPS: 1.Perform the following: PROGRAM:DEMO :Prompt X :If X=2 :Then :Stop :End :Else :Disp "HELLO" :Stop :End 2. Test your Program 12. Pause and ClrHome- These commands don't necessarily have to be used in unison, but they can be. Pause tells the program to, you guessed it, pause until the ENTER key is pressed. ClrHome, which stands for Clear Home screen, tells the program to clear all text and data from the screen. Ex: Your program should display "HELLO", pause, and then clear all text from the screen. STEPS: 1.Enter the following: PROGRAM:DEMO :Disp "HELLO" :Pause :ClrHome 2. Test your program Congratulations! You have just completed your first programming tutorial. I hope that it has helped you start your dream of making your own games. Don't worry; this isn't all of the information that you will be provided with. There will be more tutorials in the future to help you further improve your programming experience!