background image

 
 

PERSONAL COMPUTER 

FX-890P / Z-1 / Z-1GR 

OWNER’S MANUAL 

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
This manual has been written by a non-Japanese speaking CASIO fan to help other 
non-Japanese speaking CASIO fans to make the best out of their FX-890P, Z-1GR, 
Z-1GRa or Z-1GR pocket computer. It is based on the Japanese Z-1 users’ manual, 
the FX-880 & PB2000C English manuals, and all kind of other information gathered 
on the web. Even if most of the content is based on material with a CASIO copyright, 
the company CASIO cannot be held responsible for any inaccuracy within this 
document. 
This document is not intended for any commercial purpose. Do not pay anything for 
it, and use it at your own risk. 
 
Thanks to Ledudu.com, Daniel Pratlong, Marcus von Cube, and all the other guys 
whose information posted on the web helped me with this project. 

Summary of Contents for FX-890P

Page 1: ...FX 880 PB2000C English manuals and all kind of other information gathered on the web Even if most of the content is based on material with a CASIO copyright the company CASIO cannot be held responsible for any inaccuracy within this document This document is not intended for any commercial purpose Do not pay anything for it and use it at your own risk Thanks to Ledudu com Daniel Pratlong Marcus vo...

Page 2: ... Mode 16 2 4 C Mode 17 2 5 CASL Mode 17 2 6 Assembler Mode 17 3 Calculation Function 18 3 1 Manual Calculation Preparations 18 3 2 Manual Calculation Input and Correction 18 3 3 Priority Sequence 20 3 1 Scientific Calculations 21 3 1 1 Trigonometric and Inverse Trigonometric Functions 21 4 Formula Storage Function 22 4 1 Utilization for Preparing Tables 23 5 BASIC Programming 26 5 1 Features of BA...

Page 3: ...terpreter 77 6 2 C Program Input 78 6 2 1 About the C Interpreter and Editor 78 6 2 2 Activating the C mode 78 6 2 3 Using the Editor 79 6 1 C Program Execution 82 6 1 1 To execute a program 82 6 1 1 Using Command line Operation 82 6 1 2 Using the Trace Function 82 6 2 Introduction to C 84 6 2 1 Outputting characters 84 6 2 2 Variable types and operations 88 6 2 3 Entering characters and values 90...

Page 4: ...4 6 3 C Command Reference 111 6 3 1 Manual Commands 111 6 3 1 Fundamental commands 112 6 3 1 Mathematical Functions 118 6 3 2 String Functions 123 6 3 3 Graphical Functions 125 6 4 C Commands Index 126 ...

Page 5: ...r Key Engineering Key Alphabet Keys Space Key CAPS Key Cursor Keys Insert Delete Keys Break Key Backspace Clear Line Key Clear Screen Home Key Menu Sub Menu Key Calculator Key Program Area Keys Function Keys Formula Storage Keys ALL RESET Button 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 1 2 4 5 6 7 8 9 10 11 12 13 14 15 16 18 3 19 20 22 17 23 24 ...

Page 6: ...nter the arithmetic operators noted on the keys Addition Substraction Multiplication Division Execute Key Finalizes entry of a calculation and produces the result The function of this key is equivalent to an key on a standard calculator This key is also used to enter lines of a program and for actual execution of programs Parentheses Keys Enter parentheses in such parenthetical calculations as 5 x...

Page 7: ...h DEL deletes the character at the current cursor position and automatically fills in the space by shifting everything to the right of the cursor one space to the left Holding down either of these keys causes continuous high speed operation of the respective function Break Key BRK Terminates manual operations program execution printer output and LIST output Also reactivates the power supply when i...

Page 8: ...L mode Specifies a program area for writing or editing in the BASIC mode Function Keys log ln sin etc Allow one touch entry of often used functions Direct input functions 2 x2 log ln DEGR sin cos tan p Shift functions 3 x3 10x ex DMS sin 1 cos 1 tan 1 H HEX FACT Formula Storage Keys IN OUT CALC Used when working with the formula storage fuction See PART 4 FORMULA STORAGE FUNCTION for details ALL R...

Page 9: ...tus of a calculation CAPS S BASIC DEG RAD GRA CAPS Upper case alphabetic characters lower cases when not displayed S Shift mode commands functions marked above the keys can be input BASIC BASIC mode BASIC program input editing execution DEG Angle unit degrees RAD Angle unit radians GRA Angle unit grads ...

Page 10: ...e keys themselves this status is automatically set when power is switched ON and immediately following a RESET procedure EXAMPLE Operation Display A A E E Lower Case Mode Pressing the CAPS key shifts the alphabetic keys only to lower case characters indicated by the CAPS symbol disappearing from the display Pressing the CAPS key once locks the keyboard into the lower case mode while pressing again...

Page 11: ... a logical line A logical line is a continuous line of characters in which any column on the extreme right of the screen is not a null One physical line One physical line 1 2 3 4 5 6 7 8 9 10 11 12 12 14 15 16 17_ One logical line from the first character to the last Pressing Shift moves the cursor to the beginning of the logical line while Shift moves the cursor to the end of the logical line The...

Page 12: ...d batteries should be replaced as soon as possible 1 6 Display Characters The relationship between characters and character codes is illustrated in the following table Character Code Table High order digit 0 16 32 48 64 80 96 112 128 144 160 176 192 208 224 240 HEX 0 1 2 3 4 5 6 7 8 9 A B C D E F 0 0 SPC 0 P p Ä 0 SPC タ ミ 1 1 DEL 1 A Q a q 1 ア チ ム 円 2 2 LINE TOP INS 2 B R b r 2 イ ツ メ 年 3 3 3 C S c...

Page 13: ...osition 3 To replace the memory backup battery position the internal switch to the left slide the cover of the battery compartment and replace the CR2032 battery Put back the internal switch in its central position 4 Replace the rear panel on the unit and three screws to hold it in place 1 8 Auto Power Off The power of the unit is automatically switched OFF approximately 6 minutes after the last k...

