Rockwell Automation 1746-BAS User Manual

BASIC Language
(Catalog Numbers 1746-BAS and 1746-BAS-T)
Reference Manual

Important User Information

Because of the variety of uses for the products described in this publication, those responsible for the application and use of this control equipment must satisfy themselves that all necessary steps have been taken to assure that each application and use meets all performance and safety requirements, including any applicable laws, regulations, codes and standards.
The illustrations, charts, sample programs and layout examples shown in this guide are intended solely for purposes of example. Since there are many variables and requirements associated with any particular installation, Rockwell International Corporation does not assume responsibility or liability (to include intellectual property liability) for actual use based upon the examples shown in this publication.
Rockwell Automation publication SGI-1.1, Safety Guidelines for the Application, Installation and Maintenance of Solid-State Control (available from your local Rockwell Automation office), describes some important differences between solid-state equipment and electromechanical devices that should be taken into consideration when applying products such as those described in this publication.
Reproduction of the contents of this copyrighted publication, in whole or part, without written permission of Rockwell Automation, is prohibited.
Throughout this manual we use notes to make you aware of safety considerations:
ATTENTION
Attention statements help you to:
identify a hazard
avoid a hazard
recognize the consequences
IMPORTANT
PLC-5 is a registered trademark; and MicroLogix, SLC 500, RSLogix, and RSLinx are trademarks of Rockwell Automation.
Identifies information about practices or circumstances that can lead to personal injury or death, property damage or economic loss
Identifies information that is critical for successful application and understanding of the product.
Language Elements
Data Types
Expressions and Operators

Table of Contents

