20-4Calculating the Number of Bytes Used by a Program
20-5Secret Function
20-6Searching for a File
20-7Searching for Data Inside a Program
20-8Editing File Names and Program Contents
20-9Deleting a Program
20-10Useful Program Commands
20-11Command Reference
20-12Text Display
20-13Using Calculator Functions in Programs
20
20-1Before Programming
The programming function helps to make complex, often-repeated calculations
quick and easy. Commands and calculations are executed sequentially, just like
the manual calculation multistatements. Multiple programs can be stored under file
names for easy recall and editing.
File Name
Program
Select the PRGM icon in the Main Menu and enter the PRGM Mode. When you
do, a program list appears on the display.
Selected memory area
(use f and c to move)
•{EXE}/{EDIT} ... program {execute}/{edit}
•{NEW} ... {new program}
P. 368•{DEL}/{DEL·A} ... {specific program}/{all program} delete
P. 362•{SRC}/{REN} ... file name {search}/{change}
•{LOAD}* ... {loads a built-in Program Library program}
CFX
*See the separate Software Library Manual for details (except fx-
9750G PLUS, CFX-9850G PLUS).
* The following models do not support the LOAD command: fx-9750G
PLUS, CFX-9850G PLUS.
File Name
Program
File Name
Program
352
• If there are not programs stored in memory when you enter the PRGM Mode,
the message “No Programs” appears on the display and only the NEW item
(3) is shown in the function menu.
The values to the right of the program list indicate the number of bytes used up
by each program.
20-2Programming Examples
Example 1 To calculate the surface area and volume of three regular
The following are the formulas used for calculating surface area S and volume V
of a regular octahedron for which the length of one side is known.
When inputting a new formula, you first register the file name and then input the
actual program.
uu
uTo register a file name
uu
ExampleTo register the file name OCTA
•Note that a file name can be up to eight characters long.
1. Display the program list menu and press 3 (NEW) to display a menu, which
•{RUN}/{BASE} ... {general calculation}/{number base} program input
P. 360•{
•{SYBL} ... {symbol menu}
octahedrons of the dimensions shown in the table below
Store the calculation formula under the file name OCTA.
Length of One Side (A)Surface Area (S)Volume (V)
7 cmcm
10 cmcm
A
S = 2 3 A2,V = –––– A
15 cmcm
3
contains the following items.
QQ
Q} ... {password registration}
QQ
2
2
2
2
3
cm
cm
cm
3
3
3
2. Input the name of the file.
OCTA
• The cursor changes form to indicate alpha character input.
• The following are the characters you can use in a file name:
A through Z, r, θ, spaces, [, ], {, }, ’, ”, ~, 0 through 9, ., +, –, ×, ÷
•Note, however, that v and . cannot be input for the name of a program
that contains binary, octal, decimal, or hexadecimal calculations.
353
20 - 2 Programming Examples
•Use 1 (RUN) to input a program for general calculations (a program to be
executed in the COMP Mode). For programs that involve number system
specifications, use 2 (BASE). Note that programs input after pressing 2
(BASE) are indicated by
•Pressing 6 (SYBL) displays a menu of symbols ( ’, ”, ~ ) that can be input.
•You can delete a character while inputting a file name by moving the cursor to
the character you want to delete and pressing D.
3. Press w to register the file name and change to the program input screen.
•Registering a file name uses 17 bytes of memory.
• The file name input screen remains on the display if you press w without
inputting a file name.
•To exit the file name input screen and return to the program list without
registering a file name, press J.
•When you register the name of a program that contains binary, octal, decimal,
or hexadecimal calculations, the indicator B is appended to the right of the file
name.
uu
uTo input a program
uu
The following items are included in the function menu of the program input screen,
which is used for program input.
P. 365•{TOP}/{BTM} ... {top}/{bottom} of program
P. 364• {SRC} ... {search}
• {MENU} ... {mode menu}
• {SYBL} ... {symbol menu}
B
to the right of the file name.
File name
354
P. 3
uu
uTo change modes in a program
uu
•Pressing 4 (MENU) while the program input screen is on the display causes
a mode change menu to appear. You can use this menu to input mode
changes into your programs.
•{STAT}/{MAT}/{LIST}/{GRPH}/{DYNA}/{TABL}/{RECR}
For details on each of these modes, see “To select an icon”, as well as the
sections of this manual that describe what you can do in each mode.
• The following menu appears whenever you press 4 (MENU) while inputting a
program that involves number base specifications.
•{d ~ o}/{LOG}
Programming Examples20- 2
•Pressing 6 (SYBL) displays a menu of symbols ( ’, ”, ~, *, /, # ) that can be
input into a program.
•Pressing ! Z displays a menu of commands that can be used to change
set up screen settings inside a program.
P. 5For details on each of these commands, see “Set Up Screen Function Key
Menus”.
The following function key menu appears if you press !Z while inputting a
program that contains binary, octal, decimal, or hexadecimal calculation.
•{Dec}/{Hex}/{Bin}/{Oct}
Actual program contents are identical to manual calculations. The following shows
how the calculation of the surface area and volume of a regular octahedron would
be calculated using a manual calculation.
Surface Area S .. c*!9d* <value of A> xw
Volume V ........... !9c/d* <value of A> Mdw
You could also perform this calculation by assigning the value for the length of one
side to variable A.
Length of One Side A
............ <value of A> aaAw
Surface Area S .. c*!9d*aAxw
Volume V ........... !9c/d*aA Mdw
If you simply input the manual calculations shown above however, the calculator
would execute them from beginning to end, without stopping. The following
commands make it possible to interrupt a calculation for input of values and
display of intermediate results.
?: This command pauses program execution and displays a question mark as a
prompt for input of a value to assign to a variable. The syntax for this command is: ? → <variable name>.
^^
^: This command pauses program execution and displays the last calculation
^^
result obtained or text. It is similar to pressing w in a manual calculation.
P. 369• For full details on using these and other commands, see “Useful Program
Commands”.
355
20- 2 Programming Examples
The following shows examples of how to actually use the ? and ^ commands.
!W4(?)aaA6(g)5(:)
c*!9d*aAx
6(g)5(^)
!9c/d*aAMd
!Q or JJ
uu
uTo r un a program
uu
1. While the program list is on the display, use f and c to highlight the name
of the program you want to run.
2. Press 1 (EXE) or w to run the program.
Let’s try running the program we input above.
Length of One Side (A)Surface Area (S)Volu me (V)
7 cm169.7409791 cm2161.6917506 cm
10 cm346.4101615 cm2471.4045208 cm
15 cm779.4228634 cm21590.990258 cm
3
3
3
356
1 (EXE) or w
hw
(Value of A)
ww
baw
Intermediate result produced by
^
Programming Examples20- 2
w
··
··
··
··
··
•Pressing w while the program’s final result is on the display re-executes the
program.
P. 378•You can also run a program while in the RUN Mode by inputting:
Prog ”<file name>” w.
•An error occurs if the program specified by Prog ”<file name>” cannot be
found.
··
357
20-3Debugging a Program
A problem in a program that keeps the program from running correctly is called a
“bug,” and the process of eliminating such problems is called “debugging.” Either
of the following symptoms indicates that your program contains bugs and that
debugging is required.
•Error messages appearing when the program is run
•Results that are not within your expectations
uu
uTo eliminate bugs that cause error messages
uu
An error message, like the one shown below, appears whenever something illegal
occurs during program execution.
P. 436error was generated, along with the cursor. Check the “Error Message Table” for
P. 360•Note that pressing d or e will not display the location of the error if the
P. 365contents of the program and make necessary changes. See “Editing File Names
When such a message appears, press d or e to display the location where the
steps you should take to correct the situation.
program is password protected.
uu
uTo eliminate bugs that cause bad results
uu
If your program produces results that are not what you normally expect, check the
and Program Contents” for details on how to change program contents.
358
20-4Calculating the Number of Bytes Used by a
Program
There are two types of commands: 1-byte* commands and 2-byte* commands.
*A byte is a unit of memory that can be used for storage of data.
• Examples of 1-byte commands: sin, cos, tan, log, (, ), A, B, C, 1, 2, etc.
• Examples of 2-byte commands: Lbl 1, Goto 2, etc.
While the cursor is located inside of a program, each press of d or e causes
the cursor to move one byte.
•You can check how much memory has been used and how much remains at
P. 2 4Mode. See “Memory Status (MEM)” for details.
any time by selecting the MEM icon in the Main Menu and entering the MEM
359
20-5Secret Function
When inputting a program, you can protect it with a password that limits access to
the program contents to those who know the password. Password protected
programs can be executed by anyone without inputting the password.
uu
uTo register a password
uu
ExampleTo create a program file under the name AREA and protect it
with the password CASIO
1. While the program list is on the display, press 3 (NEW) and input the file
name of the new program file.
3(NEW)
AREA
2. Press 5 (Q) and then input the password.
5(Q)
CASIO
P. 353• The password input procedure is identical to that used for file name input.
3. Press w to register the file name and password. Now you can input the
contents of the program file.
•Registration of a password uses 16 bytes of memory.
•Pressing w without inputting a password registers the file name only, without
a password.
360
4. After inputting the program, press ! Q to exit the program file and return
to the program list. Files that are password protected are indicated by an
asterisk to the right of the file name.
uu
uTo r ecall a program
uu
ExampleTo recall the file named AREA which is protected by the
password CASIO
1. In the program list, use f and c to move the highlighting to the name of the
program you want to recall.
Secret Function20- 5
2. Press 2 (EDIT).
3. Input the password and press w to recall the program.
• The message “Mismatch” appears if you input the wrong password.
361
20-6Searching for a File
There are three different methods for searching for a specific file name.
uu
uTo find a file using scroll search
uu
ExampleTo use scroll search to recall the program named OCTA
1. While the program list is on the display, use
f and c to scroll through the list of
program names until you find the one you
want.
2. When the highlighting is located at the name
of the file you want, press 2 (EDIT) to
recall it.
uu
uTo find a file using file name search
uu
ExampleTo use file name search to recall the program named OCTA
1. While the program list is on the display, press 3 (NEW) and input the name of
the file you want to find.
P. 360• If the file you are looking for is password protected, you should also input the
password.
3(NEW)
OCTA
1 2 34 56
362
2. Press w to recall the program.
• If there is no program whose file name matches the one you input, a new file is
created using the input name.
uu
uTo find a file using initial character search
uu
ExampleTo use initial character search to recall the program named
OCTA
1. While the program list is on the display, press 6 (g) 1 (SRC) and input the
initial characters of the file you want to find.
6(g)1(SRC)
OCT
Searching for a File20-
2. Press w to search.
•All files whose file names start with the characters you input are recalled.
• If there is no program whose file name starts with the characters you input, the
message “Not Found” appears on the display. If this happens, press J to
clear the error message.
3. Use f and c to highlight the file name of the program you want to recall
and then press 2 (EDIT) to recall it.
6
363
20-7Searching for Data Inside a Program
ExampleTo search for the letter “A” inside the program named OCTA
1. Recall the program.
2. Press 3 (SRC) and input the data you want to search for.
3(SRC)
aA
•You cannot specify the newline symbol (_) or display command (^) for the
search data.
3. Press w to begin the search. The contents of the program appear on the
screen with the cursor located at the first instance of the data you specified.
364
Indicates search operation is in progress
4. Press w to find the next instance of the data.
• If there is no match inside the program for the data you specified, the contents
of the program appear with the cursor located at the point from which you
started your search.
•Once the contents of the program are on the screen, you can use the cursor
keys to move the cursor to another location before searching for the next
instance of the data. Only the part of the program starting from the current
cursor location is searched when you press w.
•Once the search finds an instance of your data, inputting characters or moving
the cursor causes the search operation to be cancelled (clearing the Search
indicator from the display).
• If you make a mistake while inputting characters to search for, press A to
clear your input and re-input from the beginning.
20-8Editing File Names and Program Contents
uu
uTo edit a file name
uu
ExampleTo change the name of a file from TRIANGLE to ANGLE
1. While the program list is on the display, use f and c to move the highlighting to the file whose name you want to edit and then press 6 (g) 2 (REN).
2. Make any changes you want.
DDD
3. Press w to register the new name and return to the program list.
• If the modifications you make result in a file name that is identical to the name
of a program already stored in memory, the message “Already Exists”
appears. When this happens, you can perform either of the following two
operations to correct the situation.
•Press e or d to clear the error and return to the file name input screen.
•Press A to clear the new file name and input a new one.
uu
uTo edit program contents
uu
1. Find the file name of the program you want in the program list.
2. Recall the program.
• The procedures you use for editing program contents are identical to those
P. 2 0used for editing manual calculations. For details, see “Editing Calculations”.
• The following function keys are also useful when editing program contents.
P. 353
1 (TOP) ....... Moves the cursor to the top
2 (BTM) ....... Moves the cursor to the
Example 2To use the OCTA program to create a program that calculates
of the program
bottom of the program
the surface area and volume of regular tetrahedrons when the
length of one side is known
365
Loading...
+ 33 hidden pages
You need points to download manuals.
1 point = 1 manual.
You can buy points or you can get point for every manual you upload.