Page 14: ...o go back to the SYSTEM menu 4 Test of the Random Access Memory This test will return the amount of RAM in the unit main and optional extension pack and test it by writing and reading it returning CHECK OK when successful Press any key to go back to SYSTEM menu 5 Writing test of the RAM This is the first phase of the 4 RAM test 6 Reading test of the RAM This is the second phase of the 4 RAM test a...

Page 15: ...on is identical to that used in a standard calculator The CAL mode can be entered from another mode by pressing the CAL key 2 2 Formula Storage Function The formula storage function makes it possible to store often used formulas in memory for calculation when values are assigned to variables This function is applied in the CAL mode using the IN OUT and CALC keys EXAMPLE Determining the selling pri...

Page 16: ...y by simply assigning values for the variables See PART 4 FORMULA STORAGE FUNCTION for details The BRK key can be used to terminate this function 2 3 BASIC Mode The BASIC mode is used for the creation execution and editing of BASIC programs The BASIC mode can be entered from another mode by pressing MENU 2 EXAMPLE Create and execute a program that calculates the sum of two values A and B PROGRAM I...

Page 17: ...0 9 Press R Run to run the C program Press L Load to load the C program for the interpreter Press S Source to edit the C source code S O M A I N Shift SPC P R I N T F CAPS H E L L O Shift CAPS N Shift main printf HELLO n Shift SUB MENU L Load F0 R U N run HELLO 2 5 CASL Mode The CASL mode is used for the creation execution and editing of the assembler language dedicated to the virtual machine COME...

Page 18: ...is switched OFF 3 2 Manual Calculation Input and Correction Perform the following fundamental calculations to become familiar with this mode EXAMPLE 123 456 579 123 456 Formula input 123 456_ Obtains result 123 456 579 As can be seen here the key is pressed in place of The key is used for multiplication and is used for division The following procedure can be used to correct entered data EXAMPLE 33...

Page 19: ...for input of characters or symbols The Shift DEL key is used to delete characters at the current cursor location ABCDEFGH Shift DEL ABCEFGH The BS key can also be used to delete characters but its operation is slightly different from the Shift DEL ABCDEFGH BS ABDEFGH Practice the following examples to become familiar with the fundamental calculation procedure EXAMPLE 1 9 7 8 6 3 5 x 2 3 3 OPERATIO...

Page 20: ...6 567 23 456 479 567 271593 The last result obtained can be entered at any point in a subsequent calculation by pressing the ANS key EXAMPLE 5 81 3 5 6 8 9 5 6 This process performed first OPERATION 5 6 8 9 81 2 ANS 5 6 8 9 14 5 81 2 14 5 5 6 3 3 Priority Sequence Arithmetic relational and logical operations are performed in the following priority sequence 1 2 Functions 3 Power 4 Signs 5 MOD 6 7 R...

Page 21: ...ons are used Angle unit specification is only required once for all subsequent trigonometric inverse trigonometric functions Angle units can be specified using either the MODE command or the ANGLE command DEG Degrees ANGLE0 MODE4 RAD Radians ANGLE1 MODE5 GRAD Grads ANGLE2 MODE6 It is as well possible to use the MENU 7 The relationship among these three specifications is 90 Degrees π 2 Radians 100 ...

Page 22: ... of the value assigned to x when y 3 43 cosx Calculate in three decimal places x 8 15 22 27 31 y OPERATION First specify the angle unit and number of decimal places MENU 7 select the DEG unit using the cursor keys Exit the angle units selection menu pressing the CAL key Shift SET F 3 Obtain in 3 decimal places by rounding off the 4th decimal place Next input a formula and press IN key to store it ...

Page 23: ...ey to perform repeat calculations The BRK key can be used to terminate this function to automatically return to the CAL mode 4 1 Utilization for Preparing Tables Multiple formulas can be written by separating with colons Tables such as that shown below can be easily prepared by using this method EXAMPLE Complete the following table Calculate in 3 decimal places by rounding off X Y P X Y Q X Y 4 27...

Page 24: ... up to 15 upper case or lower case alphabetic characters This means that variable names can be created which actually describe their contents Remarks can also be affixed following variable names by enclosing the remarks within square brackets Any character except for commas can be used within the remarks brackets EXAMPLE Complete the following table Calculate in two decimal places by rounding off ...

Page 25: ...h m 3 Volume of a cone V1 1 3 V0 m 3 1 205 2 174 3 357 2 227 3 451 7 463 10 16 51 24 262 22 3 39 17 08 88 07 IMPORTANT 1 Up to 255 characters can be stored using the IN key Storing new formula clears the currently stored formula 2 Memory contents are retained even when power is switched OFF either manually or by the auto power OFF function 3 The CALC key can only be used to execute numeric express...

Page 26: ...DEG Powerful string handling functions CHR STR MID LEFT RIGHT HEX DMS ASC VAL LEN High level mathematical functions POL REC NCR NPR HYPSIN HYPCOS HYPTAN HYPASN HYPACS HYPATN CUR 3 10 independent program areas up to ten programs can be stored independently in memory at the same time P0 9 4 Extended variable names Variable names up to 15 characters long can be used making it possible to use names th...

Page 27: ...t Lines can be numbered using any value from 1 to 65535 20 R 15 40 V PI R 2 H 60 END 10 REM CYLINDER 30 INPUT H H 50 PRINT V V 10 REM CYLINDER 20 R 15 30 INPUT H H 40 V PI R 2 H 50 PRINT V V 60 END Input sequence Memory contents Following the line number is a statement or statements which actually tell the computer which operation to perform The following returns to the sample program to explain e...

Page 28: ...ning in area for writing programs and data free area This number depends on the type of unit FX 890P Z1 the presence of the optional RP 33 memory module and will decrease as storage space is used Ready P0 Current program area area 0 The current program area can be switched by pressing Shift followed by the desired program area Previously stored programs can be deleted using one of two different pr...

