Browse
(440) 299-7778
Menu
(440) 299-7778
One-year parts and labor warranty30-day money-back guaranteeContact

The text of a manual · part 16 of 17

1771-DB Basic Module User Manual, pages 151 to 160

Pages 151 to 160 of 167

The original document is the PDF (943 KB). This is its text as extracted, unedited; tables and drawings read best in the PDF, and each page heading opens it at that page.

For the Allen-Bradley 1771-DB

Page 151

Chapter 8 Editing A Procedure

8.3.7 Renumber (continued)

REN[NUM1],[NUM2], begins at the start of the program and continues through the end of the program. The new line numbers begin with NUM1 and increment by NUM2. REN[NUM1],[NUM2],[NUM3], begins at NUM2 and continues through the end of the program. The new line numbers begin with NUM1 and increment by NUM3. Important: The renumber command updates the destination of GOSUB, GOTO, ON ERR, ON TIME and ON GOTO statements. If the target line number does not exist, or if there is insufficient memory to complete the task, no lines are changed and the message “RENUMBER ERROR” appears on the console screen. Important: Because the renumber command uses the same RAM for renumbering as it does for variable and program storage, available RAM may be insufficient in large programs. We recommend that you renumber your program periodically during development. Do not wait until it is completed.

8–3

Page 152

Chapter 8 Editing A Procedure

8.4 Editing a Simple Procedure

The following example shows you how to edit a simple procedure. Example: When the screen shows

You do this

LIST 10 REM 20 FOR I = 1 TO 6 30 PRINT I 40 NEXT I READY u Type EDIT 20 then [RETURN] EDIT 20 20 for I = 1 TO 6 Press the space bar 18 times to move the cursor to 6 (MOVE right feature). Type 9 to change 6 to 9 (REPLACE feature) Press space bar once, type STEP, press space bar once, type 2 Press [CTRL]A to exit the insert Press [CTRL]Q to exit the editor with the changes accepted READY Type LIST then [RETURN] uLIST 10 REM 20 FOR I = 1 to 9 STEP 2 30 PRINT I 40 NEXT I READY u

8–4

Page 153

Chapter 9

Error Messages and Anomalies

9.1 Chapter Objectives

After reading this chapter you should be familiar with the module’s error messages and anomalies.

9.2 Error Messages from BASIC

When BASIC is in the RUN mode the format of the ERROR messages is as follows: ERROR: XXX – IN LINE YYY YYY BASIC STATEMENT X Where XXX is the ERROR TYPE and YYY is the line number of the program in which the error occurred. A specific example is: ERROR: BAD SYNTAX – IN LINE 10 10 PRINT 34*21* X The X shows approximately where the ERROR occurred in the line number. The specific location of the X may be off by one or two characters or expressions depending on the type of error and where the error occurred in the program. If an ERROR occurs in the COMMAND MODE only the ERROR TYPE is printed out, not the line number. The ERROR TYPES are as follows: A-STACK, An A-STACK (ARGUMENT STACK) error occurs when the argument stack pointer is forced “out of bounds”. An “out of bounds” condition occurs if: you overflow the argument stack by PUSHing too many expressions onto the stack. you attempt to POP data off the stack when no data is present. ARITH. OVERFLOW, An ARITH. OVERFLOW occurs when an arithmetic operation exceeds the upper limit of a module floating point number. The largest floating point number in the BASIC Module is +/–.99999999E+127. For example, 1E+70*1E+70 causes an ARITH. OVERFLOW error.

Page 154

Chapter 9 Error Messages and Anomalies

9.2 Error Messages from BASIC (continued)

ARITH. UNDERFLOW, An ARITH. UNDERFLOW occurs when an arithmetic operation exceeds the lower limit of a module floating point number. The smallest floating point number in the BASIC Module is +/–lE–127. For example, 1E–80/1E+80 causes an ARITH. UNDERFLOW error. ARRAY SIZE, An ARRAY SIZE error occurs if an array is dimensioned by a DIM statement and you attempt to access a variable that is outside of the dimensioned bounds. Example: uDIM A(10) uPrint A(11) ERROR: ARRAY SIZE READY BAD ARGUMENT, A BAD ARGUMENT error occurs when the argument of an operator is not within the limits of the operator. For example, SQR(–12) generates a BAD ARGUMENT error because the value of the SQR argument is limited to positive numbers. BAD SYNTAX, A BAD SYNTAX error occurs when either an invalid BASIC Module command, statement or operator is entered and BASIC cannot process the entry. Check to make sure that all entries are correct. C-STACK, A C-STACK (CONTROL STACK) error occurs if: the control stack pointer is forced “out of bounds”. you attempt to use more control stack than is available in the module. you execute a RETURN before a GOSUB, a WHILE or UNTIL before a DO, or a NEXT before a FOR. you jump out of loop structures such as DO WHILE. CAN’T CONTINUE, A CAN’T CONTINUE error appears if: you edit the program after halting execution and then enter the CONT command. you enter CTRL C while in a call routine. You can halt program execution by either entering CTRL C or by executing a STOP statement. Normally, program execution continues after entering the CONT command. You must enter CTRL C during program execution or you must execute a STOP statement before the CONT command can work. DIVIDE BY ZERO, A DIVIDE BY ZERO error occurs if you attempt to divide by zero (12/0).