Preface
Who Should Use This Manual . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . P-1
Purpose of this Manual . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . P-2
How to Use this Manual . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . P-3
Terms and Abbreviations. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . P-4
Conventions Used in this Manual . . . . . . . . . . . . . . . . . . . . . . . . . . . . P-4
Rockwell Automation Support . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . P-5
Chapter 1
Character Set. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-1
The BASIC Program Line . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-1
Chapter 2
Data Types . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-1
Variables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-4
Chapter 3
Expressions and Operators . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-2
Hierarchy of Operators . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-3
Arithmetic Operators . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-3
Logical Operators . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-6
Relational Operators . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-7
Trigonometric Operators . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-8
Functional Operators . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-9
Logarithmic Operators . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-11
String Operators . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-12
Special Function Operators . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-15
Chapter 4
BASIC Commands
i Publication 1746-RM001A-US-P
BRKPNT . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-2
CONT . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-3
Control-C . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-4
CALL 18 – Re-enable the Control-C Break Function . . . . . . . . . . . . . 4-5
CALL 19 – Disable the Control-C Break Function. . . . . . . . . . . . . . . 4-6
Control-S . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-7
Control-Q. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-8
EDIT . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-8
ERASE . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-9
IDLE. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-10
LIST . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-11
LIST@ . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-12
LIST# . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-12
MODE . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-12
NEW . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-14
Table of Contents ii
Command Line CALLs
NULL. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-14
PROG . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-15
PROG1 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-16
PROG2 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-17
RAM. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-19
REM. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-19
REN . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-20
ROM . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-20
RROM . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-21
RUN. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-22
SNGLSTP . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-23
VER . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-25
XFER . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-26
Chapter 5
CALL 73 – Battery-Backed RAM Disable. . . . . . . . . . . . . . . . . . . . . . 5-1
CALL 74 – Battery-Backed RAM Enable . . . . . . . . . . . . . . . . . . . . . . 5-2
CALL 77 – Protected Variable Storage . . . . . . . . . . . . . . . . . . . . . . . . 5-2
CALL 81 – User Memory Module Check and Description. . . . . . . . . 5-3
CALL 82 – Check User Memory Module Map. . . . . . . . . . . . . . . . . . 5-4
CALL 101 – Upload User Memory Module Code to Host. . . . . . . . . 5-4
CALL 103 – Print PRT1 Output Buffer and Pointer . . . . . . . . . . . . . 5-5
CALL 104 – Print PRT1 Input Buffer and Pointer. . . . . . . . . . . . . . . 5-6
CALL 109 – Print Argument Stack. . . . . . . . . . . . . . . . . . . . . . . . . . . 5-7
CALL 110 – Print PRT2 Output Buffer Pointer . . . . . . . . . . . . . . . . 5-8
CALL 111 – Print PRT2 Input Buffer Pointer . . . . . . . . . . . . . . . . . . 5-8
Assignment Functions
Control Functions
Publication 1746-RM001A-US-P
Chapter 6
CLEAR. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6-1
CLEARI . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6-3
CLEARS. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6-3
DATA. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6-4
DIM . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6-4
LET . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6-5
RESTORE . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6-7
Chapter 7
CLOCK1 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-1
CLOCK0 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-2
DO-WHILE. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-3
DO-UNTIL . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-4
END. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-5
FOR-TO-(STEP)-NEXT . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-6
GOTO . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-7
IF-THEN-ELSE . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-8
Execution Control and Interrupt Support Functions
Table of Contents iii
NEXT. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-9
ON-GOTO . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-11
Chapter 8
CALL 16 – Enable DF1 Packet Interrupt . . . . . . . . . . . . . . . . . . . . . . 8-2
CALL 17 – Disable DF1 Packet Interrupt. . . . . . . . . . . . . . . . . . . . . . 8-3
CALL 20 – Enable Processor Interrupt . . . . . . . . . . . . . . . . . . . . . . . . 8-3
CALL 21 – Disable Processor Interrupt. . . . . . . . . . . . . . . . . . . . . . . . 8-4
CALL 26 – Module Interrupt . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8-4
CALL 38 – Expanded ONERR Restart. . . . . . . . . . . . . . . . . . . . . . . . 8-5
CALL 70 – ROM to RAM Program Transfer . . . . . . . . . . . . . . . . . . . 8-8
CALL 71 – ROM/RAM to ROM Program Transfer. . . . . . . . . . . . . . 8-9
CALL 72 – RAM/ROM Return . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8-9
GOSUB . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8-11
ONERR . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8-12
ON-GOSUB. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8-14
ONTIME . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8-14
PUSH . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8-15
POP . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8-17
RETI. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8-18
RETURN . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8-18
STOP . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8-20
Math and Backplane Conversion Functions
Clock/Calendar Functions
Chapter 9
CALL 14 – 16-Bit Signed Integer to BASIC Floating-Point . . . . . . . . 9-1
CALL 15 – 16-Bit Unsigned Integer to BASIC Floating-Point. . . . . . 9-2
CALL 24 – BASIC Floating-Point to 16-Bit Signed Integer . . . . . . . . 9-2
CALL 25 – BASIC Floating-Point to 16-Bit Binary . . . . . . . . . . . . . . 9-3
CALL 88: BASIC Floating-Point to SLC Floating-Point. . . . . . . . . . . 9-4
CALL 89: SLC Floating-Point to BASIC Floating-Point. . . . . . . . . . . 9-5
Chapter 10
CALL 40 – Set Clock/Calendar Time . . . . . . . . . . . . . . . . . . . . . . . . 10-1
CALL 41 – Set Clock/Calendar Date . . . . . . . . . . . . . . . . . . . . . . . . 10-2
CALL 42 – Set Day of Week. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10-3
CALL 43 – Retrieve Date/Time String . . . . . . . . . . . . . . . . . . . . . . . 10-4
CALL 44 – Retrieve Date Numeric. . . . . . . . . . . . . . . . . . . . . . . . . . 10-4
CALL 45 – Retrieve Time String . . . . . . . . . . . . . . . . . . . . . . . . . . . 10-5
CALL 46 – Retrieve Time Numeric . . . . . . . . . . . . . . . . . . . . . . . . . 10-6
CALL 47 – Retrieve Day of Week String . . . . . . . . . . . . . . . . . . . . . 10-6
CALL 48 – Retrieve Day of Week Numeric . . . . . . . . . . . . . . . . . . . 10-7
CALL 52 – Retrieve Date String . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10-7
Publication 1746-RM001A-US-P
Table of Contents iv
Status Functions
Chapter 11
CALL 36 – Get Number of Characters in PRT2 Buffers . . . . . . . . . 11-2
CALL 51 – Check CPU Output Image Buffer . . . . . . . . . . . . . . . . . 11-3
CALL 55 – Check CPU Input Image Buffer. . . . . . . . . . . . . . . . . . . 11-4
CALL 58 – Check M0 File . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11-5
CALL 59 – Check M1 File . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11-6
CALL 75 – Check SLC 500 Controller CPU Status . . . . . . . . . . . . . 11-7
CALL 80 – Check Battery Condition . . . . . . . . . . . . . . . . . . . . . . . . 11-8
CALL 86 – Check DH485 Interface File Remote Write Status. . . . . 11-8
CALL 87 – Check DH485 Interface File Remote Read Status . . . . . 11-9
CALL 95 – Get Number of Characters in PRT1 Buffers . . . . . . . . 11-10
CALL 97 – Enable Port PRT2 DTR Signal . . . . . . . . . . . . . . . . . . 11-11
CALL 98 – Disable Port PRT2 DTR Signal. . . . . . . . . . . . . . . . . . 11-11
CALL 108 – Enable DF1 Driver Communications. . . . . . . . . . . . . 11-12
CALL 113 – Disable DF1 Driver Communications . . . . . . . . . . . . 11-18
CALL 120 – Clear module Input and Output Buffers . . . . . . . . . . 11-18
CALL 121 – Get SLC Processor Program ID Number . . . . . . . . . . 11-19
Output Functions
Chapter 12
CALL 23 – Transfer Data from the CPU Files to Port 1 or 2 . . . . . . 12-2
CALL 28 – Write to Remote DH485 SLC Data File . . . . . . . . . . . . 12-6
CALL 29 – Read/Write to a PLC/SLC from the
Module Internal String . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12-13
CALL 31 – Display Current PRT2 Port Setup . . . . . . . . . . . . . . . . 12-14
CALL 37 – Clear PRT2 Input/Output Buffers . . . . . . . . . . . . . . . . 12-15
CALL 54 – Transfer BASIC Output Buffer to CPU Input Image. . 12-15
CALL 57 – Transfer BASIC Output Buffer to CPU M1 File . . . . . 12-16
CALL 85 – Transfer BASIC Output Buffer to DH485
Common Interface File. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12-17
CALL 91 – Write BASIC Output Buffer to Remote DH485 Data File 12-18 CALL 93 – Write Output Buffer to Remote DH485
Common Interface File. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12-22
CALL 94 – Display Current PRT1 Port Setup . . . . . . . . . . . . . . . . 12-24
CALL 96 – Clear PRT1 Input/Output Buffers . . . . . . . . . . . . . . . . 12-24
CALL 112 – User LED Control . . . . . . . . . . . . . . . . . . . . . . . . . . . 12-25
CALL 114 – Transmit DF1 Packet. . . . . . . . . . . . . . . . . . . . . . . . . 12-26
CALL 115 – Check DF1 XMIT Status. . . . . . . . . . . . . . . . . . . . . . 12-27
CALL 123 – Write to Remote DF1 PLC Data File. . . . . . . . . . . . . 12-28
PRINT . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12-35
PH0., PH1. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12-37
ST@ . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12-38
Publication 1746-RM001A-US-P
Input Functions
Table of Contents v
Chapter 13
CALL 22 – Transfer Data from Port 1 or 2 to the CPU Files . . . . . . 13-2
CALL 27 – Read Remote DH485 SLC Data File . . . . . . . . . . . . . . . 13-8
CALL 29 – Read/Write to a PLC/SLC from the
Module Internal String . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13-13
CALL 35 – Get Numeric Input Character from PRT2 . . . . . . . . . . 13-15
CALL 53 – Transfer CPU Output Image to BASIC Input Buffer. . 13-17
CALL 56 – Transfer CPU M0 File to BASIC Input Buffer. . . . . . . 13-18
CALL 84 – Transfer DH485 Interface File to BASIC Input Buffer. 13-19 CALL 90 – Read Remote DH485 Data File to BASIC Input Buffer 13-20 CALL 92 – Read Remote DH485 Common Interface File to
BASIC Input Buffer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13-23
CALL 117 – Get DF1 Packet Length . . . . . . . . . . . . . . . . . . . . . . . 13-25
CALL 118 – PLC/SLC Unsolicited Writes . . . . . . . . . . . . . . . . . . . 13-26
CALL 122 – Read Remote DF1 PLC Data File . . . . . . . . . . . . . . . 13-30
GET . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13-38
INPL. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13-39
INPS. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13-40
INPUT . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13-40
LD@ . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13-43
READ . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13-45
Setup Functions
String Functions
Chapter 14
CALL 30 – Set PRT2 Port Parameters . . . . . . . . . . . . . . . . . . . . . . . 14-1
CALL 78 – Set Program Port Baud Rate. . . . . . . . . . . . . . . . . . . . . . 14-2
CALL 99 – Reset Print Head Pointer . . . . . . . . . . . . . . . . . . . . . . . . 14-3
CALL 105 – Reset PRT1 to Default Settings . . . . . . . . . . . . . . . . . . 14-4
CALL 119 – Reset PRT2 to Default Settings . . . . . . . . . . . . . . . . . . 14-4
MODE . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14-5
Chapter 15
CALL 60 – String Repeat . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15-1
CALL 61 – String Append . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15-2
CALL 62 – Number to String Conversion . . . . . . . . . . . . . . . . . . . . 15-3
CALL 63 – String to Number Conversion . . . . . . . . . . . . . . . . . . . . 15-4
CALL 64 – Find a String in a String . . . . . . . . . . . . . . . . . . . . . . . . . 15-6
CALL 65 – Replace a String in a String. . . . . . . . . . . . . . . . . . . . . . . 15-7
CALL 66 – Insert a String in a String . . . . . . . . . . . . . . . . . . . . . . . . 15-8
CALL 67 – Delete a String in a String. . . . . . . . . . . . . . . . . . . . . . . . 15-9
CALL 68 – Find the Length of a String. . . . . . . . . . . . . . . . . . . . . . 15-10
STRING. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15-11
Publication 1746-RM001A-US-P
Table of Contents vi
Decimal/Hexadecimal/Octal/ ASCII Conversion Table
BASIC Command, Statement, and CALL Quick Reference Guide
Appendix A
Mathematical Conversion Overview . . . . . . . . . . . . . . . . . . . . . . . . . . A-1
Appendix B
Mnemonic List Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . B-1
Index
Publication 1746-RM001A-US-P

