Page 1
Chapter Programming 1. Before Programming 2. Programming Examples 3. Debugging a Program 4. Calculating the Number of Bytes Used by a Program 5. Secret Function 6. Searching for a File 7. Editing Program Contents 8. Deleting a Program 9. Useful Program Commands 10.
Chapter 8 Programming 1. Before 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 File Name File Name...
Programming Chapter 8 2. Programming Examples Example 1 To calculate the surface area and volume of three regular 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 cm...
Chapter 8 Programming • Pressing 4 (SYBL) displays a menu of symbols that can be input. 4(SYBL) • 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.
Page 5
Programming Chapter 8 u u u u u To change modes in a program • Pressing 3 (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.
Page 6
Chapter 8 Programming Surface Area S ... c*!9d*aAxw Volume V .... !9c/d*aAMdw If you simply input the manual calculations shown above however, the calculator would execute them from beginning to end, without stopping. The following com- mands make it possible to interrupt a calculation for input of values and display of intermediate results.
Page 7
Programming Chapter 8 1 (EXE) or w (Value of A) Intermediate result produced by ^ • Pressing w while the program’s final result is on the display re-executes the program. P.149 • You can also run a program while in the RUN Mode by inputting: Prog ”<file name>”...
Chapter 8 Programming 3. Debugging 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 debug- ging is required.
To register a password Example To 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.
To recall a program Example To 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.
Programming Chapter 8 u u u u u To find a file using file name search Example To 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.
Page 12
Chapter 8 Programming 2. Recall the program. • The procedures you use for editing program contents are identical to those used P.20 for editing manual calculations. For details, see “Making Corrections”. • The following function keys are also useful when editing program contents. 1 (TOP) ..
Page 13
Programming Chapter 8 As you can see, you can produce the TETRA program by making the following changes in the OCTA program. • Deleting c * (underlined using a wavy line above) • Changing d to b c (underlined using a solid line above) Let’s edit the program.
Chapter 8 Programming 8. Deleting a Program There are two different ways to delete a file name and its program. • Specific program delete • All program delete u u u u u To delete a specific program 1. While the program list is on the display, use f and c to move the highlighting to the name of the program you want to delete.
Programming Chapter 8 [2(DEL•A) 2. Press 1 (YES) to delete all the programs in the list or 4 (NO) to abort the operation without deleting anything. P.37 • You can also delete all programs using the MEM Mode. See “Clearing Memory Contents”...
Page 16
Chapter 8 Programming Program Command Menu (COM) While the program menu is on the display, press 1 (COM) to display the program command menu. 1(COM) 1 (If) ..... If command 2 (Then) ..Then command 3 (Else) ..Else command 4 (I•End) ..
Page 17
Programming Chapter 8 Jump Command Menu (JUMP) While the program menu is on the display, press 3 (JUMP) to display the jump command menu. 3(JUMP) 1 (Lbl) ..Lbl command 2 (Goto) ..Goto command 3 (⇒) ... ⇒ (jump) command 1 (Isz) ..
Page 18
Chapter 8 Programming 3(TABL) 1 (Tabl) ..DispTable command 2 (G•Con) ..DrawTG-Con command 3 (G•Plt) ..DrawTG-Plt command Conditional Jump Relational Operator Menu (REL) While the program menu is on the display, press [ [ 1 (REL) to display the conditional jump relational operator menu.
Programming Chapter 8 10. Command Reference k k k k k Command Index Break ..................149 ClrGraph ................153 ClrList..................153 ClrText................... 153 DispTable ................154 Do~LpWhile ................148 DrawTG-Con, DrawTG-Plt ............. 154 DrawGraph ................154 DrawStat ................153 Dsz ..................151 For~To~Next ................147 For~To~Step~Next ..............147 Goto~Lbl ................
Page 20
Chapter 8 Programming [Square Brackets] ..Square brackets are used to enclose items that are op- tional. Do not input the square brackets when inputting a command. Numeric Expressions . Numeric expressions (such as 10, 10 + 20, A) indicate con- stants, calculations, numeric constants, etc.
Page 21
Programming Chapter 8 Description: 1. Operation of the carriage return is identical to that of the multi-statement com- mand. 2. Using a carriage return in place of the multi-statement command makes the dis- played program easier to read. k k k k k Program Commands (COM) If~Then Function: The Then-statement is executed only when the If-condition is true (non- zero).
Page 22
Chapter 8 Programming If~Then~Else Function: The Then-statement is executed only when the If-condition is true (non- zero). The Else-statement is executed when the If-condition is false (0). Syntax: <condition> Then <statement> <statement> numeric expression Else <statement> <statement> Parameters: condition, numeric expression Description: 1.
Page 23
Programming Chapter 8 For~To~Next Function: This command repeats everything between the For-statement and the Next-statement. The starting value is assigned to the control variable with the first execution, and the value of the control variable is incremented by one with each execution.
Page 24
Chapter 8 Programming Description: 1. This command is basically identical to For~To~Next. The only difference is that you can specify the step. 2. Omitting the step value automatically sets the step to 1. 3. Making the starting value less than the ending value and specifying a positive step value causes the control variable to be incremented with each execution.
Page 25
Programming Chapter 8 Description: 1. This command repeats the commands contained in the loop as long as its condi- tion is true (non-zero). When the condition becomes false (0), execution pro- ceeds from the statement following the WhileEnd-statement. 2. Since the condition comes after the While-statement, the condition is tested (checked) before the commands inside the loop are executed.
Page 26
Chapter 8 Programming 3. A subroutine can be used in multiple locations in the same main routine, or it can be called up by any number of main routines. Main Routine Subroutines Prog ”D” Prog ”C” Prog ”E” Prog ”I” Prog ”J”...
Page 27
Programming Chapter 8 Example: For 2 → I To 10_ If I = 5_ Then ”STOP” : Stop_ IfEnd_ Next This program counts from 2 to 10. When the count reaches 5, however, it terminates execution and displays the message ”STOP.” k k k k k Jump Commands (JUMP) Function: This command is a count jump that decrements the value of a control variable by 1, and then jumps if the current value of the variable is zero.
Page 28
Chapter 8 Programming 3. This command can be used in combination with conditional jumps and count jumps. 4. If there is no Lbl-statement whose value matches that specified by the Goto- statement, an error (Go ERROR) occurs. Example: ? → A : ? → B : Lbl 1 : ? →...
Page 29
Programming Chapter 8 Description: 1. The conditional jump compares the contents of two variables or the results of two expressions, and a decision is made whether or not to execute the jump based on the results of the comparison. 2. If the comparison returns a true result, execution continues with the statement following the ⇒...
Page 30
Chapter 8 Programming Description: This command draws a statistical graph in accordance with conditions defined within the program. DrawGraph Function: This command draws a graph. Syntax: DrawGraph_ Description: This command draws a graph in accordance with the drawing condi- tions defined within the program. DispTable Function: These commands display numeric tables.
Page 31
Programming Chapter 8 Send ( Function: This command sends data to an external device. Syntax: Send (<data>) (…ex. Send (List 1)) Description: 1. This command sends data to an external device. 2. The following types of data can be sent by this command. •...
Chapter 8 Programming 11. Text Display You can include text in a program by simply enclosing it between double quotation marks. Such text appears on the display during program execution, which means you can add labels to input prompts and results. Program Display ? →...
Page 33
Programming Chapter 8 Executing this program produces the result shown here. k k k k k Using Table & Graph Functions in a Program P.74 Table & Graph functions in a program can generate numeric tables and perform graphing operations. The following shows various types of syntax you need to use when programming with Table &...
Page 34
Chapter 8 Programming Executing this program produces the results shown here. Numeric Table Graph k k k k k Using List Sort Functions in a Program P.82 These functions let you sort the data in lists into ascending or descending order. •...
Page 35
Programming Chapter 8 The graph conditions that are required depends on the graph type. See “Changing Graph Parameters”. • The following is a typical graph condition specification for a scatter diagram or line graph. S-Gph1 DrawOn, Scatter, List1, List2, 1, Square_ In the case of an line graph, replace “Scatter”...
Page 36
Chapter 8 Programming Example Program !Z[[[1Q ClrGraph_ S-WindAuto_ {1, 2, 3} → List 1_ {1, 2, 3} → 3121Q List 2_ 3111Q S-Gph1 DrawOn, 312[1Q Scatter, List1, List2, 1, Square_ 3141Q DrawStat !W[41Q Executing this program produces the scatter diagram shown here. k k k k k Performing Statistical Calculations •...
Page 37
Programming Chapter 8 • Regression statistical calculation LinearReg List 1, List 2, List 3 Frequency data (Frequency) Calculation type* -axis data (YList) -axis data (XList) 31[1[1Q * Any one of the following can be specified as the calculation type. LinearReg ..linear regression Med-MedLine ..
Need help?
Do you have a question about the fx-7400G PLUS and is the answer not in the manual?
Questions and answers