Page 29: ...EDIT command Changes in a line before key is pressed EXAMPLE 20 E 15 mistakenly input for 20 R 15 10 REM CYLINDER 20 E 15_ Move cursor to E 10 REM CYLINDER 20 E 15 R Input correct character 10 REM CYLINDER 20 R 15 Editing complete 10 REM CYLINDER 20 R 15 _ Note that once the desired changes are made the key must be pressed to store the entered line into memory Changes in a line after key is presse...

Page 30: ...eys to scroll to preceding lines not shown on the display When a program greater than eight lines is stored in memory the LIST operation should be performed by specifying the line numbers to be displayed EXAMPLE Displaying from line 110 to line 160 on the virtual screen Shift LIST 110 160 Note The BRK key can be used to terminate the LIST operation The Shift STOP key suspends the operation and lis...

Page 31: ...n memory it can be executed using one of the two following procedures Using Shift program area in CAL mode EXAMPLE Shift P9 Executes the program in program area 9 Entering RUN command in BASIC mode EXAMPLE Shift RUN Executes the program in the current program area Execute the program input in the previous section to determine the volume of a cylinder with a height ao 10 radius is fixed at 15 Shift...

Page 32: ...isplay the line in which the error was detected Shift LIST 10 Shift EDIT 10 Shift LIST Shift EDIT The periods contained in LIST and EDIT instruct the computer to automatically display the last program line executed Irregular execution that do not produce errors Such errors are also caused by a flaw in the program and must be corrected by executing the LIST or EDIT command to examine the program to...

Page 33: ...hort for the word remarks The computer disregards anything following a REM command and so it is used for such purposes as labels in order to make the program list itself easier to follow Note that a single quotation mark Shift can be used in place of the letters REM 5 5 2 INPUT The INPUT command line 30 is used to allow input from the computer s keyboard during program execution The data input are...

Page 34: ... entered by the operator in line 30 5 5 8 READ DATA RESTORE These statements lines 50 180 20 are used when the amount of data to be handled is too large to require keyboard input with every execution In this case data are included within the program itself The READ command assigns data to variables the DATA statement holds the data to be read and the RESTORE command is used to specify from which p...

Page 35: ... S X 90 NEXT I 100 GOSUB Root 110 PRINT S Y Z 120 GOTO Start 130 Finish END 140 Root REM SQR CUBE ROOT 150 Y SQR S 160 Z CUR S 170 RETURN 180 DATA 9 7 20 28 36 Clear current total assigned to S Specifies read op should begin with 1st data item Input the number of data items to be read Input of values greater than 5 is treated as 5 Jump to program end when input is zero This section is repeated the...

Page 36: ...e beginning of the strings This is to say that the first position of string A is compared to the first position of string B the second position of string A with the second position of string B etc The result of the comparison is based upon the character codes of the first difference between the strings detected regardless of the length of the strings being compared EXAMPLES STRING A STRING B RESUL...

Page 37: ...the string AD1990 being assigned to variable A Order of Operations Arithmetic relational and logical operations are performed in the following order of precedence 1 2 Scientific function 3 Power 4 Sign 5 MOD 6 Addition and subtraction 7 Relational operators 8 NOT 9 AND 10 OR XOR Operations are performed from left to right when the order of precedence is identical 5 7 Constants and Variables 5 7 1 ...

Page 38: ... String Variables Another type of variable is known as a string variable which is used to store character string data String variable names are indicated by following the name EXAMPLE 10 A AD Assigns AD to string variable A 20 INPUT YEAR B Assigns keyboard input to variable B 30 C A B Assigns combination of A and B to C 40 PRINT C Displays contents of C 50 END In the above program example entering...

Page 39: ...s or boxes These are known as one dimensional arrays Arrays may also contain more than one dimension with elements connected vertically and horizontally into two dimensional and three dimensional arrays EXAMPLE DIM A 2 3 The declaration in this example sets up an array of three lines and four columns making it capable of storing 12 different values As with simple variables arrays can also be decla...

Page 40: ...r numeric characters but a numeric character cannot be used in the first position of the variable name i e 1AE 3BC are illegal Reserved words see page 75 cannot be used as the leading characters of a variable name i e RUNON LIST1 are illegal The maximum length of a variable name is 15 character Arrays 1 Arrays are declared by DIM statements 2 Elements described by subscripts which are integer grea...

Page 41: ...ost quantity String expressions String constants string variables and string expressions e g ABC A A B Expressions General term for numeric and string expressions Arguments Elements used by commands and functions Can only be executed in a program Can only be executed manually Can be executed both manually and in a program Function instruction that can be executed both manually and in a program EXA...

Page 42: ...eviously registered password cancels the password Specifying a password that is different from that registered results in a PR error 5 The following operations and commands cannot be executed when a password is registered Program write LIST LIST ALL LIST NEW NEW ALL NEW EDIT NEW ALL PURPOSE Deletes a program FORMAT NEW ALL EXAMPLE NEW EXPLANATION 1 Deletes the program in the currently specified pr...

Page 43: ...strings and assembler area sizes to avoid a BS Error The current value can be obtained through FRE 2 EXPLANATION 1 Clear all variables 2 Strings assembler or variables areas cannot be set during program execution 3 If assembler area size and variable area size are omitted these values will remain unchanged 4 If strings area size is omitted the CLEAR statement will clear all variables without chang...

Page 44: ...Total free area in Bytes This is what returns FRE 1 Variables free area in Bytes This value is inferior or equal to memory area size This is what returns FRE 5 SEE FRE CLEAR SYSTEMP PURPOSE Shows memory status of BASIC program areas P0 P9 FORMAT SYSTEMP EXAMPLE SYSTEMP P0 0 P1 0 P2 0 P3 0 P4 0 P5 0 P6 0 P7 0 P8 0 P9 0 EXPLANATION The number following each Pn is the amount of Bytes the program area...