Preface

Read this preface to familiarize yourself with the rest of the manual. This preface covers the following topics:
who should use this manual
the purpose of this manual
how to use this manual
terms and abbreviations
conventions used in this manual
Rockwell Automation support

Who Should Use This Manual

Use this manual if you are responsible for designing, installing, programming, or troubleshooting control systems that use Allen-Bradley small logic controllers.
You should have a basic understanding of SLC 500™ products. You should understand programmable controllers and be able to interpret the ladder logic instructions required to control your application. If you do not, contact your local Rockwell Automation representative for information on available training courses before using this product.
P-1 Publication 1746-RM001 A-US-P
P-2

Purpose of this Manual

This manual is a reference guide for programming the BASIC or BASIC-T module. This manual is intended for reference purposes only.
Chapter Title Contents
Preface Describes the purpose, background, and scope of this manual. Also lists related
publications.
1 Language Elements Describes BASIC program lines, line numbers, statements, commands,
operators, and line length.
2 Data Types Describes and illustrates data types, variable names and types.
3 Expressions and Operators Describes and illustrates arithmetic, logical, relational, trigonometric, functional,
logarithmic, string, and special function operators.
4 BASIC Commands Describes and illustrates BRKPNT, CONT, [CTRL-C], [CTRL-S], [CTRL-Q], EDIT,
ERASE, IDLE, LIST, LIST@, LIST#, MODE, NEW, NULL, PROG, PROG1, PROG2, RAM, REM, REN, ROM, RROM, RUN, SNGLSTP, VER, and XFER commands and CALLs 18 and 19.
5 Command Line CALLS Describes and illustrates CALLs 73, 74, 77, 81, 82, 101, 103, 104, 109, 110, and
111.
6 Assignment Functions Describes and illustrates CLEAR, CLEARI, CLEARS, DATA, DIM, LET and
RESTORE functions.
7 Control Functions Describes and illustrates CLOCK1, CLOCK0, DO-WHILE, DO-UNTIL, END,
FOR-TO-(STEP)-NEXT, GOTO, IF-THEN-ELSE, NEXT, and ON-GOTO functions.
8 Execution Control and Interrupt
Support Functions
9 Math and Backplane Functions Describes and illustrates CALLs 14, 15, 24, 25, 88, and 89.
10 Clock/Calendar Functions Describes and illustrates CALLs 40, 41, 42, 43, 44, 45, 46, 47, 48, and 52.
11 Status Functions Describes and illustrates CALLs 36, 51, 55, 58, 59, 75, 80, 86, 87, 95, 97, 98, 108,
12 Output Functions Describes and illustrates CALLs 23, 28, 29, 31, 37, 54, 57, 85, 91, 93, 94, 96, 112,
13 Input Functions Describes and illustrates CALLs 22, 27, 29, 35, 53, 56, 84, 90, 92, 117, 118, 122,
14 Setup Functions Describes and illustrates CALLs 30, 78, 99, 105, 119, and MODE functions.
15 String Functions Describes and illustrates CALLs 60, 61, 62, 63, 64, 65, 66, 67, 68, and STRING
Appendix A Decimal/Hexidecimal/Octal/
ASCII Conversion Table
Appendix B BASIC Command, Statement, and
CALL Quick Reference Guide
Describes and illustrates CALLs 16, 17, 20, 21, 26, 38, 70, 71, 72, and GOSUB, ONERR, ON-GOSUB, ONTIME, PUSH, POP, RETI, RETURN, and STOP functions.
113, 120, and 121.
114, 115, 123, and PRINT, PH0. PH1. and ST@ functions.
and GET, INPL, INPS, INPUT, LD@ and READ functions.
functions.
Lists the Decimal/Hexidecimal/Octal/ASCII equivalents.
Lists the various commands, statements, and CALLs needed for BASIC programming.
Publication 1746-RM001A-US-P
Related Documentation
The following documents contain additional information regarding Rockwell Automation products. To obtain a copy, contact your local Rockwell Automation office or distributor.
For Read this document Publication Number
P-3
A BASIC and BASIC-T manual that provides information on installing and using the 1746-BAS and 1746-BAS-T modules.
A programming manual with detailed instructions on installing and using BASIC Development Software to program the BASIC and BASIC-T modules.
An overview of the SLC 500 family of products SLC 500™ System Overview 1747-SO001A-US-P
A description of how to install and use a Modular SLC 500 Processor
A reference manual that contains status file data and instruction set information for SLC 500 processors
A description of how to install and use a module that acts as a bridge between DH485 networks and devices requiring DF1 protocol.
An application example demonstrating how to transfer ASCII data to an SLC 5/02 or later processor using a remote SLC 500 BASIC module.
In-depth information on grounding and wiring Allen-Bradley programmable controllers
A glossary of industrial automation terms and abbreviations
SLC 500™ BASIC and BASIC-T Modules User Manual
BASIC Development Software Programming Manual
Modular Hardware Style Installation and Operation Manual
SLC 500™ and MicroLogix™ 1000 Instruction Set Reference Manual
DH-485/RS-232C Interface Module User’s Manual
ASCII Data Transfer to the SLC 500™ BASIC Module (Series B)
Allen-Bradley Programmable Controller Grounding and Wiring Guidelines
Allen-Bradley Industrial Automation Glossary
1746-UM004A-US-P
1746-PM001A-US-P
1747-6.2
1747-6.15
1747-6.12
1746-2.41
1770-4.1
AG-7.1
An article on wire sizes and types for grounding electrical equipment

