Creating Calculator Programs: Bonus Chapter 5
Creating Calculator Programs: Bonus Chapter 5
he programming language used by the calculator is similar to the Basic programming language. It uses the standard commands (such as the If , then , else command) that are familiar to anyone who has ever written a program. And, of course, it also makes use of commands that are unique to the calculator (such as ClrHome, which clears the Home screen). This chapter explains the basics of creating a calculator program. (Chapter B6 describes the Basic programming commands used by the calculator; Chapter B7 discusses programming commands that are unique to the calculator.)
44
Press ~ ~
Enter a name
Enter program
2. Give your program a name and then press . The name of your program can consist of one to eight characters that must be letters, numbers, or the Greek letter . The first character in the name must be a letter or , as in the second picture in Figure B5-1. The after Name = indicates that the calculator is in Alpha mode. In this mode, when you press a key you enter the green letter above that key. To enter a number, press to take the calculator out of Alpha mode and then enter the number. To enter a letter after entering a number, you must press to put the calculator back in Alpha mode. When you press after naming your program, the calculator puts you in the Program editor, as in the third picture in Figure B5-1. The program appearing in this picture is entered in the next step. 3. Enter your program in the Program editor. Your program consists of a series of commands, each of which must be preceded by a colon, as shown in the third picture in Figure B5-1. After entering a command, press so the calculator supplies the colon preceding the next command you enter. When you finish writing your final command, press and ignore the colon that is waiting for a command to be entered.
45
An example of entering a program appears in the third picture in Figure B5-1. The program in this picture writes HI on the Home screen. The ClrHome command is entered into the program by pressing ~R, and Disp is entered by pressing ~. The program commands supplied by the calculator, such as ClrHome and Disp, are explained in Chapters B6 and B7. 4. Press yz when youre finished writing your program. This saves your program in the memory of the calculator and returns you to the Home screen. The name under which the program is stored in the calculator is the same name you gave the program in Step 2.
46
47
At the bottom of this screen you see a message that says the TI-Graph Link software does not support the USB TI-Graph Link cable. This means that USB cable users can still use TI-Graph Link to write their program, but they must use TI Connect, and not TI-Graph Link, to transfer the program to the calculator. This issue is fully addressed in the following steps. 3. Click on the appropriate calculator. On the left of the screen you see a picture of the calculator keyboard, and on the right you see the Program editor. 4. If necessary, clear the Program editor. If a program appears in the Program editor, click FileNewOK to clear the Program editor. 5. In the box following Name, enter a name for your program. The name of your program can consist of one to eight characters that must be letters, numbers, or the Greek letter . The first character in the name must be a letter or . Dont press the Enter key on the computer after entering the name of the program. If you do, the software attempts to send the not-yet-completed program to your calculator. If you have a USB cable or a serial cable that isnt connected to the computer, you get an error message. 6. If desired, in the box following Comment, enter a comment. Use the mouse or Tab key to get from the Name box to the Comment box (see the above warning). Because an eight letter name for your program usually doesnt tell you much, writing a comment really helps when at a much later date you find yourself wondering what the program does. Dont press the Enter key on the computer after entering the comment. See the previous warning for details. 7. Enter your program. Use the mouse or Tab key to get from the Comment box to the large box where the program is entered. (Also note the warning that follows Step 5 in this procedure.) Your program consists of a series of commands. In TI-Graph Link, commands are separated by pressing the Enter key after entering a command, or by placing a colon between
48
two commands appearing on the same line of the Program editor. If the Enter key is pressed after each command, the result should look like the third picture in Figure B5-1 without the colons. The program in this picture writes HI on the Home screen. (Explicit directions for entering the program in Figure B5-1 appear in Step 3 in the previous section Creating and Saving a Program on the Calculator.) The calculator keyboard to the left of the Program editor is fully functional. Click on the keys using the mouse. For example, to enter in your program, click y and then click . The program commands supplied by the calculator, such as ClrHome and Disp, are explained in Chapters B6 and B7. When writing a program using the TI-Graph Link software, if you precede each command with a colon as you do when writing a program on the calculator no harm will be done. The calculator simply interprets each colon as a command that does nothing. 8. Save your program on the computer. To do so, click FileSave As. Select the directory in which you want to save the program, and then click OK. The program is saved under the name you gave it in Step 4.
49
2. Edit your program. You edit your program the same way you would edit your work in a word processor. The Edit menu in TI-Graph Link contains the typical editing commands, such as Undo, Cut, Copy, Paste, and so on. 3. When youre finished editing, click FileSave to replace the previous edition of your program with the revised edition.
50
2. Press to place the program on the Home screen. This is illustrated in the second picture in Figure B5-2. 3. Press to execute the program. This operation is shown in the third picture in Figure B5-2. The program being executed in this figure is the program in the third picture in Figure B5-1. When the calculator is finished executing the program, it writes Done on the Home screen.
Select program
Press
Press