9–2

Page 155

Chapter 9 Error Messages and Anomalies

9.2 Error Messages from BASIC (continued)

EXTRA IGNORED, Error occurs when an INPUT statement requiring numeric data, receives numeric data followed by letters. Letters are ignored. Error also occurs from CALL 61. MEMORY ALLOCATION, A MEMORY ALLOCATION error occurs when: user memory (RAM) is full. BASIC cannot determine memory bounds because the system control value MTOP is altered. RAM contains an incomplete program file. you attempt to access STRINGS that are “outside” the defined string limits. NO DATA, A NO DATA message occurs if a READ STATEMENT is executed and no DATA STATEMENT exists or all DATA was read and a RESTORE instruction was not executed. The message ERROR: NO DATA – IN LINE XXX is printed to the console device. PROGRAMMING, If an error occurs while the BASIC Module is programming an EPROM, a PROGRAMMING error occurs. An error during programming destroys the EPROM file structure. You cannot save any more programs on that particular EPROM once a PROGRAMMING error occurs. If the EPROM size is exceeded, the previously stored program may be partially altered.

9.3 Error Messages from CALL Routines

Your module generates the following messages when an error occurs while trying to execute a CALL routine.

9.3.1 Data Conversion CALL Error Messages

NEGATIVE VALUES NOT VALID, This error occurs when you attempt to convert a negative number with CALL 21 or 27.

9.3.2 Peripheral Port Support CALL Error Messages

CHECKSUM ERROR FROM RECORDER, This error occurs when bad data is received from the tape while executing CALLS 33, 34 or 39. You should check for correct cable connections and baud rate. Also check your tape cartridge.

9–3

Page 156

Chapter 9 Error Messages and Anomalies

9.3.2 Peripheral Port Support CALL Error Messages (continued)

IN ROM, The IN ROM message displays if you attempt to load a ROM program to tape with CALL 32 or 38. You should transfer the ROM program to RAM and then load the program to tape. INVALID INPUT DATA, This error occurs when you enter an invalid value when using CALL 30. INVALID VALUE PUSHED, This error occurs when you enter a value other then 0, 1 or 2 when using CALL 37. LOAD/SAVE ABORT, This error occurs when you execute a CTRL C from any tape CALL (32, 33, 34, 38 or 39). NO BASIC PROGRAM EXIST, This error occurs when the BASIC Module is in RAM mode with no program in RAM and you attempt to execute a CALL 32 or 38. You should enter a program in RAM or XFER a ROM program to RAM prior to loading to tape with CALL 32 or 38.

9.3.3 Wall Clock CALL Error Messages

INSUFFICIENT NUMBER OF STRING CHARACTERS ALLOCATED, This error occurs if you attempt to execute a CALL 43, 45 or 52 and a string length of 18, 8 or 9, respectively, is not allocated during string allocation. INVALID DATE/TIME PUSHED, This error occurs when you enter an invalid value for the date and/or time when using CALL 40 and 41. NUMBER BYTES/STRING EXCEED 254, This error occurs when using CALL 43, 45 or 52 and the STRING X,X command allocates more characters per string than is allowed. Example: 10 STRING 1000,300 INVALID NUMBER PUSHED, This error occurs when you push an invalid string value or day of week value using CALL 42, 43 and 52.

9–4

Page 157

Chapter 9 Error Messages and Anomalies

9.3.4 String Support CALL Error Messages

STRING# NOT ALLOCATED, This error occurs if you attempt to access a string that is outside the allocated string memory when using CALLs 60, 61, 64, 65, 66, 67, or 68. Example: u10 STRING 100,9 u20 PUSH 5,12

REM 10 STRINGS ALLOCATED$ (0)–$(9) REM REPEAT CHAR 5 TIMES IN$(12)