How to Use this Manual

To use this manual effectively, use the worksheets provided in Appendix B. The worksheets can help you document your application and settings and also facilitate the flow of information to other individuals in your organization for implementation.
National Electric Code Published by the National Fire Protection
Association of Boston, MA
Publication 1746-RM001A-US-P
P-4

Terms and Abbreviations

The following terms and abbreviations are specific to this product. For a complete listing of Allen-Bradley terminology, refer to the Allen-Bradley Industrial Automation Glossary, publication number ICCG-7.1.
Module SLC 500 BASIC and BASIC-T Modules (catalog numbers
1746-BAS and 1746-BAS-T)
BASIC development software BASIC Development Software (catalog
number 1747-PBASE)
BASIC —the BASIC-52 programming language
console device — the device connected to the BASIC module program port.
This device is used as an interface between the user and the BASIC program.
DH485 network communication protocol
EPROM Erasable Programmable Read Only Memory
EEPROM — Electrically Erasable Programmable Read Only Memory
memory module — BASIC or BASIC-T modules EEPROM or UVPROM
MTOP system control value that holds the last valid memory address
program port — the port used to program the module. Either PRT1 or port
DH485 can be used as the program port.
RAM — Random Access Memory

Conventions Used in this Manual

ROM — Read Only Memory, refers to the optional memory module memory
space (EEPROM or UVPROM)
RS-232/423 serial communication interface
RS-422 differential communication interface
RS-485 network communication interface
SCADA — Supervisory Control and Data Acquisition
scalar variable — a variable with a single value
SLC 500 SLC 500 fixed and modular controller
UVPROM — Ultra Violet Erasable Programmable Read Only Memory
The following conventions are used throughout this manual:
Bulleted lists such as this one provide information, not procedural steps.
Numbered lists provide sequential steps or hierarchical information.
Italic type is used for emphasis.
Te xt in this font indicates words or phrases you should type.
Publication 1746-RM001A-US-P
Key names match the names shown and appear in bold, capital letters within
brackets (for example,
[ENTER]).
P-5