Page 45: ... d LIST 200 From line 200 through end of program e LIST 80 From beginning of program through line 80 4 Using a period in place of the line number displays the most recently handled i e written edited executed If a program is halted during execution by an error executing LIST displays the line in which the error was generated 5 When the specified start line number does not exist the first line numb...

Page 46: ...ays the most recently handled i e written edited executed If a program is halted during execution by an error executing EDIT displays the line in which the error was generated 3 When the specified start line does not exist the first line number above that specified is taken as the start line number 4 It is possible to change the line number in EDIT mode by using either or key 5 This mode is cancel...

Page 47: ...that specified is taken as the start line number 3 Variable and array values are not cleared 4 This command cannot be used within a program 5 This command cannot be used in the CAL mode TRON PURPOSE Specifies the trace mode EXAMPLE TRON EXPLANATION 1 Switches the trace mode ON 2 All subsequent program execution is accompanied by a display of the area name and line number The first two lines are di...

Page 48: ...ts program execution EXAMPLE STOP EXPLANATION 1 Temporarily halts program execution Program area and line number of the STOP statement are displayed Execution can be resumed by entering the CONT command or pressing Shift CONT 2 Open files variable values and array values are retained as they are at the point when execution is halted WAIT PURPOSE Pauses program execution for a certain time FORMAT W...

Page 49: ... Program area number single character 0 9 3 Label Name of a label in the program EXPLANATION 1 Specifying a line number causes program execution to jump to that line number in the current program area 2 Specifying a program area number causes program execution to jump to the first line number of the specified program area 3 Specifying a label name causes program execution to jump to that label in ...

Page 50: ...r label Execution is returned from the subroutine by the RETURN statement 2 Subroutines can be nested up to 96 levels Exceeding this value results in an OM error 3 An UL error is generated when the specified line number or label name does not exist 4 CLEAR command cannot be used within a subroutine SEE RETURN RETURN PURPOSE Returns execution from a subroutine to the main program FORMAT RETURN EXAM...

Page 51: ...area number single character 0 9 4 Label Name of a label in the program EXPLANATION 1 The GOTO statement is executed in accordance with the value of the expression used for the branch condition For example execution jumps to the first branch destination when the value is 1 to the second destination when the value is 2 etc 2 Program execution does not branch and execution proceeds to the next state...

Page 52: ...ch destination line number integer in the range of 1 line number 65535 3 Program area number single character 0 9 4 Label Name of a label in the program EXPLANATION 1 The GOSUB statement is executed in accordance with the value of the expression used for the branch condition For example execution jumps to the first branch destination when the value is 1 to the second destination when the value is ...

Page 53: ...ement following the THEN clause is executed or execution jumps to the destination specified by the GOTO statement when the branch condition is met 2 If the branch condition is not met the statement following the ELSE statement is executed or the program jumps to the specified branch destination Execution proceeds to the next program line when the ELSE statement is omitted 3 The format IF A THEN re...

Page 54: ...f the statements beyween FOR and NEXT are executed and the program proceeds to the next executable statement after NEXT when the initial value is greater than the final value 2 Each FOR requires a corresponding NEXT 3 FOR NEXT loops can be nested a FOR NEXT loop can be placed inside another FOR NEXT loop Nested loops must be structured as shown below with NEXT appearing in inverse sequence of the ...

Page 55: ... to indicate that the following text is comments The REM statement can only be used at the beginning of a line 3 Any command following a REM statement is treated as comment and is not executed SAMPLE PROGRAM 10 REM This is a comment 20 This is as well a comment 30 LET A 1 REM I can comment within a line 40 LET N 1 The apostrophe does not require LET PURPOSE Assigns the value of an expression on th...

Page 56: ...EXAMPLE DATA 10 5 8 3 DATA CAT DOG LION PARAMETERS 1 Data String constants or numeric constants 2 String constants Quotation marks are not required unless the string contains a comma that is part of the data A null data string length 0 is assumed when data is omitted from this statement EXPLANATION P 0 ...

Page 57: ...he 1 1 range EXPLANATION 1 The unit of the returned value is specified using the ANGLE function 2 The returned value is in the 0 180 or 0 π Radians range SEE ANGLE COS ANGLE PURPOSE Specifies the angle unit FORMAT ANGLE angle specification Numeric expression EXAMPLE ANGLE 0 PARAMETERS angle specification Numeric expression truncated to an integer in the range of 0 angle specification 3 EXPLANATION...

Page 58: ...sing the argument can be omitted when the argument is a numeric value or variable PARAMETERS argument must be within the 1x10100 1x10100 range EXPLANATION 1 The unit of the returned value is specified using the ANGLE function 2 The returned value is in the 90 90 or π 2 π 2 Radians range SEE ANGLE TAN COS PURPOSE Returns the value of the cosine of the argument FORMAT COS argument Numeric expression...

Page 59: ...value or variable EXAMPLE EXP 1 PARAMETERS argument must be within the 230 2585092 230 2585092 range EXPLANATION 1 The value of e is 2 7182818284590452353602874713526 2 The returned value is in the 0 10100 range SEE LN FACT PURPOSE Returns factorial of argument FORMAT FACT argument Numeric expression The parenthesis enclosing the argument can be omitted when the argument is a numeric value or vari...

Page 60: ... 3 14 PARAMETERS argument numeric expression EXPLANATION 1 Returns the fractional art of the argument 2 The sign of the value is the same as that for the argument SEE INT FIX HYPACS PURPOSE Returns the value for which hyperbolic cosine value argument FORMAT HYPACS argument Numeric expression The parenthesis enclosing the argument can be omitted when the argument is a numeric value or variable EXAM...

Page 61: ... argument can be omitted when the argument is a numeric value or variable EXAMPLE HYPATN 0 3 PARAMETERS argument must be within the 1 1 range EXPLANATION 1 The mathematical formula for reverse hyperbolic tangent is atanh x ln 1 x ln 1 x 2 where ln is the natural logarithm 2 The returned value is in the 10100 10100 range SEE HYPTAN LN HYPCOS PURPOSE Returns the value of the hyperbolic cosine of the...

