The text of a manual · part 17 of 17
1771-DB Basic Module User Manual, pages 161 to 167
Pages 161 to 167 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 161
Chapter 9 Error Messages and Anomalies
9.4 Anomalies (continued)
9. If you use a VT100 terminal, the BASIC Module can miss an XON character sent by your terminal when you enable software handshaking and use a 19.2K baud rate on the module’s program port. You must type CTRL Q to resume. 10. If you use a CTRL C to abort LIST# or PRINT# to a peripheral device, the BASIC Module no longer transmits on the program port (only at 9600 or 19.2 K baud). You can correct the problem by deleting any line. The line deleted need not actually exist in the program. 11. Illegal CALL numbers above 128 are not trapped and cause the micro to jump into code memory at the address specified. This can cause the module to get “lost”. 12. The BASIC Module does not save the EPROM stored baud rate. Example: The module is powered up after a CALL 73 is issued and a valid baud rate is previously stored in EPROM using a PROG1. If the module is powered down and then up, it is powered up at 1200 baud. 13. The renumber routine does not renumber a program if there is insufficient RAM left or if a GOTO or GOSUB exists and the target line number does not. Error reporting does not indicate the cause, only that an error occurred. We recommend renumbering the program in sections and not to renumber a program greater than 9 K. 14. When editing a line, an excessive line length may cause the terminal to issue a CTRL S. A CTRL Q causes termination of the edit. You must retype the complete line. 15. The BASIC Module updates the wall clock for Daylight Savings Time. This occurs on the last Sunday in April and October if the Day of Week is set properly (CALL 42).
9–9
Page 162
Appendix A
Quick Reference Guide Mnemonic
Page
Description
ABS( ) ASC( ) ATN( ) CALL CHR( ) CLEAR CLEARI CLOCK0 CLOCK1 CONT CONTROL C CONTROL S CONTROL Q COS( ) DATA DIM DO END EXP( ) FOR-TO (STEP) GET GOSUB GOTO IF-THEN-ELSE INPUT INT( ) LD@ LEN
5–45 5–72 5–47 5–16 5–74 5–16 5–16 5–17 5–17 5–7 5–9 5–10 5–10 5–47 5–18 5–19 5–19 5–22 5–46 5–22 5–50 5–23 5–24 5–25 5–26 6–45 5–28 5–52
LET
5–29
LIST
5–7
ABSOLUTE VALUE RETURNS INTEGER VALUE OF ASCII CHARACTER RETURNS ARCTANGENT OF ARGUMENT CALL APPLICATION PROGRAM COUNTS VALUE CONVERTED ASCII CHARACTER CLEARS VARIABLES, INTERRUPTS & STRINGS CLEAR INTERRUPTS DISABLE REAL TIME CLOCK ENABLE REAL TIME CLOCK CONTINUE AFTER A STOP OR CONTROL-C STOP EXECUTION & RETURN TO COMMAND MODE INTERRUPT A LIST COMMAND RESTART A LIST AFTER CONTROL S RETURNS THE COSINE OF ARGUMENT DATA TO BE READ BY READ STATEMENT ALLOCATE MEMORY FOR ARRAY VARIABLES SET UP LOOP FOR WHILE OR UNTIL TERMINATE PROGRAM EXECUTION “e” (2.7182818) TO THE X SET UP FOR NEXT LOOP READ CONSOLE EXECUTE SUBROUTINE GOTO PROGRAM LINE NUMBER CONDITIONAL TEST INPUT A STRING OR VARIABLE INTEGER LOAD VARIABLE READ THE NUMBER OF BYTES OF MEMORY IN THE CURRENT SELECTED PROGRAM ASSIGN A VARIABLE OR STRING A VALUE (LET IS OPTIONAL) LIST PROGRAM TO THE CONSOLE DEVICE
LIST#
5–8
LIST PROGRAM TO SERIAL PRINTER
LOG( ) MTOP NEW NEXT NOT( ) NULL
5–46 5–52 5–9 5–22 5–45 5–9
NATURAL LOG READ THE LAST VALID MEMORY ADDRESS ERASE THE PROGRAM STORED IN RAM TEST FOR-NEXT LOOP CONDITION ONE’S COMPLEMENT SET NULL COUNT AFTER CARRIAGE RETURN-LINE FEED
ONERR ON GOTO ON GOSUB ONTIME
5–30 5–25 5–25 5–31
ONERR OR GOTO LINE NUMBER CONDITIONAL GOTO CONDITIONAL GOSUB GENERATE AN INTERRUPT WHEN TIME IS EQUAL TO OR GREATER THAN ONTIME ARGUMENT-LINE NUMBER IS AFTER COMMA
Example ABS(–3) P.ASC(A) ATN(1) CALL 10 P.CHR(65) CLEAR CLEARI CLOCK0 CLOCK1 CONT CTRL C CTRL S CTRL Q CPS(0) DATA 100 DIM A(20) DO END EXP(10) FOR A=1 TO 5 P.GET GOSUB 1000 GOTO 5000 IF AtC THEN A=0 INPUT A INT(3.2) LD@ 14335 PRINT LEN LET A=10 LIST LIST 10–50 LIST# LIST# 50 LOG(10) PRINT MTOP NEW NEXT A NOT(0) NULL NULL 4 ONERR 1000 ON A GOTO 5,20 ON A GOSUB 2,6 ONTIME 10, 1000
Page 163
Appendix A Quick Reference Guide
PH0 PH1 PH0.# PH1.# PI POP PRINT
Mnemonic 5–37 5–37 5–37 5–37 5–46 5–38 5–32
PRINT# PRINT CR PRINT SPC(5) PRINT TAB(#) PRINT USING (Fx) PRINT USING(#.#) PROG PROG1 PROG2
5–36 5–33 5–33 5–33 5–34 5–35 5–12 5–14 5–14
PUSH RAM
5–37 5–10
READ REM RESTORE RETI RETURN RND ROM #
5–18 5–40 5–18 5–41 5–23 5–46 5–10
RUN SGN SIN( ) SQR( ) ST@ STOP STRING #,#
5–5 5–45 5–46 5–45 5–41 5–41 5–42
TAN( ) TIME
5–47 5–50
Description PRINT HEX MODE WITH ZERO SUPPRESSION PRINT HEX MODE WITH NO ZERO SUPPRESSION PH0. TO LINE PRINTER PH1.# TO LINE PRINTER PI – 3.1415926 POP ARGUMENT STACK TO VARIABLES PRINT VARIABLES, STRINGS OR LITERALS P, IS SHORTHAND FOR PRINT PRINT TO SOFTWARE SERIAL PORT PRINT I, CR PRINT “A”, SPC(5), “B” PRINT TAB(5), “x” PRINT USING (F3), 1,2 PRINT USING (##.##), 1,2 SAVE THE CURRENT PROGRAM IN EPROM SAVE BAUD RATE INFORMATION IN EPROM SAVE BAUD RATE INFORMATION IN EPROM AND EXECUTE PROGRAM AFTER RESET PUSH EXPRESSIONS ON ARGUMENT STACK EVOKE RAM MODE, CURRENT PROGRAM IN READ/WRITE MEMORY READ DATA IN DATA STATEMENT REMARK RESTORE READ POINTER RETURN FROM INTERRUPT RETURN FROM SUBROUTINE RANDOM NUMBER EVOKE ROM MODE, EPROM PROGRAM #, DEFAULT TO ROM1 EXECUTE A PROGRAM SIGN RETURNS THE SINE OF ARGUMENT SQUARE ROOT STORE VARIABLE BREAK PROGRAM EXECUTION ALLOCATE MEMORY FOR STRINGS # BYTES TO ALLOCATE, # BYTES/STRING RETURNS THE TANGENT OF THE ARGUMENT RETRIEVE AND/OR ASSIGN REAL TIME CLOCK VALUE
UNTIL WHILE XFER + / ** * – .AND. .OR. .XOR.
5–5 5–5 5–12 5–43 5–43 5–43 5–43 5–43 5–43 5–43 5–43
TEST DO LOOP CONDITION TEST DO LOOP CONDITION TRANSFER A PROGRAM FROM ROM/EPROM TO RAM ADDITION DIVISION EXPONENTIATION MULTIPLICATION SUBTRACTION LOGICAL AND LOGIC OR LOGICAL EXCLUSIVE OR
A–2
Page
Example PH0.A PH1.A PH0.#A PH1.#A PI POP A,C,D PRINT A PRINT# A A....B ....x 1. .00E0 2.00E0 1.002.00 PROG PROG1 PROG2 PUSH10,A RAM READ A REM DONE RESTORE RETI RETURN RND ROM ROM3 RUN SGN (–5) SIN(3.14) SQR(100) ST@ 14335 STOP STRING 50,10 TAN(0) PRINT TIME TIME=0 UNTIL A=10 WHILE A=C XFER 1+1 10/2 2**4 4*2 8–4 10,AND.5 2.OR.1 3.XOR.2
Page 164
Appendix B
Decimal/Hexadecimal/Octal/ASCII Conversion Table Column 1
Column 2
Column 3
Column 4
DEC
HEX
OCT
ASC
DEC
HEX
OCT
ASC
DEC
HEX
OCT
ASC
DEC
HEX
OCT
ASC
00
00
000
NUL
32
20
040
SP
64
40
100
@
96
60
140
\
01
01
001
SOH
33
21
041
!
65
41
101
A
97
61
141 a
02
02
002
STX
34
22
042
″
66
42
102
B
98
62
142 b
03
03
003
ETX
35
23
043
#
67
43
103
C
99
63
143 c
04
04
004
EOT
36
24
044
$
68
44
104
D
100
64
144 d
05
05
005
ENQ
37
25
045
%
69
45
105
E
101
65
145 e
06
06
006
ACK
38
26
046
&
70
46
106
F
102
66
146 f
07
07
007
BEL
39
27
047 i
71
47
107
G
103
67
147 g
08
08
010
BS
40
28
050
(
72
48
110
H
104
68
150 h
09
09
011
HT
41
29
051
)
73
49
111
I
105
69
151 i
10
0A
012
LF
42
2A
052
*
74
4A
112
J
106
6A
152 j
11
0B
013
VT
43
2B
053
+
75
4B
113
K
107
6B
154 k
12
0C
014
FF
44
2C
054
’
76
4C
114
L
108
6C
154 l
13
0D
015
CR
45
2D
055
–
77
4D
115
M
109
ED
155 m
14
0E
016
S0
46
2E
056
.
78
4E
116
N
110
6E
156 n
15
0F
017
SI
47
2F
057
/
79
4F
117
O
111
6F
157 o
16
10
020
DLE
48
30
060
0
80
50
120
P
112
70
160 p
17
11
021
DC1
49
31
061
1
81
51
121
Q
113
71
161 q
18
12
022
DC2
50
32
062
2
82
52
122
R
114
72
162 r
19
13
023
DC3
51
33
063
3
83
53
123
S
115
73
163 s
20
14
024
DC4
52
34
064
4
84
54
124
T
116
74
164 t
21
15
025
NAK
53
35
065
5
85
55
125
U
117
75
165 u
22
16
026
SYN
54
36
066
6
86
56
126
V
118
76
166 v
23
17
027
ETB
55
37
067
7
87
57
127
W
119
77
167 w
24
18
030
CAN
56
38
070
8
88
58
130
X
120
78
170 x
25
19
031
EM
57
39
071
9
89
59
131
Y
121
79
171 y
26
1A
032
SUB
58
3A
072
:
90
5A
132
Z
122
7A
172 z
27
1B
033
ESC
59
3B
073
;
91
5B
133
[
123
7B
173
{
28
1C
034
FS
60
3C
074
<
92
5C
134
\
124
7C
174
.
29
1D
035
GS
61
3D
075
=
93
5D
135
]
125
7D
175
}
30
1E
036
RS
62
3E
076
>
94
5E
136
^
126
7E
176
~
31
1F
037
US
63
3F
077
?
95
5F
137
_
127
7F
177
DEL
Page 165
2
Page 166
Appendix C
Basic Module Programming Hints
BASIC Module Programming Hints
These programming hints can help you to properly program your module to increase module performance. 1. Always define strings first. 2. Always dimension arrays after defining strings. 3. Define the most used variables first. You can use 0 values until you assign real values. 4. When doing math, save intermediate values rather than recalculate. 5. Place the most used subroutines near the beginning of the program. 6. Straight through code executes faster, but uses more memory. 7. Put multiple statements on a line, after the program has been debugged. 8. Comments use space and slow program execution. After the program is debugged save a fully commented copy on tape or spare ERROM and remove comments.
Page 167
Allen-Bradley, a Rockwell Automation Business, has been helping its customers improve productivity and quality for more than 90 years. We design, manufacture and support a broad range of automation products worldwide. They include logic processors, power and motion control devices, operator interfaces, sensors and a variety of software. Rockwell is one of the world’s leading technology companies.
Worldwide representation. Argentina • Australia • Austria • Bahrain • Belgium • Brazil • Bulgaria • Canada • Chile • China, PRC • Colombia • Costa Rica • Croatia • Cyprus • Czech Republic • Denmark • Ecuador • Egypt • El Salvador • Finland • France • Germany • Greece • Guatemala • Honduras • Hong Kong • Hungary • Iceland • India • Indonesia • Ireland • Israel • Italy • Jamaica • Japan • Jordan • Korea • Kuwait • Lebanon • Malaysia • Mexico • Netherlands • New Zealand • Norway • Pakistan • Peru • Philippines • Poland • Portugal • Puerto Rico • Qatar • Romania • Russia–CIS • Saudi Arabia • Singapore • Slovakia • Slovenia • South Africa, Republic • Spain • Sweden • Switzerland • Taiwan • Thailand • Turkey • United Arab Emirates • United Kingdom • United States • Uruguay • Venezuela • Yugoslavia
Allen-Bradley Headquarters, 1201 South Second Street, Milwaukee, WI 53204 USA, Tel: (1) 414 382-2000 Fax: (1) 414 382-4444
Publication 1771–6.5.34 July 1987
PN 955101–26 Copyright 1987 Allen-Bradley Company, Inc. Printed in USA
Publication 1771–6.5.34 July 1987