Rockwell Automation Support

Allen-Bradley offers support services worldwide, with over 75 Sales/Support Offices, 512 authorized Distributors and 260 authorized Systems Integrators located throughout the United States alone, plus Rockwell Automation representatives in every major country in the world.
Local Product Support
Contact your local Rockwell Automation representative for:
sales and order support
product technical training
warranty support
support service agreements
Technical Product Assistance
If you need to contact Rockwell Automation for technical assistance, please review the information in the appropriate chapter first. Then call your local Rockwell Automation representative.
Your Questions or Comments on this Manual
If you find a problem with this manual, please notify us of it on the enclosed Publication Problem Report.
If you have any suggestions for how this manual could be made more useful to you, please contact us at the address below:
Rockwell Automation Control and Information Group Technical Communication, Dept. A602V P.O. Box 2086 Milwaukee, WI 53201-2086
Publication 1746-RM001A-US-P
P-6
Publication 1746-RM001A-US-P
Chapter
1

Language Elements

This chapter introduces you to the elements of a BASIC program. These elements include BASIC:
line numbers
statements, commands, and operators
line length

Character Set

The BASIC Program Line

BASIC programs are composed of a group of BASIC program lines. Each BASIC program line is composed of a group of ASCII characters. Refer to Appendix A for a complete listing of ASCII character codes.
BASIC program lines consist of a BASIC line number and BASIC statements and operators. BASIC program lines are restricted to the BASIC line length.
BASIC Line Numbers
We refer to BASIC line numbers as:
[ln num]
BASIC line numbers indicate the order that the program lines are stored in memory and are also used as references when branching and editing. This number may be any whole integer from 1 to 65535. Typically you start numbering BASIC programs with line number 10 and increment by 10. This allows you to add additional lines later as you work on your program.
Since the computer runs the statements in numerical order, additional lines need not appear in consecutive order on the screen. If you enter line 35 after line 40, the computer still runs line 35 after line 30 and before line 40. This technique saves you from reentering an entire program if you forget to include a line.
IMPORTANT
1 Publication 1746-RM001A-US-P
The first line of your program must be a comment.
1-2 Language Elements
Typically, the line numbers of a program start out looking like the first column and end up looking something like the second column below:
#1 #2 10 5 20 7 30 10 40 15 50 20 60 30 70 35 80 40
.. .. ..
IMPORTANT
Reuse of an existing line number causes all of the information referenced by the original line number to be lost. Be careful when entering numbers in the Command mode, as you may accidentally erase some program lines. You may delete an existing line by retyping it with no information following it and pressing
[RETURN].
BASIC Statements, Commands, and Operators
BASIC program lines consist of a BASIC line number and BASIC statements and operators. Depending on the logic of your program, there may be more than one statement on a line. If so, each must be separated by a colon (:).
BASIC Line Length
A BASIC program line always begins with a line number and must contain at least one character, but no more than 68 characters. A program line ends when you press
[RETURN].
Publication 1746-RM001A-US-P
Chapter

Data Types

This chapter provides you a method of defining or displaying data within the BASIC programming language through the use of:
data types
variables
2

Data Types