Page 62: ...is enclosing the argument can be omitted when the argument is a numeric value or variable EXAMPLE HYPTAN 2 5 PARAMETERS argument must be within the 1x10100 10100 range EXPLANATION 1 The mathematical formula for hyperbolic tangent is tanh x ex e x ex e x where e is 2 71828182845904523536028747 2 The returned value is in the 1 1 range SEE HYPATN LN INT PURPOSE Returns the largest integer that does n...

Page 63: ...ing the argument can be omitted when the argument is a numeric value or variable EXAMPLE LN 1965 PARAMETERS argument must be within the 10 100 10100 range EXPLANATION 1 The returned value is in the 230 2585092 230 2585092 range 2 LN is the inverse function of EXP For any positive argument EXP LN argument argument SEE EXP NCR PURPOSE Returns the combination nCr for the values of n and r FORMAT NCR ...

Page 64: ...The displayed value is rounded off to 10 digits so the value of π is displayed as 3 141592654 POL PURPOSE Converts rectangular coordinates x y to polar coordinates r θ FORMAT POL x coordinate y coordinate Numeric expression Numeric expression EXAMPLE POL 3 2 PARAMETERS x and y coordinates numeric expressions not both zero EXPLANATION 1 Converts rectangular coordinates x y to polar coordinates r Θ ...

Page 65: ... program is executed This means that the same series of numbers is generated unless the argument of RAN is omitted or is equal to 1 EXAMPLE RAN 10 REC PURPOSE Converts polar coordinates r θ to rectangular coordinates x y FORMAT REC distance r angle θ Numeric expression Numeric expression EXAMPLE REC 10 15 PARAMETERS x and y coordinates numeric expressions not both zero 1 Distance r numeric express...

Page 66: ...nthesis enclosing the argument can be omitted when the argument is a numeric value or variable EXAMPLE SGN A PARAMETERS argument numeric expression EXPLANATION Returns a value of 1 when the argument is negative 0 when the argument equals 0 and 1 when the argument is positive SEE ABS SIN PURPOSE Returns the value of the sine of the argument FORMAT SIN argument Numeric expression The parenthesis enc...

Page 67: ...ument FORMAT TAN argument Numeric expression The parenthesis enclosing the argument can be omitted when the argument is a numeric value or variable EXAMPLE TAN PI 3 PARAMETERS argument numeric expression angle 1440 argument 1440 8π Radians argument 8π Radians 1600 Grads argument 1600 Grads EXPLANATION 1 The unit of the argument is specified using the ANGLE function 2 argument must be different fro...

Page 68: ...meric expression EXAMPLE DEG 1 30 10 PARAMETERS 1 Degrees numeric expression in the 10100 10100 range 2 Minutes numeric expression in the 10100 10100 range 3 Seconds numeric expression in the 10100 10100 range EXPLANATION Converts the degrees minutes and seconds of sexagesimal values to decimal values as follows DEG degrees minutes seconds degrees minutes 60 seconds 3600 SEE DMS DMS PURPOSE Conver...

Page 69: ...thin a program Since a numeric variable cannot be used following H the hexadecimal value is appended to H as a string and then converted to a decimal value using the VAL function SAMPLE PROGRAM 10 REM H SAMPLE 20 INPUT H A 30 H VAL H A 40 PRINT H A H 50 GOTO 10 SEE HEX HEX PURPOSE Converts the argument numeric value or numeric expression value to a string FORMAT HEX argument Numeric expression EXA...

Page 70: ... a specified length from the left of a string 2 The entire string is returned when the specified number of characters is greater than the number of characters of the string SEE MID RIGHT LEN PURPOSE Returns a value that represents the number of characters contained in a string FORMAT LEN string String expression EXAMPLE LEN A PARAMETERS String string expression EXPLANATION Returns a value that rep...

Page 71: ...he substring is not specified 2 A substring of length 0 null is returned when the specified position exceeds the length of the string 3 A substring from the specified position to the end of the string is returned when the specified number of characters is greater than the number of characters from the specified position to the end of the string SEE RIGHT LEFT RIGHT PURPOSE Returns a substring of a...

Page 72: ...umeric value 2 Numeric characters are converted up to the point in the string that a non numeric character is encountered All subsequent characters are disregarded from the non numeric character onwards i e VAL 123A456 123 3 The value of this function becomes 0 when the length of the string is 0 or when the leading character is non numeric SEE STR VALF VALF PURPOSE Performs calculation of numeric ...

Page 73: ...the virtual screen that can be made visible using the cursor keys SEE DRAWC DRAWC PURPOSE Erases a line segment between two graphic coordinates FORMAT DRAWC x1 y1 x2 y2 Numeric expression Numeric expression Numeric expression Numeric expression EXAMPLE DRAWC 0 0 50 50 DRAWC 100 50 PARAMETERS 1 x1 y1 are the coordinates of the first graphic coordinate When omitted the computer will use the last gra...

Page 74: ...T x y Numeric expression Numeric expression EXAMPLE POINT 50 50 PARAMETERS x y is a graphic coordinate 1 x should be in the 0 191 range 2 y should be in the 0 63 range EXPLANATION Value returned is 1 if the pixel is active black 0 if the pixel is inactive F 0 ...

Page 75: ...KE EOF POL 64 ERASE PRINT ERL PRINT ERR RAN 65 EXP 59 READ FACT 59 READ FIX 60 REC 65 FOR NEXT 54 REM 55 FRAC 60 RESTORE FRE 43 RESTORE GOSUB 50 RESUME GOTO 49 RETURN 50 HEX 69 RIGHT 71 HYPACS HYPASN HYPATN 60 ROUND 66 HYPCOS HYPSIN HYPTAN 61 RUN 47 IF THEN GOTO ELSE 53 SAVE SAVE ALL INKEY SAVE INPUT SET INPUT SIN COS TAN 66 INPUT SQR 67 INT 62 STOP 48 LEFT 70 STR 72 LEN 70 TAB LET 55 TRON TROFF 4...