u30 CALL 60 uRUN ERROR, STRING # NOT ALLOCATED Error occurs because STRING 12 is outside the area reserved for strings. #BYTES/STRING EXCEED 254, This error occurs if the STRING X,X command allocates more characters per string than is allowed using CALL 62. Example: u10 STRING 1000,300 INSUFFICIENT NUMBER OF STRING CHARACTERS This error occurs if you do not use the required minimum string lengths when using CALL 62. BAD # PUSHED, This error occurs if the string position pointer is zero (invalid position) using CALL 66. INSUFFICIENT STRING SIZE, This error occurs if the resulting string cannot hold all required characters when using CALLs 61 or 66. Example: u10 STRING 100,9 REM MAX OF 9 CHR’S/STRING u20 $(0)=“01234567” u30 $(1)=“890” If you attempt to insert or concatenate, an error occurs because the resulting string requires 11 characters.

9–5

Page 158

Chapter 9 Error Messages and Anomalies

9.3.4 String Support CALL Error Messages (continued)

BAD POSITION - This error occurs if you attempt to access a string position that is beyond the declared length of the string when using CALL 66. Example: u10 STRING 100,9 u20 $(0)=“1234” u30 $(1)=“56” u40 PUSH 6 REM INVALID POSITION OF $(0) u50 PUSH 1 REM $(1) u60 PUSH 0 REM $(0) u70 CALL 66 REM INSERT $(1) INTO $(0) @ POS 6 BAD POSITION error results because position 6 is outside of the declared string. EXTRA IGNORED, This error occurs when the resulting string cannot hold all the characters when using CALL 61. Similar to insufficient string size error. Extra characters are lost. Input, An input statement requiring numeric data, received numeric data followed by letters. The letters are ignored. Example: Input A Entering 1.23AB causes this error message. The program continues to run.

9.3.5 Memory Support CALL Error Messages

INVALID MTOP ADDRESS ENTERED, This error occurs when you select an invalid RAM location for a new MTOP value when using CALL 77. PROGRAM NOT FOUND, This error occurs if a program number higher than 255 is PUSHed when using CALL 71 or 72 or if the program is not found.

9–6

Page 159

Chapter 9 Error Messages and Anomalies

9.3.6 Miscellaneous CALL Error Messages

INVALID BAUD RATE ENTERED, This error occurs when a baud rate other than 300, 600, 1200, 2400, 4800, 9600 or 19.2K bps is PUSHed using CALL 78. INCOMPLETE ROM PROGRAM FOUND, This error occurs when CALL 81 detects an incomplete program in the EPROM. You can burn no additional programs onto this PROM. All earlier programs are still accessible. NO PROGRAM FOUND BUT THE PROM IS NOT BLANK, This error occurs if miscellaneous data is found on a “blank” PROM using CALL 81. You should clear the PROM before using it. NEGATIVE VALUE NOT VALID, This error occurs if you attempt to convert a negative number using CALL 21.

9.4 Anomalies

Anomalies are deviations from the normal. Anomalies in the BASIC Module can occur as the module compacts or tokenizes the BASIC program. The known anomalies and cautions are as follows: 1. When using the variable H after a line number, put a space between the line number and the H. If you do not, the program assumes that the line number is a HEX number. Examples: Wrong

Right u20H=10 u20 H=10 uLIST uLIST

32

=10

20

H=10

9–7

Page 160

Chapter 9 Error Messages and Anomalies

9.4 Anomalies (continued)

2. When using the variable I before an ELSE statement, put a space between the I and the ELSE statement. If you do not, the program assumes that the IE portion of IELSE is the special function operator IE. This error may or may not yield a BAD SYNTAX, IN LINE XXX error message, depending on the particular program in which it is used. Examples: Wrong u20 IF I u10 THEN PRINT IELSE 100 uLIST 20 IF I u10 THEN PRINT I ELSE 100 Right u20 uLIST 20

IF Iu10 THEN

PRINT I ELSE 100

IF I u10 THEN

PRINT I ELSE 100

3. Do not place a space character inside the ASC() operator. A statement like PRINT ASC() yields a BAD SYNTAX ERROR. You can put spaces in strings, however, allowing the following statement to work properly: LET $(1) u“HELLO, HOW ARE YOU” ASC() yields an error because the module eliminates all spaces when a line is processed. ASC() is stored as ASC() and the module interprets this as an error. 4. Do not use the following one letter variables: B, F, R. Unpredictable operation could result. 5. Do not use the following two letter variables: CR, DO, lE, IF, IP, ON, PI, SP, TO, UI and UO. 6. When using an INPUT statement to enter data you must be sure to enter valid data. If you enter invalid data you see the prompt “TRY AGAIN”. This disrupts the screen layout. 7. SQR(M–M2) gives a bad argument if M=O. 8. ONTIME does not interrupt CALL routines, INPUT statements or PRINT# statements waiting for handshaking (XON, CTS, DCD) to become true. ONTIME is a polling mechanism which is checked after each line of BASIC is completed. End of line is either a (CR) or (:).

9–8