Data types are broken down into three sections: argument stack, string and numeric elementary data types, and backplane conversion data.
Argument Stack
The argument stack (A-stack) stores all constants that the BASIC or BASIC-T module is currently using. Operations such as add, subtract, multiply, and divide always operate on the first two numbers of the argument stack and return the result to the stack. The argument stack is 203 bytes long. Each floating point number placed in the stack requires 6 bytes of storage. The argument stack can hold up to 33 floating point numbers before overflowing.
In addition, the PUSH command saves data to the argument stack and the POP command restores data from the stack. PUSHes and POPs are typically associated with CALLs. PUSHes and POPs are mechanisms used to transfer information to and from CALL routines.
PUSH makes a copy of the variable being PUSHed, then puts that copy on the top of the argument stack. POP takes the value on the top of the argument stack and copies it to the variable being POPped.
String Data Types
A string is a character or group of characters stored in memory. Usually, the characters stored in a string make up a word or a sentence. Strings allow you to use characters instead of numbers. Strings are shown as:
$([expr])
The module uses single-dimension string variables, a string variable (the define and manipulate 255 different strings in the module. Initially, no memory is allocated for strings. Memory is allocated using the STRING statement. Strings are declared and manipulated through the $ operator.
1 Publication 1746-RM001A-US-P
[expr] value) ranges from 0 to 254. This means that you can
$([expr]). The dimension of
2-2 Data Types
When allocating memory for a string, you must account for the overhead bytes used by BASIC to manipulate strings. BASIC uses one overhead byte per string being declared plus one additional overhead byte.
Example 1
String 106,20
Allocates space for five 20 byte strings (100 bytes) and includes five overhead bytes (1 per string) and one additional overhead byte.
In the module you can define strings with the LET statement, the INPUT statement, and with the ASC operator.
Example 2
>10 STRING 106,20 >20 $(1)=“THIS IS A STRING, ” >30 INPUT “WHAT’S YOUR NAME? - ”,$(2) >40 PRINT $(1),$(2) >50 END
READY >RUN
WHAT’S YOUR NAME? - FRED THIS IS A STRING, FRED
READY >
You can also assign strings to each other with a LET statement.
Example 3
LET $(2)=$(1)
Result: Assigns the string value in $(1) to the STRING $(2).
Publication 1746-RM001A-US-P
Data Types 2-3
Numeric Data Types
There are two different numeric data types:
integer numbers
floating-point numbers
You can enter and display numbers in four formats: integer, decimal, hexadecimal, and exponential.
Example
129, 34.98, 0A6EH, 1.23456E+3
The BASIC or BASIC-T module interprets all numbers as floating-point numbers except when performing logical operations. When performing logical operations, the module converts floating-point numbers to integers, performs the operation, then converts the result back to floating-point.
Integer Numbers
The module operates on unsigned 16-bit integers that range from 0 to 65535 or 0FFFFH. You can enter all integers in either decimal or hexadecimal format. You indicate a hexadecimal number by placing the character H after the number (example: 170H). If the hexadecimal number begins with A through F, then it must be preceded by a zero. (For example, you must enter A567H as 0A567H.) When an operator, such as .AND. requires an integer, the module truncates the fraction portion of the number so it fits the integer format. Integers are shown as:
[integer]
IMPORTANT
The SLC 500 processor operates on signed 16-bit integers that range from –32768 to 32767. If an integer value larger than 32767 is passed to the processor from the module, that value is interpreted as negative by the processor.
Floating-Point Numbers
In the module, all numbers are stored as floating-point numbers. Floating-point numbers are numbers in which the decimal point floats depending on the significant digits of a specific number. The processor accounts for the location of the decimal point. This allows the processor to store only the significant digits of a value, thus saving memory space.
You can represent the following range of numbers in the module:
+1E –127 to +.99999999 +127
There are eight significant digits. Numbers are internally rounded to fit this precision.
Publication 1746-RM001A-US-P
2-4 Data Types
Backplane Conversion Data
The module communicates with the local processor through the SLC 500 I/O backplane. All data communicated to and from the SLC 500 is in SLC 500 format. The SLC 500 formats are:
16-bit signed integer (–32768 to 32767)
16-bit binary (0000000000000000 to 1111111111111111)

Variables

