BASIC Language(Catalog Numbers 1746-BAS and 1746-BAS-T)Reference Manual
Publication 1746-RM001A-US-P P-2Purpose of this ManualThis manual is a reference guide for programming the BASIC or BASIC-T module. This manua
Publication 1746-RM001A-US-P8-4 Execution Control and Interrupt Support FunctionsExample>1 REM EXAMPLE PROGRAM>10 REM ENABLE PROCESSOR IN
Publication 1746-RM001A-US-PExecution Control and Interrupt Support Functions 8-5The POP shows the status of the SLC processor:• 0 - SLC proce
Publication 1746-RM001A-US-P8-6 Execution Control and Interrupt Support FunctionsIf you perform an XBY in the error routine, this is a list of
Publication 1746-RM001A-US-PExecution Control and Interrupt Support Functions 8-7SyntaxPUSH [0 or 1]CALL 38Example>1 REM EXAMPLE PROGRAM>
Publication 1746-RM001A-US-P8-8 Execution Control and Interrupt Support FunctionsCALL 70 – ROM to RAM Program TransferPurposeUse CALL 70 to shi
Publication 1746-RM001A-US-PExecution Control and Interrupt Support Functions 8-9CALL 71 – ROM/RAM to ROM Program TransferPurposeUse CALL 71 to
Publication 1746-RM001A-US-P8-10 Execution Control and Interrupt Support FunctionsSyntaxCALL 72ExampleProgram in ROM 1>1 REM EXAMPLE PROGRAM
Publication 1746-RM001A-US-PExecution Control and Interrupt Support Functions 8-11GOSUBPurposeUse the GOSUB statement to cause the module to tr
Publication 1746-RM001A-US-P8-12 Execution Control and Interrupt Support Functions>20 GOSUB 100>30 NEXT I>40 END>100 REM USER SUBRO
Publication 1746-RM001A-US-PExecution Control and Interrupt Support Functions 8-13Example>1 REM EXAMPLE PROGRAM>10 ONERR 500>20 FORI=5
Publication 1746-RM001A-US-P P-3Related DocumentationThe following documents contain additional information regarding Rockwell Automation produ
Publication 1746-RM001A-US-P8-14 Execution Control and Interrupt Support FunctionsON-GOSUBPurposeUse the ON-GOSUB statement to transfer control
Publication 1746-RM001A-US-PExecution Control and Interrupt Support Functions 8-15Example>1 REM EXAMPLE PROGRAM>10 TIME = 0>15 DBY(71)
Publication 1746-RM001A-US-P8-16 Execution Control and Interrupt Support FunctionsYou can push more than one expression onto the argument stack
Publication 1746-RM001A-US-PExecution Control and Interrupt Support Functions 8-17POPPurposeUse the POP statement to remove values from the mod
Publication 1746-RM001A-US-P8-18 Execution Control and Interrupt Support FunctionsRETIPurposeUse the RETI statement to exit from an interrupt (
Publication 1746-RM001A-US-PExecution Control and Interrupt Support Functions 8-19ExamplesSimple Subroutine>1 REM EXAMPLE PROGRAM>10 FORI
Publication 1746-RM001A-US-P8-20 Execution Control and Interrupt Support FunctionsSTOPPurposeUse the STOP statement to break program execution
1 Publication 1746-RM001A-US-PChapter 9Math and Backplane Conversion FunctionsThis chapter describes and illustrates commands that convert numbers bet
Publication 1746-RM001A-US-P9-2 Math and Backplane Conversion FunctionsCALL 15 – 16-Bit Unsigned Integer to BASIC Floating-PointPurposeUse CALL
Publication 1746-RM001A-US-PMath and Backplane Conversion Functions 9-3SyntaxPUSH [value to be converted]PUSH [word number of module output buf
Publication 1746-RM001A-US-P P-4Terms and AbbreviationsThe following terms and abbreviations are specific to this product. For a complete list
Publication 1746-RM001A-US-P9-4 Math and Backplane Conversion FunctionsExample>1 REM EXAMPLE PROGRAM>40 PUSH 9E+1 : REM THE VALUE TO BE C
Publication 1746-RM001A-US-PMath and Backplane Conversion Functions 9-5SyntaxThis routine has two input arguments and no output arguments. The
Publication 1746-RM001A-US-P9-6 Math and Backplane Conversion FunctionsSLC floating-point numbers are stored in two 16-bit words.SyntaxThis rou
1 Publication 1746-RM001A-US-PChapter 10Clock/Calendar FunctionsThis chapter describes and illustrates commands that set and display the real time clo
Publication 1746-RM001A-US-P10-2 Clock/Calendar FunctionsExampleProgram the wall clock for 1:35 P.M. (programmed as 13:35; only a 24-hour clock
Publication 1746-RM001A-US-PClock/Calendar Functions 10-3ExampleProgram the clock/calendar for the 16th day of June 1991.>1 REM EXAMPLE PROG
Publication 1746-RM001A-US-P10-4 Clock/Calendar FunctionsCALL 43 – Retrieve Date/Time StringPurposeUse CALL 43 to return the current date and t
Publication 1746-RM001A-US-PClock/Calendar Functions 10-5Example>1 REM EXAMPLE PROGRAM>10 REM DATE RETRIEVE - NUMERIC EXAMPLE>20 CALL
Publication 1746-RM001A-US-P10-6 Clock/Calendar FunctionsCALL 46 – Retrieve Time NumericPurposeUse CALL 46 to return the time of day in numeric
Publication 1746-RM001A-US-PClock/Calendar Functions 10-7>20 PUSH 0 :CALL 47>30 PRINT “TODAY IS ”,$(0)READY>RUNTODAY IS FRIREADY>CA
Publication 1746-RM001A-US-P P-5Rockwell Automation SupportAllen-Bradley offers support services worldwide, with over 75 Sales/Support Offices,
Publication 1746-RM001A-US-P10-8 Clock/Calendar FunctionsSyntaxPUSH [string number]CALL 52Example>1 REM EXAMPLE PROGRAM>10 STRING 100,20&
1 Publication 1746-RM001A-US-PChapter 11Status FunctionsThis chapter describes and illustrates commands that monitor the status of the BASIC or BASIC-
Publication 1746-RM001A-US-P11-2 Status FunctionsCALL 36 – Get Number of Characters in PRT2 BuffersPurposeUse CALL 36 to retrieve the number of
Publication 1746-RM001A-US-PStatus Functions 11-3CALL 51 – Check CPU Output Image BufferPurposeUse CALL 51 to determine if the SLC 500 controll
Publication 1746-RM001A-US-P11-4 Status FunctionsCALL 55 – Check CPU Input Image BufferPurposeUse CALL 55 to determine if the SLC 500 controlle
Publication 1746-RM001A-US-PStatus Functions 11-5CALL 58 – Check M0 FilePurposeUse CALL 58 to determine if the Module File M0 located in the mo
Publication 1746-RM001A-US-P11-6 Status FunctionsCALL 59 – Check M1 FilePurposeUse CALL 59 to determine if the Module File M1 located in the mo
Publication 1746-RM001A-US-PStatus Functions 11-7CALL 75 – Check SLC 500 Controller CPU StatusPurposeUse CALL 75 to check the mode (Run/Program
Publication 1746-RM001A-US-P11-8 Status FunctionsCALL 80 – Check Battery ConditionPurposeUse CALL 80 to check the module battery condition. If
Publication 1746-RM001A-US-PStatus Functions 11-9>110 POP X : REM GET THE STATUS>120 IF(X<>1) THEN GOTO 100 : REM WAIT ON THE DATAR
Publication 1746-RM001A-US-P P-6
Publication 1746-RM001A-US-P11-10 Status FunctionsCALL 95 – Get Number of Characters in PRT1 Buffers PurposeUse CALL 95 to retrieve the number
Publication 1746-RM001A-US-PStatus Functions 11-11CALL 97 – Enable Port PRT2 DTR SignalPurposeUse CALL 97 to enable the Data Terminal Ready (DT
Publication 1746-RM001A-US-P11-12 Status FunctionsCALL 108 – Enable DF1 Driver Communications PurposeUse CALL 108 to enable DF1 driver communic
Publication 1746-RM001A-US-PStatus Functions 11-13 IMPORTANTOther port parameters, such as baud rate, number of stop bits, and parity are selec
Publication 1746-RM001A-US-P11-14 Status FunctionsHalf-Duplex No Handshaking Modem ControlHalf-duplex no handshaking modem control, selected by
Publication 1746-RM001A-US-PStatus Functions 11-15Half-Duplex With Continuous Carrier Modem ControlHalf-duplex with continuous carrier modem co
Publication 1746-RM001A-US-P11-16 Status FunctionsFull-Duplex With No HandshakingFull-duplex with no handshaking, selected by operation codes 1
Publication 1746-RM001A-US-PStatus Functions 11-17The second input argument specifies the Poll Time-out period when in half-duplex mode or the
Publication 1746-RM001A-US-P11-18 Status FunctionsSyntaxPUSH [operational code]PUSH [Poll timeout or ACKnowledge timeout]PUSH [message retries
Publication 1746-RM001A-US-PStatus Functions 11-19that corresponds to the module input and output buffers, as shown in the table below: You mus
1 Publication 1746-RM001A-US-PChapter 1Language ElementsThis chapter introduces you to the elements of a BASIC program. These elements include BASIC:
Publication 1746-RM001A-US-P11-20 Status FunctionsSyntaxCALL 121POP [program ID number]Example>1 REM EXAMPLE PROGRAM>10 CALL 121>20 PO
1 Publication 1746-RM001A-US-PChapter 12Output FunctionsThis chapter describes and illustrates commands that allow the transfer of data from the BASIC
Publication 1746-RM001A-US-P12-2 Output FunctionsCALL 23 – Transfer Data from the CPU Files to Port 1 or 2 PurposeUse CALL 23 to transfer data
Publication 1746-RM001A-US-POutput Functions 12-32.2.2.2. The ladder logic program of the SLC processor must set the output file word 0, bit 6
Publication 1746-RM001A-US-P12-4 Output FunctionsTransfers continue in this manner until the CALL for the port is re-executed with different in
Publication 1746-RM001A-US-POutput Functions 12-5The fifth input argument is the byte swap selection. It has the following values:• 0 - Data b
Publication 1746-RM001A-US-P12-6 Output FunctionsExample>1 REM EXAMPLE PROGRAM>10 REM ENABLE CALL 23 INTERRUPTS>20 PUSH 2 : REM SEND D
Publication 1746-RM001A-US-POutput Functions 12-7If an internal string is chosen, the first character (transaction number) is incremented on su
Publication 1746-RM001A-US-P12-8 Output Functions6.6.6.6. The SLC retrieves the status and resets output file word 0, bit 11. The data buffer c
Publication 1746-RM001A-US-POutput Functions 12-9If the file type is not one of these listed below, the status equals 2 and the write message d
Publication 1746-RM001A-US-P1-2 Language ElementsTypically, the line numbers of a program start out looking like the first column and end up lo
Publication 1746-RM001A-US-P12-10 Output Functionsoffset should not be 0 since this word is reserved for the data transfer handshaking bits. Th
Publication 1746-RM001A-US-POutput Functions 12-11SyntaxPUSH [type of WRITE command] PUSH [remote node address] PUSH [remote file number]PUSH [
Publication 1746-RM001A-US-P12-12 Output Functions0000I:20 O:111 OSRB3:00COPCopy FileSource #N7:0Dest #M0:1.0Length 20LO:
Publication 1746-RM001A-US-POutput Functions 12-13CALL 29 – Read/Write to a PLC/SLC from the Module Internal StringPurposeUse CALL 29, in conju
Publication 1746-RM001A-US-P12-14 Output FunctionsExampleCALL 122 must be enabled with internal string only prior to executing CALL 29 in this
Publication 1746-RM001A-US-POutput Functions 12-15CALL 37 – Clear PRT2 Input/Output BuffersPurposeUse CALL 37 to clear the peripheral port inpu
Publication 1746-RM001A-US-P12-16 Output FunctionsBit 13 of word 200 is the battery status bit. It can have one of the following values:• 0 -
Publication 1746-RM001A-US-POutput Functions 12-17SyntaxPUSH [number of words to be transferred]CALL 57POP [processor mode]Example>1 REM EXA
Publication 1746-RM001A-US-P12-18 Output FunctionsExample>1 REM EXAMPLE PROGRAM>40 PUSH 31 : REM OFFSET ADDRESS = 31>50 PUSH 3 : REM W
Publication 1746-RM001A-US-POutput Functions 12-19The fifth input argument is the number of elements to be transferred. If the number is not wi
1 Publication 1746-RM001A-US-PChapter 2Data TypesThis chapter provides you a method of defining or displaying data within the BASIC programming langua
Publication 1746-RM001A-US-P12-20 Output FunctionsThis CALL is implemented as a Protected Typed Logical Write with two address fields.Table 12.
Publication 1746-RM001A-US-POutput Functions 12-21SyntaxPUSH [remote device node address]PUSH [remote device file number]PUSH [remote device fi
Publication 1746-RM001A-US-P12-22 Output FunctionsCALL 93 – Write Output Buffer to Remote DH485 Common Interface FilePurposeUse CALL 93 to writ
Publication 1746-RM001A-US-POutput Functions 12-23SyntaxPUSH [remote device node address]PUSH [starting element offset (x2) of remote device fi
Publication 1746-RM001A-US-P12-24 Output FunctionsExample>1 REM EXAMPLE PROGRAM>30 PUSH 1 : REM REMOTE NODE ADDRESS = 1>40 PUSH 0 : RE
Publication 1746-RM001A-US-POutput Functions 12-25SyntaxPUSH [buffer selection]CALL 96Example>1 REM EXAMPLE PROGRAM>10 PUSH 0 : CALL 96 :
Publication 1746-RM001A-US-P12-26 Output FunctionsExample>1 REM EXAMPLE PROGRAM>100 PUSH 1 : REM TURN ON LED1>110 PUSH 0 : REM TURN OF
Publication 1746-RM001A-US-POutput Functions 12-27Example>1 REM EXAMPLE PROGRAM>10 CALL 114>20 ENDCALL 115 – Check DF1 XMIT Status Pur
Publication 1746-RM001A-US-P12-28 Output FunctionsCALL 123 – Write to Remote DF1 PLC Data FilePurposeUse CALL 123 to write up to 64 words of da
Publication 1746-RM001A-US-POutput Functions 12-293.3.3.3. The module places the status of the transaction in input file word 1, bits 0-7.4.4.4
Publication 1746-RM001A-US-P2-2 Data TypesWhen allocating memory for a string, you must account for the overhead bytes used by BASIC to manipul
Publication 1746-RM001A-US-P12-30 Output FunctionsThe second input argument is the decimal node address of the PLC remote device (0 through 254
Publication 1746-RM001A-US-POutput Functions 12-31The seventh input argument is the message time-out value. This value (1 through 255) correspo
Publication 1746-RM001A-US-P12-32 Output FunctionsTable 12.11 Transaction Status CodesCode Indicates0 Transfer OK.1 Transmission failed.2 Enqui
Publication 1746-RM001A-US-POutput Functions 12-33SyntaxPUSH [type of PLC WRITE command] PUSH [remote PLC node address] PUSH [file number of re
Publication 1746-RM001A-US-P12-34 Output FunctionsExample>1 REM EXAMPLE PROGRAM>10 REM ENABLE DF1 PLC REMOTE WRITE COMMAND>20 PUSH 5 :
Publication 1746-RM001A-US-POutput Functions 12-35PRINTPurposeUse the PRINT statement to direct the module to output a value to the console dev
Publication 1746-RM001A-US-P12-36 Output FunctionsUse the PRINT CR expression to output a carriage return without a line feed. >1 REM EXAMPL
Publication 1746-RM001A-US-POutput Functions 12-37>1 REM EXAMPLE PROGRAM>10 PRINT USING(###.##),>20 PRINT 4.67890, 123.456>30 PRINT
Publication 1746-RM001A-US-P12-38 Output FunctionsSyntaxPH0., PH1.Example>PH0.2*204H>PH1.2*20004H>PH0. 10064H>PH0. 10003E8H>PH1.
Publication 1746-RM001A-US-POutput Functions 12-39P. MTOP-10*624455>PUSH 24455 : CALL 77>P. MTOP24455>1 REM EXAMPLE PROGRAM>5 DIM A
Publication 1746-RM001A-US-PData Types 2-3Numeric Data TypesThere are two different numeric data types:• integer numbers• floating-point numb
Publication 1746-RM001A-US-P12-40 Output Functions
1 Publication 1746-RM001A-US-PChapter 13Input FunctionsThis chapter describes and illustrates commands that allow the BASIC or BASIC-T module to read
Publication 1746-RM001A-US-P13-2 Input FunctionsCALL 22 – Transfer Data from Port 1 or 2 to the CPU FilesPurposeUse CALL 22 to transfer data fr
Publication 1746-RM001A-US-PInput Functions 13-32.2.2.2. The module places the byte count of the valid data into the lower byte of the first a
Publication 1746-RM001A-US-P13-4 Input Functions6.6.6.6. The ladder logic program of the SLC resets output file word 0, bit 8 or bit 9. The mo
Publication 1746-RM001A-US-PInput Functions 13-5The third input argument is the decimal value of the ASCII character delimiter. Any valid ASCII
Publication 1746-RM001A-US-P13-6 Input FunctionsThe last CALL 22 or CALL 23 executed determines the byte swap option for all active CALL 22 com
Publication 1746-RM001A-US-PInput Functions 13-7Example>1 REM EXAMPLE PROGRAM>10 REM ENABLE CALL 22 INTERRUPTS>20 PUSH 1 : REM PRT1 AC
Publication 1746-RM001A-US-P13-8 Input FunctionsCALL 27 – Read Remote DH485 SLC Data FilePurposeUse CALL 27 to read up to 64 words of data from
Publication 1746-RM001A-US-PInput Functions 13-94.4.4.4. The module places the status in the input file word 1, bits 0-7.5.5.5.5. The module
Important User InformationBecause of the variety of uses for the products described in this publication, those responsible for the application and use
Publication 1746-RM001A-US-P2-4 Data TypesBackplane Conversion DataThe module communicates with the local processor through the SLC 500 I/O bac
Publication 1746-RM001A-US-P13-10 Input FunctionsThe first input argument is the type of SLC READ command issued:• 0 - Disable the previously
Publication 1746-RM001A-US-PInput Functions 13-11The seventh input argument is the message time-out value. This value (1 through 255) correspon
Publication 1746-RM001A-US-P13-12 Input FunctionsWhenever an attempt is made to read a remote packet, the status of the read is placed into inp
Publication 1746-RM001A-US-PInput Functions 13-13CALL 29 – Read/Write to a PLC/SLC from the Module Internal StringPurposeUse CALL 29, in conjun
Publication 1746-RM001A-US-P13-14 Input FunctionsWhen CALL 29 is executed, the transfer is attempted. If the selected CALL (27, 28, 122, or 123
Publication 1746-RM001A-US-PInput Functions 13-15CALL 35 – Get Numeric Input Character from PRT2PurposeUse CALL 35 to retrieve the current char
Publication 1746-RM001A-US-P13-16 Input FunctionsExample 2>1 REM EXAMPLE PROGRAM>10 REM PERIPHERAL PORT INPUT USING CALL 35>20 STRING
Publication 1746-RM001A-US-PInput Functions 13-17CALL 53 – Transfer CPU Output Image to BASIC Input BufferPurposeUse CALL 53 to transfer words
Publication 1746-RM001A-US-P13-18 Input FunctionsCALL 56 – Transfer CPU M0 File to BASIC Input BufferPurposeUse CALL 56 to transfer up to 64 wo
Publication 1746-RM001A-US-PInput Functions 13-19CALL 84 – Transfer DH485 Interface File to BASIC Input BufferPurposeUse CALL 84 to transfer up
Publication 1746-RM001A-US-PData Types 2-5Variable NamesVariables may represent either numeric values or strings. Variable names can only be ei
Publication 1746-RM001A-US-P13-20 Input FunctionsCALL 90 – Read Remote DH485 Data File to BASIC Input BufferPurposeUse CALL 90 to read up to 40
Publication 1746-RM001A-US-PInput Functions 13-21The sixth input argument is the message time-out value. This value is the number of hundreds o
Publication 1746-RM001A-US-P13-22 Input FunctionsSyntaxPUSH [remote device node address]PUSH [remote device file number]PUSH [remote device fil
Publication 1746-RM001A-US-PInput Functions 13-23CALL 92 – Read Remote DH485 Common Interface File to BASIC Input BufferPurposeUse CALL 92 to r
Publication 1746-RM001A-US-P13-24 Input FunctionsSyntaxPUSH [remote device node address]PUSH [starting element offset (x2) of remote device fil
Publication 1746-RM001A-US-PInput Functions 13-25Example>1 REM EXAMPLE PROGRAM>30 PUSH 1 : REM REMOTE NODE ADDRESS = 1>40 PUSH 0 : REM
Publication 1746-RM001A-US-P13-26 Input FunctionsCALL 118 – PLC/SLC Unsolicited WritesPurposeUse CALL 118 to allow the module to receive data p
Publication 1746-RM001A-US-PInput Functions 13-273.3.3.3. The module places the byte count into the lower byte of the first available word of
Publication 1746-RM001A-US-P13-28 Input FunctionsThe SLC processor must not set, then reset, the output file word 0, bit 12 on the same ladder
Publication 1746-RM001A-US-PInput Functions 13-29If the DH485 port is used for data transfer, an offset of greater than 40 hex (64 decimal) wor
Publication 1746-RM001A-US-P2-6 Data Types
Publication 1746-RM001A-US-P13-30 Input FunctionsExample>1 REM EXAMPLE PROGRAM>10 REM ENABLE PLC/SLC UNSOLICITED WRITE INTERRUPT>20 PU
Publication 1746-RM001A-US-PInput Functions 13-31If an internal string is chosen, the first character (transaction number) is incremented upon
Publication 1746-RM001A-US-P13-32 Input Functions5.5.5.5. The module sets the input file word 0, bit 10 to inform the SLC processor that valid
Publication 1746-RM001A-US-PInput Functions 13-33The third input argument is the file number to be read on the PLC remote device (0 through 255
Publication 1746-RM001A-US-P13-34 Input FunctionsThe seventh input argument is the message time-out value. This value (1 through 255) correspon
Publication 1746-RM001A-US-PInput Functions 13-35The output argument is the status of the CALL. It has the following values:• 0 – Successful •
Publication 1746-RM001A-US-P13-36 Input FunctionsC5 Illegal address format – symbol is 0 or greater than the maximum number of characters suppo
Publication 1746-RM001A-US-PInput Functions 13-37SyntaxPUSH [type of PLC READ command] PUSH [remote PLC node address] PUSH [file number of remo
Publication 1746-RM001A-US-P13-38 Input FunctionsGETPurposeUse the GET operator in the Run mode. It returns a result of zero in the Command mod
Publication 1746-RM001A-US-PInput Functions 13-39SyntaxGETExample>1 REM EXAMPLE PROGRAM>10A=GET>20 IF (A<>0) THEN PRINT A : REM
1 Publication 1746-RM001A-US-PChapter 3Expressions and OperatorsThis chapter describes and illustrates how you manipulate and/or evaluate expressions
Publication 1746-RM001A-US-P13-40 Input FunctionsExample>1 REM EXAMPLE PROGRAM>10 STRING 270,254 : REM ONE STRING OF < 254 BYTES>20
Publication 1746-RM001A-US-PInput Functions 13-41SyntaxINPUTExamples>INPUT A,C>INPUT A,C causes a question mark (?) to print on the conso
Publication 1746-RM001A-US-P13-42 Input FunctionsENTER A NUMBER - 255READY>You can also assign strings with an INPUT statement. Strings are
Publication 1746-RM001A-US-PInput Functions 13-43LD@PurposeUse the LD@ statement to retrieve floating point numbers that were stored with a ST@
Publication 1746-RM001A-US-P13-44 Input FunctionsREADY>RUN 20212223242526272829READY>PUSH 5FFFH : CALL 77>P. MTOP24575
Publication 1746-RM001A-US-PInput Functions 13-45READPurposeUse the READ statement to retrieve the expressions that are specified in the DATA s
Publication 1746-RM001A-US-P13-46 Input Functions
1 Publication 1746-RM001A-US-PChapter 14Setup FunctionsThis chapter describes and illustrates commands used to set port parameters within the BASIC pr
Publication 1746-RM001A-US-P14-2 Setup FunctionsExample>1 REM EXAMPLE PROGRAM>10 REM CALL 30 INPUT PARAMETERS:>20 REM FIRST PUSH : 5,
Publication 1746-RM001A-US-PSetup Functions 14-3SyntaxPUSH [baud rate]CALL 78Example>1 REM EXAMPLE PROGRAM>10 PUSH 4800>20 CALL 78CALL
Publication 1746-RM001A-US-P3-2 Expressions and OperatorsExpressions and OperatorsAn expression is a logical mathematical expression that invol
Publication 1746-RM001A-US-P14-4 Setup FunctionsCALL 105 – Reset PRT1 to Default SettingsPurposeUse CALL 105 to reset the port parameters of po
Publication 1746-RM001A-US-PSetup Functions 14-5MODEPurposeUse the MODE command to set the port parameters of ports PRT1, PRT2, and DH485. The
Publication 1746-RM001A-US-P14-6 Setup FunctionsSyntaxMODE (port name, baud rate, arg1, arg2, arg3, arg4, arg5)Example>1 REM EXAMPLE PROGRAM
1 Publication 1746-RM001A-US-PChapter 15String FunctionsThis chapter describes and illustrates commands used to manipulate string data structures with
Publication 1746-RM001A-US-P15-2 String FunctionsExample>1 REM EXAMPLE PROGRAM>10 REM STRING REPEAT EXAMPLE PROGRAM>20 STRING 200,48&g
Publication 1746-RM001A-US-PString Functions 15-3Example>1 REM EXAMPLE PROGRAM>10 STRING 200,20>20 $(1) = “How are ”>30 $(2) = “you
Publication 1746-RM001A-US-P15-4 String FunctionsExample>1 REM EXAMPLE PROGRAM>10 STRING 100,14>20 INPUT “ENTER A NUMBER TO CONVERT TO
Publication 1746-RM001A-US-PString Functions 15-5Example>1 REM EXAMPLE PROGRAM>20 INPUT “INPUT A STRING TO CONVERT ”,$(1)>30 PUSH 1 :
Publication 1746-RM001A-US-P15-6 String FunctionsCALL 64 – Find a String in a String PurposeUse CALL 64 to find a string within a string. It lo
Publication 1746-RM001A-US-PString Functions 15-7CALL 65 – Replace a String in a String PurposeUse CALL 65 to replace a string within a string.
Publication 1746-RM001A-US-PExpressions and Operators 3-3Hierarchy of OperatorsThe hierarchy of operators is the order that the operations in a
Publication 1746-RM001A-US-P15-8 String FunctionsCALL 66 – Insert a String in a String PurposeUse CALL 66 to insert a string within another str
Publication 1746-RM001A-US-PString Functions 15-9CALL 67 – Delete a String in a String PurposeUse CALL 67 to delete a string from within anothe
Publication 1746-RM001A-US-P15-10 String FunctionsCALL 68 – Find the Length of a String PurposeUse CALL 68 to determine the length of a string.
Publication 1746-RM001A-US-PString Functions 15-11STRINGPurposeUse the STRING statement to allocate memory for strings. Initially, no memory is
Publication 1746-RM001A-US-P15-12 String FunctionsExamples>1 REM EXAMPLE PROGRAM>10 STRING 100,30>20 $(0) = “-----MONTHLY REPORT-----”
1 Publication 1746-RM001A-US-PAppendix ADecimal/Hexadecimal/Octal/ASCIIConversion TableMathematical Conversion OverviewThe table below lists the decim
Publication 1746-RM001A-US-PA-2 Decimal/Hexadecimal/Octal/ASCII Conversion Table
1 Publication 1746-RM001A-US-PAppendix BBASIC Command, Statement, and CALL Quick Reference GuideMnemonic List OverviewThe table below lists the variou
Publication 1746-RM001A-US-PB-2 BASIC Command, Statement, and CALL Quick Reference GuideCALL 24 PUSH [value to be converted]PUSH [word number o
Publication 1746-RM001A-US-PBASIC Command, Statement, and CALL Quick Reference Guide B-3CALL 40 PUSH [hours]PUSH [minutes]PUSH [seconds]Set clo
Publication 1746-RM001A-US-P3-4 Expressions and OperatorsDivide ( / )Use the Division operator to divide the first expression by the second exp
Publication 1746-RM001A-US-PB-4 BASIC Command, Statement, and CALL Quick Reference GuideCALL 64 PUSH [string number to be found]PUSH [base stri
Publication 1746-RM001A-US-PBASIC Command, Statement, and CALL Quick Reference Guide B-5CALL 90 PUSH [remote device node address]PUSH [remote d
Publication 1746-RM001A-US-PB-6 BASIC Command, Statement, and CALL Quick Reference GuideCALL 108 PUSH [operational code]PUSH [poll timeout or A
Publication 1746-RM001A-US-PBASIC Command, Statement, and CALL Quick Reference Guide B-7CALL 123 PUSH [type of PLC WRITE command]PUSH [remote P
Publication 1746-RM001A-US-PB-8 BASIC Command, Statement, and CALL Quick Reference GuideGET Read console input device. 13-38GET# Read console i
Publication 1746-RM001A-US-PBASIC Command, Statement, and CALL Quick Reference Guide B-9ONERR Go to line number when an error is detected. 8-12
Publication 1746-RM001A-US-PB-10 BASIC Command, Statement, and CALL Quick Reference GuideREM Specify a remark or comment line. 4-19REN Renumber
Publication 1746-RM001A-US-PIndexSymbols# and @quick reference guide B-10special function operator 3-15.AND.logical operator 3-6quick reference guide
Publication 1746-RM001A-US-Pii IndexCALL 112 - User LED Controloutput function 12-25quick reference guide B-6CALL 113 - Disable DF1 Driver Comm
Publication 1746-RM001A-US-PIndex iiiCALL 37 - Clear PRT2 Input/Output Buffersoutput function 12-15quick reference guide B-2CALL 38 - Expanded
Publication 1746-RM001A-US-PExpressions and Operators 3-5Overflow and Division by ZeroDuring the evaluation of an expression if an overflow, un
Publication 1746-RM001A-US-Piv IndexCALL 73 - Battery-Backed RAM Disablecommand line CALL 5-1quick reference guide B-4CALL 74 - Battery-Backed
Publication 1746-RM001A-US-PIndex vCLEARSassignment function 6-3quick reference guide B-7clock/calendar functionretrieve date numeric 10-4retri
Publication 1746-RM001A-US-Pvi IndexDisableControl-C 4-6DF1 Driver Communications 11-18DF1 Packet Interrupt 8-3Port PRT2 DTR Signal 11-11Proces
Publication 1746-RM001A-US-PIndex viiHhierarchy of operations 3-3IIDLEBASIC command 4-10quick reference guide B-8IF-THEN-ELSEcontrol function 7
Publication 1746-RM001A-US-Pviii IndexMTOPquick reference guide B-8special function operator 3-16Multiply (*)arithmetic operator 3-4quick refer
Publication 1746-RM001A-US-PIndex ixPRINT@output function 12-35quick reference guide B-9Processor Interruptdisable 8-4enable 8-3PROGBASIC comma
Publication 1746-RM001A-US-Px IndexROM/RAM to ROM Program Transfer 8-9RROMBASIC command 4-21quick reference guide B-10RS-232 network 13-2RS-422
Publication 1746-RM001A-US-PIndex xiUUnsolicited Writes 13-26Upload User Memory Module Code to Host 5-4User LED Control 12-25User Memory Module
Publication 1746-RM001A-US-Pxii Index
Publication 1746-RM001A-US-P3-6 Expressions and OperatorsLogical OperatorsThe module contains a complete set of logical operators that are divi
Publication 1746-RM001A-US-P - April 2000 13Supercedes Publication 1746-6.3 - November 1994 © 2000 Rockwell International Corporation. Printed in the
Publication 1746-RM001A-US-PExpressions and Operators 3-7Relational OperatorsRelational expressions involve the operators =, < >, >, &
i Publication 1746-RM001A-US-PTable of ContentsPrefaceWho Should Use This Manual . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . P-1Purpo
Publication 1746-RM001A-US-P3-8 Expressions and OperatorsTrigonometric OperatorsThe module contains a complete set of trigonometric operators.
Publication 1746-RM001A-US-PExpressions and Operators 3-9Comments on Trigonometric FunctionsThe SIN, COS, and TAN operators use a Taylor series
Publication 1746-RM001A-US-P3-10 Expressions and OperatorsINT([expr])Use the INT operator to return the integer portion of the expression.PIPI
Publication 1746-RM001A-US-PExpressions and Operators 3-11RNDUse the RND operator to return a pseudo-random number in the range between 0 and 1
Publication 1746-RM001A-US-P3-12 Expressions and OperatorsString OperatorsTwo operators in the module can manipulate STRINGS. These operators a
Publication 1746-RM001A-US-PExpressions and Operators 3-13When you use the ASC operator as shown above, the $([expr]) denotes what string is ac
Publication 1746-RM001A-US-P3-14 Expressions and OperatorsCHR([expr])Use the CHR operator to convert a numeric expression to an ASCII character
Publication 1746-RM001A-US-PExpressions and Operators 3-15Special Function OperatorsThe module contains a complete set of special function oper
Publication 1746-RM001A-US-P3-16 Expressions and OperatorsMTOPUse the MTOP operator to retrieve the last valid memory address in RAM that is av
Publication 1746-RM001A-US-PExpressions and Operators 3-17XBY([expr])Use the XBY operator to retrieve or assign data to or from the external da
Publication 1746-RM001A-US-PTable of Contents iiNULL. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Publication 1746-RM001A-US-P3-18 Expressions and OperatorsYou can change the fraction portion of TIME by manipulating the contents of internal
1 Publication 1746-RM001A-US-PChapter 4BASIC CommandsThis chapter describes and illustrates words and expressions that cause a function to occur withi
Publication 1746-RM001A-US-P4-2 BASIC CommandsBRKPNTPurposeUse the BRKPNT command to set a program break point at the line number specified by
Publication 1746-RM001A-US-PBASIC Commands 4-3STOP - IN LINE 160READY>PRINT D,SU,AV.86042573 0 0>D=.5>PRINT D,SU,AV.500>CONTTHE AVE
Publication 1746-RM001A-US-P4-4 BASIC CommandsExample>NEW>1 REM EXAMPLE PROGRAM>10 FOR I = 1 TO 10000>20 PRINT I>30 NEXT I>40
Publication 1746-RM001A-US-PBASIC Commands 4-5>20 PRINT I>30 NEXT I>40 END>RUN12345 [CTRL-C]pressedSTOP – IN LINE 20READY>PRINT
Publication 1746-RM001A-US-P4-6 BASIC CommandsSyntaxCALL 18Example>1 REM EXAMPLE PROGRAM>10 CALL 19.>90 CALL 18CALL 19 – Disable the C
Publication 1746-RM001A-US-PBASIC Commands 4-7Control-SPurposeUse the [CTRL-S] command to interrupt the scrolling of a BASIC program during the
Publication 1746-RM001A-US-P4-8 BASIC CommandsControl-QPurposeUse the [CTRL-Q] command to restart a LIST command or PRINT output that is interr
Publication 1746-RM001A-US-PBASIC Commands 4-9SyntaxEDITExample>EDIT 150Displays program line number 150 for editing.ERASEPurposeUse the ERA
Publication 1746-RM001A-US-PTable of Contents iiiNEXT. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Publication 1746-RM001A-US-P4-10 BASIC CommandsExample>ERASE>ROM 13 ERASEDThe last program stored in EEPROM (ROM 13 in this example) is e
Publication 1746-RM001A-US-PBASIC Commands 4-11LISTPurposeUse the LIST command to print the program to the console device. Spaces are inserted
Publication 1746-RM001A-US-P4-12 BASIC CommandsLIST@PurposeUse the LIST@ command to print the program to the device attached to port PRT1. All
Publication 1746-RM001A-US-PBASIC Commands 4-13SyntaxMODE(port name, baud rate, arg1, arg2, arg3, arg4, arg5)Table 4.3 PRT1 and PRT2 Port Param
Publication 1746-RM001A-US-P4-14 BASIC CommandsExample>1 REM EXAMPLE PROGRAM>10 MODE(DH485,19200,0,1,2,,R)...>25 MODE(PRT1,1200,N,8,,,
Publication 1746-RM001A-US-PBASIC Commands 4-15PROGPurposeUse the PROG command to program the resident EEPROM with the current program in RAM.
Publication 1746-RM001A-US-P4-16 BASIC CommandsPROG1PurposeUse the PROG1 command to program the resident EEPROM with port information for all t
Publication 1746-RM001A-US-PBASIC Commands 4-17PROG2PurposeUse the PROG2 command the same as you would the PROG1 command except for the followi
Publication 1746-RM001A-US-P4-18 BASIC CommandsFigure 4.1 Operation of PROG1 or PROG2Isbattery backupenabled?HasPROG1 or PROG2been executed?Isb
Publication 1746-RM001A-US-PBASIC Commands 4-19RAMPurposeUse the RAM command to tell the module interpreter to select the current program out o
Publication 1746-RM001A-US-PTable of Contents ivChapter 11Status FunctionsCALL 36 – Get Number of Characters in PRT2 Buffers . . . . . . . . .
Publication 1746-RM001A-US-P4-20 BASIC CommandsSyntaxREMExample>10 REM THIS IS A COMMENT LINE>20 NEW : REM THIS IS ALSO A COMMENT LINEREN
Publication 1746-RM001A-US-PBASIC Commands 4-21When you enter ROM [integer], the module selects that program out of EEPROM memory and makes it
Publication 1746-RM001A-US-P4-22 BASIC CommandsWhen you enter RROM [integer], the module selects that program out of EEPROM memory, makes it th
Publication 1746-RM001A-US-PBASIC Commands 4-23VariationsSome BASIC interpreters allow a line number to follow the RUN command (example: RUN 10
Publication 1746-RM001A-US-P4-24 BASIC CommandsExample>1 REM EXAMPLE PROGRAM>10FORI=1TO5>20 PRINT I>30 NEXT I>40 PRINT “PASSED F
Publication 1746-RM001A-US-PBASIC Commands 4-25READY>VERPurposeUse the VER command to print the module sign-on message that displays the cur
Publication 1746-RM001A-US-P4-26 BASIC CommandsXFERPurposeUse the XFER command to transfer the current selected program in ROM to RAM and selec
1 Publication 1746-RM001A-US-PChapter 5Command Line CALLsThis chapter describes and illustrates CALLs that cause a function to occur within the BASIC
Publication 1746-RM001A-US-P5-2 Command Line CALLsCALL 74 – Battery-Backed RAM EnablePurposeUse CALL 74 to enable the battery-backed RAM. When
Publication 1746-RM001A-US-PCommand Line CALLs 5-3Example: (For saving 2 variables)>PRINT MTOP24575>PRINT MTOP-1224563>PUSH 24563:REM
Publication 1746-RM001A-US-PTable of Contents vChapter 13Input FunctionsCALL 22 – Transfer Data from Port 1 or 2 to the CPU Files . . . . . .
Publication 1746-RM001A-US-P5-4 Command Line CALLsExample>CALL 81Number of BASIC programs in (E)EPROM... 3Available bytes to end of u
Publication 1746-RM001A-US-PCommand Line CALLs 5-5SyntaxPUSH [starting address]PUSH [ending address]CALL 101Example>PUSH 8000 : PUSH 804FH :
Publication 1746-RM001A-US-P5-6 Command Line CALLsExample>CALL 103PRT1 Output Queue6D00H 3AH 31H 30H 38H 30H 34H 30H 30H 30H 39H 37H 34H 39H
Publication 1746-RM001A-US-PCommand Line CALLs 5-7Example>CALL 104PRT1 Input Queue6C00H 33H 0DH 43H 41H 4CH 4CH 20H 31H 30H 34H 7FH 7FH 7FH
Publication 1746-RM001A-US-P5-8 Command Line CALLsCALL 110 – Print PRT2 Output Buffer PointerPurposeUse CALL 110 to print the complete output b
Publication 1746-RM001A-US-PCommand Line CALLs 5-9Example>CALL 111PRT2 Input Queue6E00H 00H 00H 00H 00H 00H 00H 00H 00H 00H 00H 00H 00H 00H
Publication 1746-RM001A-US-P5-10 Command Line CALLs
1 Publication 1746-RM001A-US-PChapter 6Assignment FunctionsThis chapter describes and illustrates commands that assign storage, reset data storage, an
Publication 1746-RM001A-US-P6-2 Assignment FunctionsExample>CLEAR>LIST1 REM EXAMPLE PROGRAM10 DIM A(4)20 DATA 10,20,30,4030 FOR I=0 TO 34
Publication 1746-RM001A-US-PAssignment Functions 6-3CLEARIPurposeUse the CLEARI statement to clear all of the BASIC evoked interrupts. The ONTI
Publication 1746-RM001A-US-PTable of Contents viAppendix ADecimal/Hexadecimal/Octal/ASCIIConversion TableMathematical Conversion Overview . . .
Publication 1746-RM001A-US-P6-4 Assignment FunctionsDATAPurposeUse the DATA statement to specify the expressions that you can retrieve with a R
Publication 1746-RM001A-US-PAssignment Functions 6-5Once a variable is dimensioned in a program it may not be re-dimensioned. An attempt to re-
Publication 1746-RM001A-US-P6-6 Assignment FunctionsExamples>1 REM EXAMPLE PROGRAM>10 LET A = 10*SIN(C)/100>1 REM EXAMPLE PROGRAM>1
Publication 1746-RM001A-US-PAssignment Functions 6-7RESTOREPurposeUse the RESTORE statement to reset the internal read pointer to the beginning
Publication 1746-RM001A-US-P6-8 Assignment Functions
1 Publication 1746-RM001A-US-PChapter 7Control FunctionsThis chapter describes and illustrates commands executed within the BASIC program or from the
Publication 1746-RM001A-US-P7-2 Control FunctionsExample>NEW>1 REM EXAMPLE PROGRAM>10 TIME = 0>15 DBY(71) = 0>20 CLOCK1>30 ON
Publication 1746-RM001A-US-PControl Functions 7-3DO-WHILEPurposeUse the DO-WHILE statement to set up loop control within a module program. The
Publication 1746-RM001A-US-P7-4 Control Functions>1 REM EXAMPLE PROGRAM>10 A=0 : C=0>20 DO>30 A=A+1>40 DO>45 C=C+1>50 PRIN
Publication 1746-RM001A-US-PControl Functions 7-5ExamplesSimple DO-UNTIL Nested DO-UNTIL>1 REM EXAMPLE PROGRAM >1 REM EXAMPLE PROGRAM>
P-1 Publication 1746-RM001A-US-P PrefaceRead this preface to familiarize yourself with the rest of the manual. This preface covers the following topic
Publication 1746-RM001A-US-P7-6 Control FunctionsFOR-TO-(STEP)-NEXTPurposeUse the FOR- TO-(STEP)-NEXT statement to set up and control program l
Publication 1746-RM001A-US-PControl Functions 7-7In the first example, since E-0, C-10, D-2, and the PRINT statement at line 20 executes 6 time
Publication 1746-RM001A-US-P7-8 Control FunctionsIf line 100 exists, this statement causes execution of the program to resume at line 100. If l
Publication 1746-RM001A-US-PControl Functions 7-9Example 2You may execute multiple statements following the THEN or ELSE if you use a colon to
Publication 1746-RM001A-US-P7-10 Control FunctionsExample>1 REM EXAMPLE PROGRAM>5 E=0 : C=10 : D=2>10 FOR A=E TO C STEP D>20 PRINT
Publication 1746-RM001A-US-PControl Functions 7-11ON-GOTOPurposeUse the ON-GOTO statement to transfer control to the line(s) specified by the G
Publication 1746-RM001A-US-P7-12 Control Functions
1 Publication 1746-RM001A-US-PChapter 8Execution Control and Interrupt Support FunctionsThis chapter describes and illustrates commands that control d
Publication 1746-RM001A-US-P8-2 Execution Control and Interrupt Support FunctionsCALL 16 – Enable DF1 Packet InterruptPurposeUse CALL 16 to ena
Publication 1746-RM001A-US-PExecution Control and Interrupt Support Functions 8-3CALL 17 – Disable DF1 Packet InterruptPurposeUse CALL 17 to di
Comments to this Manuals