Page 76: ...ogramming One reason is that C was developed for thr UNIX operating system UNIX on the other served as basis for the widely popular MS DOS which means that the UNIX notation system is applied in a wide variety of software in use today Another reason is the wide appeal of C due to its distinctive features noted below Features of C 1 Wide applicability C can be used in a wide range of programming ap...

Page 77: ...end that you get as much hands on experience as possible with your pocket computer creating and running your own programs This is the best way to learn about the power and versatility of C The Casio pocket computer makes actually a very good teacher Should you make a mistake when inputting a program error messages will appear on the display to guide you back to the correct path With each error you...

Page 78: ... easier operation The Casio unit features a C interpreter After you enter the program all you have to do is enter the RUN command to execute it Throughout the rest of this manual the C interpreter will be referred simply as an interpreter About the C editor An editor can be used to write everything from a few lines to an entire program Unlike the interpreter in which simple writing cannot be perfo...

Page 79: ...ol is switched OFF before entering a keyword M A I N Shift main 2 SPC P R I N T F CAPS H E L L O Shift CAPS N main printf HELLO n 3 Shift printf HELLO n 4 This gives the following C program main printf HELLO n 6 2 3 Using the Editor The editor of the computer is used for creating and editing programs as we saw with our HELLO program This section takes you further along the path of using the editor...

Page 80: ...followed by Moving the cursor You can control cursor movement using the cursor keys in the editor as follows Cursor moves up Cursor moves down Cursor moves left Cursor moves right Moving the cursor to the beginning of a line Use the following operation to move the cursor to the beginning left end of the current line while in the editor Shift L TOP Moving the cursor to the end of a line Use the fol...

Page 81: ...board replace any characters already at the current cursor position Search function The editor search function lets you search through programs for specific character strings We will demonstrate the search function using the following display EDIT main printf HELLO n 1 SRCH P R main printf HELLO n search pr_ 1 The specified character string is located and displayed with the cursor located at the f...

Page 82: ... Success Your computer has said HELLO to you 6 1 1 Using Command line Operation As you are using the interpreter the screen always shows a _ prompt In this mode you can enter four different commands followed by the key Note that these commands are not case sensitive RUN executes the currently loaded program EDIT transfers to the editor TRON enters the TRACE mode TROFF exits the TRACE mode 6 1 2 Us...

Page 83: ...step by step the execution T R O N tron _ R U N run F1 5 printf HELLO n Break _ The display shows that execution is halted at line 5 of the program F1 The question mark in the bottom line of the display indicates that the computer is asking if it should execute line 5 Press to execute line 5 HELLO F1 6 sub Break _ The display shows the result of the execution of line 5 and stands by for you to pre...

Page 84: ... the TRACE mode and finish executing the program Variable Test Function During TRACE mode execution of a program you can press D when prompted Break _ T R O N R U N run F1 5 printf HELLO n Break _ D F1 5 printf HELLO n Break d var Entering the name of the variable followed by will give you the type and value of the variable at this stage of the execution of the program Entering only will resume th...

Page 85: ...rintf statement is actually a function of C language that is used to output characters to the display Such functions are called standard functions The character strings included within the parenthesis following printf are what is output to the display Note that a character string is defined as such by being included within double quotation marks A character string or anything else that is included...

Page 86: ...ting point format using a few more new techniques First enter the editor and input the following Output Value main printf D d H x F f n 65 65 65 0 The first line is what we call a comment line The computer reads everything between and as a comment and so they are ignored You can use comment lines inside of a program to point out certain features or as memos for later reference Putting and around p...

Page 87: ...he previous program the decimal value 65 was converted in accordance with three corresponding constructions In some instances however you might want to include the actual values as they are in printf arguments without conversion when they are displayed To do this you have to specify the value as an integer constant With C you can specify decimal octal and hexadecimal values as well as characters a...

Page 88: ... the declaration unsigned in front of any of the integer declaration except long to indicate that the integer is unsigned no positive negative sign Note the int declaration is hardware dependent despite the fact it is the default type in many cases and the fastest for arithmetics On the pocket computer which uses a 16 bit microprocessor it refers to a 16 bit integer But on other processors it may ...

Page 89: ...e variable as an argument in the printf statement Using arrays An array is a variable with depth With an array you use a single name followed by a number to indicate the variable name For example a 0 a 1 a 2 a 3 a 4 represent five memory areas within an array called a 5 Note that the values following the name must be enclosed within brackets With arrays declaration of repetitive variables becomes ...

Page 90: ...puter does not need these instructions for a compiler Nevertheless it is a good idea to add a comment reminding the need for the standard libraries to help portability The following is the program that will accomplish our task Diplay character codes include stdio h main int c c getchar printf Char c Hex 0x x n c c The getchar function only returns the character code and so no argument is used insi...

Page 91: ...is assigned to the second argument In the program here we can see that the first argument of scanf is f to indicate floating point format The second argument is x which is a pointer to the variable x A pointer indicates the address in memory of a variable The second argument of the scanf function must be a pointer The statement angle 0 specifies the unit of angular measurement You can specify the ...

Page 92: ...xample please also note the proper format for easy reading Note that the statements are aligned and also note the position of the braces if condition Statement 1 Statement 2 else Statement 3 Statement 4 A program to solve quadratic equations Here we will create a program that produces two solutions for the following quadratic equation ax2 bx c 0 a 0 In the above equation it is assumed that a b and...

Page 93: ...e while the l stands for long and means that the integer part of the value is longer than normal Relational operators The condition D 0 is called a relational operator This tells the computer to compare the value assigned to variable D with 0 If the value of D is greater than or equal to 0 a value of 1 TRUE is returned to indicate true If it is less than zero a 0 FALSE is returned to indicate fals...