IMPORTANT
Variables that include a single-dimension expression [exp] are dimensioned or arrayed variables. Variables that contain a letter or a letter and a number are scalar variables. Any variables entered in lower case are changed to upper case. Variables are shown as:
[var]
The module allocates variables in a static manner, which means the first time a variable is used, the module allocates a portion of memory (8 bytes) specifically for that variable. This memory cannot be de-allocated on a variable to variable basis. This means that if you execute a statement (example: >10 Q - 3), you cannot tell the module that the variable Q no longer exists to free up the 8 bytes of memory that belong to Q. You can clear the memory allocated to variables by executing a CLEAR statement. The CLEAR statement frees all memory allocated to variables. Variables may be set aside for reuse to save memory.
IMPORTANT
Any integer larger than 32767 is interpreted as a negative number by the SLC 500 processor
The module requires less time to find a scalar variable because there is no expression to evaluate. To run a program as fast as possible, use single-dimension variables only when necessary. Use scalar variables for intermediate variables and assign the final result to a dimensioned variable. Also, put the most frequently used variables first. Variables defined first require the least amount of time to locate.
Publication 1746-RM001A-US-P
Data Types 2-5
Variable Names
Variables may represent either numeric values or strings. Variable names can only be eight characters long. The module compares the first, last, and number of characters in a variable name with the first, last, and number of characters in other variable names to determine if it is a unique variable name. The characters allowed in a variable name are letters, numbers, and the decimal point. Special type declaration characters are also allowed.
A variable can be a letter (for example
A, X, or I) followed by a:
single-dimension expression, (example: J(4), G(A+6), I(10*SIN (X))
number followed by a single-dimension expression (example: A1(8),
P7(10*SIN(X)), W8(A + C))
number (0 to 9) or letter (example: AA, AC, XX, A1, X3, G8) except for the
following combinations:
IMPORTANT
Reserved words (words already used in BASIC functions or statements) cannot be used as variable names.
CR, DO, IE, IF, IP, ON, PI, SP, TO, UI, UO
Variable Types
Type declaration characters indicate what a variable represents. The following type declaration character is recognized:
Character Variable Type
$ String variable
The only other legal variable type is a floating-point variable. Floating-point variables do not require a type declaration.
Publication 1746-RM001A-US-P
2-6 Data Types
Publication 1746-RM001A-US-P
Chapter
3

Expressions and Operators

This chapter describes and illustrates how you manipulate and/or evaluate expressions and statements within the BASIC program or the command line. Table
3.1 lists the corresponding mnemonics.
Table 3.1 Chapter Reference Guide
If you need (to) Use this mnemonic Page
Absolute value ABS( ) 3-9 Return the integer value of the ASCII character. ASC( ) 3-12 Return the arctangent of the argument. ATN( ) 3-8 Retrieve data from the specified memory address. CBY( ) 3-16 Count the value converted ASCII character. CHR( ) 3-14 Return the cosine of argument. COS( ) 3-8 Retrieve or assign data to or from the internal data memory of
the BASIC or BASIC-T module. Test for empty input buffer. EOF 3-15 “e” (2.7182818) TO THE X EXP( ) 3-11 Test for number of free bytes of RAM memory. FREE 3-15 Integer INT( ) 3-10 Read the number of bytes of memory in the current selected
program. Natural log LOG( ) 3-11 Read the last valid memory address. MTOP 3-16 One’s complement NOT( ) 3-9 PI-3.1415926 PI 3-10 Random number RND 3-11 Sign SGN 3-10 Return the sine of the argument SIN( ) 3-8 Square Root SQR( ) 3-10 Return the tangent of the argument. TAN( ) 3-8 Retrieve and/or assign the free running clock value. TIME 3-17 Retrieve or assign data to or from the external data memory of
the module. Addition + 3-3 Division / 3-4 Exponentiation ** 3-4 Multiplication * 3-4 Subtraction - 3-4 Logical AND .AND. 3-6 Logical OR .OR. 3-6
DBY( ) 3-16
LEN 3-15
XBY( ) 3-17
1 Publication 1746-RM001A-US-P
3-2 Expressions and Operators
Table 3.1 Chapter Reference Guide
If you need (to) Use this mnemonic Page
Logical Exclusive OR .XOR. 3-6 Direct communications to port PRT1. @ 3-15 Direct communications to port PRT2. # 3-15

Expressions and Operators

An expression is a logical mathematical expression that involves operators, constants, and variables. There are eight types of operators that may act on an expression:
arithmetic
logical
relational
trigonometric
functional
logarithmic
string
special function
Expressions
Expressions are simple or complex.
Simple expression:
12*EXP(A)/100,H(1) + 55,
Publication 1746-RM001A-US-P
Complex expression:
A stand alone variable [var] or constant [const] is also considered an expression. Expressions are shown as:
[expr]
(SIN(A)*SIN(A)+COS(A)* COS(A)/2)
Operators
An operator performs a defined operation on variables or constants. Operators require either one or two operands. Typical two operand operators include ADD(+), SUBTRACT(-), MULTIPLY(*) and DIVIDE(/). We call operators that require only one operand, single-operand operators. Typical single-operand operators are SIN, COS, and ABS.
Expressions and Operators 3-3

Hierarchy of Operators

The hierarchy of operators is the order that the operations in an expression are performed. You can write complex expressions using only a small number of parentheses. To illustrate the hierarchy of operators, examine the following equation:
4+3*2 = ?
In this equation, multiplication has precedence over addition. Therefore, multiply (3*2) and then add 4.
4+3*2 = 10
When an expression is scanned from left to right, an operation is not performed until an operator of lower or equal precedence is encountered. In the example, you cannot perform addition until the multiplication operation is complete because multiplication has a higher precedence. Use parentheses if you are in doubt about the order of precedence or to enhance program readability. The precedence of operators from highest to lowest in the module is:
1.
1. Operators that use parentheses ( )
1.1.
2.
2. Exponentiation (**)
2.2.
3.
3. Negation (-)
3.3.

Arithmetic Operators

4.
4. Multiplication (*) and division (/)
4.4.
5.
5. Addition (+) and subtraction (-)
5.5.
6.
6. Relational expressions (-, <>, >, >=, <, <-).
6.6.
7.
7. Logical AND (.AND.)
7.7.
8.
8. Logical OR (.OR.)
8.8.
9.
9. Logical XOR (.XOR.)
9.9.
The module contains a complete set of arithmetic operators that are divided into two groups: dual-operand operators and single-operand operators.
The general form of all dual-operand instructions is:
(expr) OP (expr), where OP is one of the following arithmetic operators
Add ( + )
Use the Addition operator to add the first and the second expressions together.
Example Result
>PRINT 3+2 5
Publication 1746-RM001A-US-P
3-4 Expressions and Operators
Divide ( / )
Use the Division operator to divide the first expression by the second expression.
Example Result
>PRINT 100/5 20
Exponentiation ( **)
Use the Exponentiation operator to raise the first expression to the power of the second expression. The maximum power to which you can raise a number is 255.
Example Result
>PRINT 2**3 8
Multiply ( * )
Use the Multiplication operator to multiply the first expression by the second expression.
Example Result
>PRINT 3*3 9
Subtract ( - )
Use the Subtraction operator to subtract the second expression from the first expression.
Example Result
>PRINT 9-6 3
Negation ( - )
Use the Negation operator to change an expression from positive to negative.
Example Result
>PRINT –(9+4) –13
Publication 1746-RM001A-US-P
Expressions and Operators 3-5
Overflow and Division by Zero
During the evaluation of an expression if an overflow, underflow, or division by zero error occurs, the module generates error messages and reverts to Command mode. Refer to the ONERR operation in chapter 8 for more information on how to trap these errors.
The largest result allowed from any calculation is 0.99999999 E+127. If this number is exceeded, the module generates the and returns to Command mode.
The smallest result allowed from any calculation is 0.99999999 E-128. If this number is exceeded, the module generates the message and returns to Command mode.
If an attempt is made to divide any number by zero, the module generates the
ERROR: DIVIDE BY ZERO message and returns to Command mode.
>10 PRINT 9/0 >20 PRINT “PROGRAM SHOULD NOT GET HERE.”
ERROR: ARITH. OVERFLOW message
ERROR: ARITH. UNDERFLOW
READY >RUN
ERROR: DIVIDE BY ZERO - IN LINE 10
10 PRINT 9/0
-----------------X
READY >
>10 PRINT 9.9E126*(2) >
READY >RUN
ERROR: ARITH. OVERFLOW - IN LINE 10
10 PRINT 9.9E126*(2)
-------------------------X
READY >
Publication 1746-RM001A-US-P
3-6 Expressions and Operators

Logical Operators

The module contains a complete set of logical operators that are divided into two groups: dual-operand operators and single-operand operators.
The general form of all dual-operand instructions is:
(expr) OP (expr), where OP is one of the following logical operators.
These operators perform BIT-WISE logical operations on numbers between 0 (0000H) and 65535 (0FFFFH) inclusive. If the argument is outside this range, then the module generates an
ERROR: BAD ARGUMENT message and returns to
Command mode. All decimal places are truncated, not rounded. Use the following table for bit manipulations on 16-bit values.
Table 3.2 Bit Manipulations on 16-Bit Values
X Y X .AND.Y X .OR.Y X .XOR.Y
00000 01011 10011 11110
.AND.
Use the logical .AND. operator to logically AND expressions together.
Example Result
>PRINT 3.AND.2 2
.OR.
Use the logical .OR. operator to logically OR expressions together.
Example Result
>PRINT 1.OR.4 5
.XOR.
Use the logical exclusive .XOR. operator to logically XOR expressions together.
Example Result
>PRINT 7.XOR.6 1
Publication 1746-RM001A-US-P
Expressions and Operators 3-7

Relational Operators

Relational expressions involve the operators =, < >, >, >=, <, and <=. In the module, relational operations are typically used to test a condition. The module relational operators return a result of 65535 (0FFFFH) if the relational expression is true, and a result of 0 if the relation expression is false. The result returns to the argument stack. Because of this, it is possible to display the result of a relational expression.
Relational expressions are shown as:
[rel expr]
Example Result
>PRINT 1=0 0 >PRINT 1>0 65535 >PRINT A<>A 0 >PRINT A=A 65535
You can chain relational expressions with the logical operators .AND., .OR., and .XOR.. This makes it possible to test a complex condition with ONE statement.
>10 IF (A>E).AND.(A>C).OR.(A>D)THEN...
Additionally, you can use the NOT([expr]) operator.
>10 IF NOT(A>E).AND.(A>C)THEN...
By chaining relational expressions with logical operators, you can test particular conditions with one statement.
IMPORTANT
When using logical operators to link relational expressions, you must be sure operations are performed in the proper sequence. When in doubt, use parentheses.
Publication 1746-RM001A-US-P
3-8 Expressions and Operators

Trigonometric Operators

The module contains a complete set of trigonometric operators. These operators are single-operand operators.
SIN([expr])
Use the SIN operator to return the sine of the argument. The argument is expressed in radians. Calculations are carried out to 7 significant digits. The argument must be between +
Example Result
>PRINT SIN(PI/4) .7071067 >PRINT SIN(0) 0
200000.
COS([expr])
Use the COS operator to return the cosine of the argument. The argument is expressed in radians. Calculations are carried out to 7 significant digits. The argument must be between +
Example Result
>PRINT COS(PI/4) .7071067 >PRINT COS(0) 1
200000.
TAN([expr])
Use the TAN operator to return the tangent of the argument. The argument is expressed in radians. The argument must be between +
Example Result
>PRINT TAN(PI/4) 1 >PRINT TAN(0) 0
200000.
ATN([expr])
Use the ATN operator to return the arctangent of the argument. The result is in radians. Calculations are carried out to 7 significant digits. The ATN operator returns a result between –PI/2 (3.1415926/2) and PI/2.
Example Result
>PRINT ATN(PI) 1.2626272 >PRINT ATN(1) .78539804
Publication 1746-RM001A-US-P
Loading...
+ 250 hidden pages