Page 94: ...s ended You can have multiple statements in a while loop but note the following format that you should use in order to make the program easier to read while condition Statement 1 Statement 2 Statement n The closed brace should be directly under the w of the while Keep the statements indented Now let s create a program that uses the while loop The program will output the character codes for the cha...

Page 95: ...resents the character Z As long as ch is less than or equal to Z the following printf statement is executed and then the getchar statement is executed This program does not really require input of any characters but if we did not include a getchar statement here the data produced by this program would simply scroll across the display so quickly that we would not be able to use it The getchar state...

Page 96: ...printf nGCM d d x y do gcm x x y x y gcm while x 0 printf d n gcm When you execute this program the following result should be produced GCM 56 63 7 _ Using the for loop You can also use the for loop for repeat execution of statements The format of the for loop is as follows For expression 1 expression 2 expression 3 Statement Note that there are three expressions inside of the parentheses of the f...

Page 97: ... counter is 1 Expression 2 i 100 Repeat as long as I is less than or equal to 100 Expression 3 i Increment I by 1 with each pass of loop i i 1 In effect this tells the computer to keep repeating the loop starting with a counter value of 1 and repeat the loop as long as the counter value is 100 or less In the next line the 8d in the first argument tells the computer to display the decimal value flu...

Page 98: ...0 a 0 1 a 0 2 a 1 0 a 1 1 a 1 2 a 2 0 a 2 1 a 2 2 Considering just the loop counter i and j values the above program executes as follows First pass i Second pass i Third pass i i 0 j 0 j 1 j 2 i 1 j 0 j 1 j 2 i 2 j 0 j 1 j 2 This means that values entered from the keyboard are read into f by scanf and assigned to array a 3 3 in sequence by a i j as i and j change values as noted above Let s expand...

Page 99: ...ill eventually build up your own library of functions that you can call up from various programs as you need them Creating functions The following is the format for function definition function type declaration function name arguments argument type declaration declaration of variables used in the function statements Function type This part of the function declares the type of data that will be ret...

Page 100: ... a function 100 squares 2 include stdio h int isquare x square of int int x return x x main int i for i 1 i 100 i printf 8d 8d n i isquare i getchar waits ret key Returned value The function isquare that we have defined receives the argument squares it and then returns the squared value The line return i i instructs the computer to square the value of x and return it to the main function When the ...

Page 101: ...he interpreter knows its type before actually writing the function Here is an example using function declaration 100 squares 4 include stdio h extern double dsquare main double d for d 1 0 d 100 0 d 1 0 printf lf 2 f n i dsquare d getchar waits ret key double dsquare x square double x return x x Note that a function declaration of line 3 does not specify the amount and type of parameters ANSI C au...

Page 102: ...ocal i for i 0 i 2 i printf d i main int i for i 0 i 10 i pr This program displays ten sets of numbers 0 and 1 Both the main function and the pr function utilize variable i but the computer treats these as two entirely different variables In the main function the value of i ranges from 0 to 9 while in pr it is 0 or 1 only Global variables A global variable is one that is commonly applied throughou...

Page 103: ... values entered via the scanf standard function With this program entry of 33 21 would for example produce the result 54 scanf example include stdio h main char op int x y xy xy 0 scanf d c d x op y if op xy x y else if op xy x y else if op xy x y else if op xy x y else if op xy x y else printf unknown op printf d n xy Variable op is a character type while x y and xy are integer type Since we are ...

Page 104: ...r A Z a z or an underline _ Second and subsequent characters in a variable may be an alphabetic character underline or number The computer differentiates between upper case and lower case letters when matching variable names Reserved words cannot be used as variable names though a part of a variable name may be a reserved word The length of a variable name is unlimited but only the first eight cha...

Page 105: ... be affixed for long type integers Decimals Example 1121 128 68000 123456789L for long Note Leading zeros cannot be used because they mean an octal notation Octal Example 033 0777 012 01234567L for long Note Leading zero required for octal notation No number above 7 Hexadecimal Example ox1B 0xFFFF 0x09 0xffffffL for long Note 0x or 0X required for hexadecimal notation The following show the ranges...

Page 106: ...ughout execution of program Values accessed and acted upon throughout entire program register High frequency access Variables which are effective for increasing speed of execution by allocating values to microprocessor registers Most compilers optimize automatically the executable code using registers for the most accessed variables but it may still make sense to specify register The C interpreter...

Page 107: ...able without the brackets you will not get an error C will give you the address of the first element of the table tab_4 0 0 0 0 is equal to tab_4 Initializing arrays The interpreter let you initialize simple variables but you cannot initialize arrays as easily char month 12 Jan Feb Mar Dec which is allowed in ANSI C will generate an illegal initialization error Use instead char month 12 month 0 Ja...

Page 108: ... integers each increment would select the next 4 Bytes As said earlier arrays are closely related to pointers as well int a 5 pa pa a equivalent to pa a 0 pa now pa points toward a 1 6 2 Operators C employs many operators not available with BASIC FORTRAN or Pascal Operators are represented by such symbols as and and they are used to alter values assigned to variables Basically the C interpreter su...

Page 109: ...ht bit shift y times Relational operators true 1 false 0 Equality unequal 0 equal 1 Inequality unequal 1 equal 0 Bit AND of x and y Bit XOR of x and y Bit OR of x and y Logical AND of x and y 1 if neither x nor y are 0 Logical OR 1 if either x or y is not zero Trinomial conditional operators x y z y if x is true other than 0 z if x is false 0 Assignment operators x y x y x y x y x y x y x y x y x ...

Page 110: ...thesis wherever the intention of the statement can be confusing for someone reading the program if not for the interpreter 6 2 1 Cast operator Data types are ranked as follows with rank increasing from left to right Char int long float double In expressions with mixed data types C will first convert all data to the same type as that of the highest ranked data included in the expression and then pe...

Page 111: ... computer will stop at each statement showing program area number F0 9 line number and statement 2 After each statement prompt Break _ appears Press or T key to execute the next statement 3 Press N when prompted Break _ to exit the TRACE mode and finish executing the program 4 During TRACE mode execution of a program you can press D when prompted Break _ to evaluate the content of variables The va...

Page 112: ...llows to pass a parameter indicating the termination status to the operating system breakpt PURPOSE Stops program execution like in the TRACE mode FORMAT void breakpt EXPLANATION 1 The TRACE mode stops at each statement I you just want to investigate a certain statement of your program you can add a breakpt statement 2 Program will stop showing the Break _ prompt You can Press D to evaluate the co...

Page 113: ...tement statement is executed only if condition is true not 0 2 You can add the else structure to process the case of condition being false 0 3 Statement 1 and statement 2 can be if then structure as well allowing analyzing and processing multiple conditions 4 The last else statement is often here to process unexpected entries or data configurations for example generating an error warning SAMPLE PR...

Page 114: ...dio h main char ch 0 while ch Z printf Char c Hex 0x x n ch ch getchar waits for return key ch SEE do while for break continue do while PURPOSE Executes statement and carries on repeatedly as long as the specified condition is true not zero FORMAT do statement while condition PARAMETERS Condition can be any variable or expression that will be considered true if not 0 EXPLANATION 1 The do loop firs...

Page 115: ...eless commonly accepted programming practice is to reserve the parenthesis after the for statement for loop control putting all other statements after SAMPLE PROGRAM For example include stdio h main char ch For ch 0 ch Z ch printf Char c Hex 0x x n ch ch getchar waits for return key SEE do while while break continue break PURPOSE exits from a do while while of for loop FORMAT break EXPLANATION 1 E...

Page 116: ...orresponding case are executed until a break statement is found 3 If no constant matches the value of expression the statements following default are executed 4 Note In absence of a break the execution of statements carries on See the second sample program SAMPLE PROGRAM Switch break example include stdio h main int a printf nEnter a value scanf d a switch a case 1 printf nThis is case 1 break cas...

Page 117: ...TERS label is the name of a label defined within the same function EXPLANATION 1 the goto statement and label concept are similar to the ones used in BASIC 2 a label is defined writing an identifier followed by a colon 3 it is possible and recommended to avoid using the goto statement in a C program ...

Page 118: ...ATION 1 The unit of the returned value is specified using the angle function 2 The returned value is in the 0 180 or 0 π Radians range SEE angle cos acosh PURPOSE Returns the value for which hyperbolic cosine value parameter FORMAT double acosh x double x PARAMETERS x must be within the 1 5x1099 range EXPLANATION 1 The mathematical formula for reverse hyperbolic cosine is acosh x ln x where ln is ...

Page 119: ...ed value is specified using the angle function 2 The returned value is in the 90 90 or π 2 π 2 Radians range SEE angle tan atanh PURPOSE Returns the value for which hyperbolic tangent value parameter FORMAT double atanh x double x PARAMETERS x must be within the 1 1 range EXPLANATION 1 The mathematical formula for reverse hyperbolic tangent is atanh x ln 1 x ln 1 x 2 where ln is the natural logari...

Page 120: ... the 230 2585092 230 2585092 range EXPLANATION 1 The value of e is 2 7182818284590452353602874713526 2 The returned value is in the 0 10100 range SEE log log PURPOSE Returns the natural logarithm of the parameter FORMAT double log x double x PARAMETERS x must be within the 10 100 10100 range EXPLANATION 1 The returned value is in the 230 2585092 230 2585092 range 2 log is the inverse function of e...

Page 121: ...e x PARAMETERS x must be within the 1440 1440 or 8π 8π Radians range EXPLANATION 1 The unit of the parameter x is specified using the angle function 2 The returned value is in the 1 1 range SEE angle asin sinh PURPOSE Returns the value of hyperbolic sine parameter FORMAT double sinh x double x PARAMETERS x must be within the 230 2585092 230 2585092 range EXPLANATION 1 The mathematical formula for ...

Page 122: ...be different from 90 or 270 π 2 or 3π 2 Radians 3 The returned value is in the 1x10100 10100 range SEE angle atan tanh PURPOSE Returns the value of hyperbolic tangent parameter FORMAT double tanh x double x PARAMETERS x must be within the 1x10100 10100 range EXPLANATION 1 The mathematical formula for hyperbolic tangent is tanh x ex e x ex e x where e is 2 71828182845904523536028747 2 The returned ...

Page 123: ... destination string and is therefore equal to the first parameter strchr PURPOSE Searches for a character in a string FORMAT char strchr string c char string int c PARAMETERS 1 string 2 c is a character EXPLANATION 1 The string stays untouched 2 The returned value is a pointer to the first position of the character c in the string 3 If the character cannot be found the function returns the NULL po...

Page 124: ...hat no control is made on the memory available for the destination string Using strcpy without enough memory booked for the destination string may result in an overflow 3 The returned value is the destination string and is therefore equal to the first parameter strlen PURPOSE Returns the length of a string FORMAT int strlen string char string PARAMETERS string EXPLANATION 1 The string stays untouc...

Page 125: ...d line x1 y1 x2 y2 unsigned int x1 y1 x2 y2 PARAMETERS 1 x1 y1 are the coordinates of the first graphic coordinate 2 x2 y2 are the coordinates of the second graphic coordinate 3 x1 and x2 should be in the 0 191 range 4 y1 and y2 should be in the 0 63 range SEE linec linec PURPOSE Erases a line segment between two graphic coordinates FORMAT void linec x1 y1 x2 y2 unsigned int x1 y1 x2 y2 PARAMETERS...

Page 126: ... 125 putc const putchar continue 115 puts cos 119 register cosh 120 return default 116 scanf do 114 short double signed else 113 sin 121 enum sinh 121 exit 112 sizeof exp 120 sprintf extern sqrt 121 fflush sscanf fgetc static fgets strcat 123 float strchr 123 for 115 strcmp 123 fprintf strcpy 124 fputc strlen 124 fputs struct free switch 116 fscanf tan 122 getc tanh 122 getch typedef getchar union...

Reviews: