Home

1746-RM001A-US-P, BASIC Language Reference Manual

image

Contents

1. Column Calum Colm Column 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 i 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 amp 70 46 106 F 102 66 146 f 07 07 007 BEL 39 27 047 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 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 153 k 12 0C 014 FF 44 2C 054 76 4C 114 L 108 6C 154 13 OD 015 CR 45 2D 055 71 4D 115 M 109 6D 155 m 14 OE 016 SO 46 2E 056 78 4E 116 N 110 6E 156 n 15 OF 017 SI 47 2F 057 79 4F 117 0 111 6F 157 0 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 71 167 Ww 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
2. If you need to Use this mnemonic Page Battery backedRAMdisable CALL73 o Ta Battery backed RAM enable CALL 74 5 2 Protected variable storage CALL 77 5 2 User memory module check and description CALL 81 5 3 Check the user memory module map CALL 82 5 4 Upload the user memory module code to host CALL 101 5 4 Print port PRT1 output buffer and pointer CALL 103 5 5 Print port PRT1 input buffer and pointer CALL 104 5 6 Print the argument stack CALL 109 5 7 Print port PRT2 output buffer and pointer CALL 110 5 8 Print port PRT2 input buffer and pointer CALL 111 5 8 Purpose Use CALL 73 to disable the battery backed RAM When this CALL is executed the message Battery Backup Disabled is printed on the host terminal Disabling battery backed RAM allows a purging reset When power to the module is turned OFF the contents of RAM are destroyed When power is reapplied RAM is cleared and battery back up is re enabled Syntax CALL 73 Example gt CALL 73 Battery Backup Disabled gt REM TURNING POWER OFF THEN BACK ON Publication 1746 RIM001A US P 5 2 Command Line CALLs CALL 74 Battery Backed RAM Enable CALL 77 Protected Variable Storage Publication 1746 RM001A US P Purpose Use CALL 74 to enable the battery backed RAM When this CALL is executed the message Battery Backup Enabled is printed on the host terminal Battery backed RAM is enabled on module powerup and remains enabled until you execut
3. Purpose Use CALL 60 to repeat a character and place it in a string You can use the String Repeat when designing output formats First PUSH the number of times to repeat the character then PUSH the number of the string containing the repeated character No arguments are POPped You cannot repeat more characters than the strings maximum length Syntax PUSH number of times to repeat character PUSH base string number CALL 60 Publication 1746 RIM001A US P 15 2 String Functions CALL 61 String Append Publication 1746 RM001A US P Example gt 1 REM EXAMPLE PROGRAM gt 10 REM STRING REPEAT EXAMPLE PROGRAM gt 20 STRING 200 48 gt 30 1 gt 40 PUSH 40 REM THE NUMBER OF TIMES TO REPEAT CHARACTER gt 50 PUSH 1 REM BASE STRING NUMBER gt 60 CALL 60 gt 70 PRINT 1 gt 80 END READY gt RUN KRRKEKKKKEKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKK READY gt Purpose Use CALL 61 to append one string to the end of another string This CALL expects two string arguments The first is the string number of the string to be appended and the second is the string number of the base string If the resulting string is longer than the maximum string length the append characters are lost There are no output arguments This is a string concatenation assignment example 1 1 2 Tae tal the new string length exceeds the length allocated by the string command an error message is printed on th
4. Purpose Use CALL 44 to return the current date on the argument stack as three numbers There is no input argument to this routine and three variables are returned The date is POPped in day month and year order Syntax CALL 44 POP day POP month POP year Clock Calendar Functions 10 5 CALL 45 Retrieve Time String Example gt 1 REM EXAMPLE PROGRAM gt 10 REM DATE RETRIEVE NUMERIC EXAMPLE gt 20 CALL 44 REM INVOKE THE UTILITY ROUTINE gt 30 POP D M Y REM GET THE DATA FROM THE ARGUMENT STACK gt 40 PRINT CURRENT DATE IS Y M D gt 50 END READY gt RUN CURRENT DATE IS 91 6 19 READY Purpose Use CALL 45 to return the current time in a string HH MM SS PUSH the number of the string to receive the time You must allocate a minimum of 8 characters for the string Syntax PUSH string number CALL 45 Example gt 1 REM EXAMPLE PROGRAM gt 10 STRING 100 20 gt 20 PUSH 1 CALL 45 REM PUT TIME IN STRING 1 gt 30 PRINT 1 gt 40 END READY gt RUN 06 40 49 READY gt Publication 1746 RIM001A US P 10 6 Clock Calendar Functions CALL 46 Retrieve Time Numeric CALL 47 Retrieve Day of Week String Publication 1746 RM001A US P Purpose Use CALL 46 to return the time of day in numeric form Retrieve the time of day in numeric form by executing CALL 46 and POPping the three variables off of the argument stack on return There are no input arguments Th
5. CONT Publication 1746 RM001A US P 4 4 BASIC Commands Example gt NEW gt 1 REM EXAMPLE PROGRAM gt 10 FOR I 1 TO 10000 gt 20 PRINT I gt 30 NEXT I gt 40 END oOMAAtA UBPWNHEeE 10 CTRL C pressed STOP IN LINE 15 READY gt CONT 20 21 22 Control C Purpose Use the CTRL C command to stop execution of the current program and return the module to the Command mode In some cases you can continue execution of the program using a CONTinue See the explanation for CONTinue for more information IMPORTANT CCZRE C clears all input and output buffers Syntax CTRL C Example gt 1 REM EXAMPLE PROGRAM gt 10 FOR I 1 TO 10000 Publication 1746 RM001A US P CALL 18 Re enable the Control C Break Function BASIC Commands 4 5 gt 20 PRINT I gt 30 NEXT I gt 40 END gt RUN uo WN EF CTRL C pressed STOP IN LINE 20 READY gt PRINT I 27 gt I 10 gt CONT 10 11 12 Notice that after CTRL C is pressed and I is printed the value of I is 27 The value of I is incremented several times before CTRL C is detected Purpose Re enable the cTRL c break function by executing CALL 18 in a module program or from the Command mode IMPORTANT When CTRL C is disabled you are unable to stop program execution through a BASIC command Cycling power re enables CTRL C checking until the program once again disables cTRL c To stop program execution you must cy
6. If ADER is selected enabled responses are not transmitted until an embedded response is received It is assumed that if the device being communicated with can send an ER it can also receive them only applies to full duplex operation e modem handshaking selection half duplex options e No HandShaking NHS e Half Duplex Modem without Continuous Carrier HDMwoCC e Half Duplex Modem with Continuous Carrier HDMwCC full duplex options e No HandShaking NHS e Full Duplex Modem FDM Legal values for the operational code are 0 to 11 for half duplex mode and 16 to 31 for full duplex mode Table 11 B lists the legal values for the half duplex operational codes and their corresponding mode of operation Table 11 C lists the legal values for the full duplex operational codes and their corresponding mode of operation A special range of operational codes 32 43 are also accepted These codes are identical to codes 0 11 except that the end of transmission EOT packets are suppressed This operation is a deviation from the standard DF1 protocol and should only be used where transmissions from a slave module are minimized When using one of these selections the DF1 driver does not respond to ENQuires from a DF1 master unless there is a data packet transmitted Status Functions 11 13 TT he Ocber port parameters such as baud rate number of stop bits Table 11 2 DF1 and parity are selected using the MODE command before DF
7. PUSH year CALL 41 Publication 1746 RM001A US P CALL 42 Set Day of Week Clock Calendar Functions 10 3 Example Program the clock calendar for the 16th day of June 1991 gt 1 REM EXAMPLE PROGRAM gt 5 STRING 100 20 gt 10 H 13 M 35 S 00 gt 20 REM HOURS 13 MINUTES 35 SECONDS 00 gt 30 PUSH H M S gt 40 CALL 40 gt 60 D 16 MO 6 Y 91 gt 70 PUSH D MO Y gt 80 CALL 41 gt 90 PUSH 3 gt 100 CALL 42 gt 120 PUSH 0 gt 130 CALL 43 gt 140 PRINT 0 READY gt RUN 16 JUN 91 13 35 00 Purpose Use CALL 42 to set the day of the week Sunday is day 1 Saturday is day 7 Syntax PUSH day of week CALL 42 Example gt 1 REM EXAMPLE PROGRAM gt 10 PUSH 3 CALL 42 REM DAY IS TUESDAY Publication 1746 RIM001A US P 10 4 Clock Calendar Functions CALL 43 Retrieve Date Purpose Time String CALL 44 Retrieve Date Numeric Publication 1746 RM001A US P Use CALL 43 to return the current date and time as a string PUSH the number of the string to receive the date time dd mmm yy HH MM SS You must allocate a minimum of 18 characters for the string This requires you to set the maximum length for all strings to at least 18 characters Syntax PUSH string number CALL 43 Example gt 1 REM EXAMPLE PROGRAM gt 10 STRING 100 20 gt 20 PUSH 1 CALL 43 REM PUT DATE TIME IN STRING 1 gt 30 PRINT 1 gt 40 END READY gt RUN 16 JUN 91 13 35 00 READY gt
8. Allen Bradley BASIC Language Catalog Numbers 1746 BAS and 1746 BAS T Reference Manual l b F ik I E Automation HERT 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
9. CALL 91 Write BASIC Output Buffer to Remote DH485 Data File Publication 1746 RM001A US P Example gt 1 REM EXAMPLE PROGRAM gt 40 PUSH 31 REM OFFSET ADDRESS 31 gt 50 PUSH 3 REM WORD LENGTH 3 gt 60 CALL 85 REM TRANSFER DATA TO DH485 COMMON INTERFACE FILE gt 70 POP R gt 80 IF R lt gt 0 PRINT TRANSFER ERROR CODE R REM PRINT ERROR READY gt RUN READY gt Purpose Use CALL 91 to write up to 40 words starting at word 0 of the module output buffer to the remote DH485 data file at the designated node address file number file type and element offset This routine has six input arguments and one output argument The first input argument is the node address of the remote device 0 to 31 If the number is not within the range 0 to 31 then the output argument equals 10 and the write message does not take place The second input argument is the file number on the remote device 0 to 255 If the number is not within the range 0 to 255 then the output argument equals 11 and the write message does not take place The third input argument is the file type written to the remote device Valid type codes are ASC N ASC S ASC C ASC T ASC B and ASC R If the file type is not one of these valid types then the output argument equals 241 and the write message does not take place Table 12 4 FileType Written to the Remote Device File Type File Type Code Words Element Inte
10. Publication 1746 RM001A US P Table 12 11 Transaction Status Codes Code Indicates 0 Transfer OK 1 Transmission failed 2 Enquiry timeout 3 With handshaking selected either a loss of CTS signal while transmitting or a fatal transmitter failure occurred Without handshaking selected a fatal transmitter failure occurred 4 Transmission failure due to modem disconnection DCD signal loss for more than 10 seconds if modem handshaking with constant carrier is selected 5 DF1 driver is not enabled 6 Message timed out 81 Illegal command or format 82 Host has a problem and will not communicate 83 Remote station host is not there disconnected or shut down 84 Host could not complete function due to hardware fault 85 Addressing problem or memory protect rungs 86 Function disallowed due to command protection selection 87 Processor is in Program mode 88 Compatibility mode file missing or communication zone problem 89 Remote station cannot buffer command 8B Remote station problem due to download 8C Local station cannot execute command due to active IPBs C1 Illegal address format field has an illegal value C2 Illegal address format not enough fields specified C3 Illegal address format too many fields specified C4 Illegal address format symbol not found C5 Illegal address format symbol
11. READY gt RUN FOUND AT LOCATION 4 READY gt String Functions 15 7 CALL 65 Replace a String in a String Purpose Use CALL 65 to replace a string within a string Three arguments are expected The first argument is the number of the string that replaces the string identified by the second argument string number The third argument is the base string number There are no output arguments TTT lE the new string length exceeds the length allocated by the string command an error message is printed on the console device and the module enters Command mode Syntax PUSH new string number PUSH old string number to be replaced PUSH base string number CALL 65 Example gt 1 REM EXAMPLE PROGRAM gt 10 REM SAMPLE OF REPLACE STRING IN STRING gt 20 STRING 100 20 gt 30 0 RED LINES gt 40 1 RED gt 50 2 BLUE gt 60 PRINT BEFORE gt 70 PRINT 0 0 gt 80 PUSH 2 REM STRING NUMBER OF THE STRING TO BE REPLACED WITH gt 90 PUSH 1 REM STRING NUMBER OF THE STRING TO BE REPLACED gt 100 PUSH O REM BASE STRING NUMBER gt 110 CALL 65 REM INVOKE REPLACE STRING IN STRING gt 120 PRINT AFTER gt 130 PRINT 0 0 gt 140 END READY gt RUN BEFORE 0 RED LINES AFTER 0 BLUE LINES READY v Publication 1746 RM001A US P 15 8 String Functions CALL 66 Insert a String in a String Publication 1746 RM001A
12. gt 1 REM EXAMPLE PROGRAM gt 10 MODE DH485 19200 0 1 2 R gt 25 MODE PRT1 1200 N 8 METAI be E storage type option cannot be used if MODE is used as a statement Purpose Use the NEW command to delete the program currently stored in RAM In addition all variables are set equal to ZERO all strings and all BASIC evoked interrupts are cleared The free running clock string allocation and internal stack pointer values are not affected The NEW command is used to erase a program and all variables in RAM Syntax NEW Example gt NEW gt LIST gt READY gt Purpose Use the NULL command to determine how many NULL characters 00H the module outputs after a carriage return in a print statement After initialization this value is set to 0 Most printers contain a RAM buffer that eliminates the need to output NULL characters after a carriage return Syntax NULLfinteger PROG BASIC Commands 4 15 Tata Before you attempt to program EEPROM read the PROG PROGI and PROG2 sections of this chapter Purpose Use the PROG command to program the resident EEPROM with the current program in RAM The module cannot program UVPROMs IMPORTANT Be sure you have selected the program you want to save before using the PROG command Your module does not automatically copy the RAM program to EEPROM If an error occurs during EEPROM programming the message ERROR Programming sequence failure is displayed After you
13. must still be PUSHed The seventh input argument is the byte swap selection It has the following values e 0 Data bytes transferred from the BASIC port are not swapped when passed to the destination The data packing order is low byte first then high byte per word The low byte of the first word in the destination file contains the byte count e 1 Data bytes transferred from the BASIC port are swapped when passed to the destination The data packing order is high byte first then low byte per word Swapping does not affect the first word The low byte of the first word still contains the byte count Publication 1746 RIM001A US P 13 6 Input Functions Publication 1746 RM001A US P The last CALL 22 or CALL 23 executed determines the byte swap option for all active CALL 22 commands previously executed The output argument is the status of the CALL It has the following values e 0 Successful setup e 1 Disabled e 2 Bad input parameter e 3 PRT2 is chosen but it is already enabled for DF1 protocol Transfer is not executed e 4 String too small e 5 String is not dimensioned If data is being received into the serial port faster than the SLC processor is retrieving data the input buffer of the port fills up If you use handshaking between the port and the external device no data is lost Syntax PUSH source port number PUSH maximum number of characters to be transferred PUSH decimal value of character delimi
14. 7 5 EOF Test for empty input buffer 3 15 ERASE Delete the last BASIC program stored in ROM 4 9 by a PROG command EXP e 2 7182818 TO THE X 3 11 FOR TO STEP Set up for next loop 7 6 NEXT FREE Test for number of free bytes of RAM memory 3 15 Publication 1746 RIM001A US P B 8 BASIC Command Statement and CALL Quick Reference Guide Mnemonic Required PUSHes or POPs Description Active In Page Command Mode Only GET Read console input device 13 38 GET Read console input device connected to PRT2 13 38 GET Read console input device connected to PRT1 13 38 GOSUB Execute subroutine 8 11 GOTO Go to program line number 7 7 IDLE Force module to enter wait until interrupt 4 10 mode IF THEN ELSE Conditional test 7 8 INPL Read line of characters from the program port 13 39 buffer INPL Read line of characters from port PRT2 buffer 13 39 INPL Read line of characters from port PRT1 buffer 13 39 INPS Read string of characters from the program port 13 40 buffer INPS Read string of characters from port PRT2 buffer 13 39 INPS Read string of characters from port PRT1 buffer 13 39 INPUT Input a string or variable 13 40 INPUT Input a string or variable from port PRT2 13 40 INPUT Input a string or variable from port PRT1 13 40 INT Integer 3 10 LD Load variable 13 43 LEN Read the number of bytes of memory in the 3
15. Syntax PUSH remote device node address PUSH remote device file number PUSH remote device file type PUSH starting element offset x2 of remote device file PUSH number of elements to be transferred PUSH message time out value CALL 90 POP status of message instruction Example gt 1 REM EXAMPLE PROGRAM gt 10 PUSH 1 REM REMOTE NODE ADDRESS 1 gt 20 PUSH 5 REM REMOTE FILE 5 gt 30 PUSH ASC C REM FILE TYPE COUNTER gt 40 PUSH 0 REM OFFSET 0 gt 50 PUSH 10 REM ELEMENT LENGTH 10 30 WORDS gt 60 PUSH 5 REM TIMEOUT 0 5 SECONDS gt 70 CALL 90 gt 80 POP R REM GET THE OUTPUT ARGUMENT gt 90 IF R lt gt 0 THEN PRINT READ ERROR CODE R READY gt RUN READ ERROR CODE 5 Publication 1746 RM001A US P CALL 92 Read Remote DH485 Common Interface File to BASIC Input Buffer Input Functions 13 23 Purpose Use CALL 92 to read up to 40 words from the remote DH485 Common Interface File of the designated node address starting at the designated word offset to the module input buffer starting at word 0 This routine has four input arguments and one output argument The first input argument is the node address of the remote device 0 to 31 If the number is not within the range 0 to 31 then the output argument equals 10 and the read message does not take place The second input argument is the starting word offset within the file on the remote device 0 to 32767 If the
16. The RUN command and the GOTO statement are the only ways you can place the module interpreter into Run mode from Command mode Terminate program execution at any time by pressing CTRL C on the console device Syntax RUN SNGLSTP BASIC Commands 4 23 Variations Some BASIC interpreters allow a line number to follow the RUN command example RUN 100 The module does not permit this variation on the RUN command Execution begins with the first line number To obtain a function similar to the RUN ln num command use the GOTO In num statement in the Direct mode See statement GOTO in chapter 7 Example gt 1 REM EXAMPLE PROGRAM gt 10 FOR I 1 TO 3 gt 20 PRINT I gt 30 NEXT I gt 40 END gt RUN 1 2 3 READY Purpose Use the SNGLSTP command to initiate single step program execution If the number specified by this command is zero single step execution is disabled If the number is not zero a break point is set before each line in the program Start the program by typing the RUN command After each stop type CONT to execute the next line You can inspect variables or assign variables at each break point SNGLSTP works only on programs executing from RAM It does not stop a program executing from EEPROM Syntax SNGLSTP integer Publication 1746 RM001A US P 4 24 BASIC Commands Publication 1746 RM001A US P Example gt 1 gt 10 gt 20 gt 30 gt 40 gt 50 gt 60 REM EXAMPLE PROGRAM
17. Use the ASC operator to change a value in a string or use the string support CALL routine replace string in a string Taira Use the CHR function only in a print statement You cannot use the CHR operator in a DATA statement Special Function Operators Expressions and Operators 3 15 The module contains a complete set of special function operators These operators manipulate the I O hardware and memory addresses of the module and Use the and operators to direct communications Communication takes place through port PRT1 when the operator is programmed and through port PRT2 when the operator is programmed The absence of either the or operators indicates that communication should take place through a program port port PRT1 or port DH485 Example Result gt 10 A GET The next character in the PRT2 input buffer is assigned to variable A gt 10 A GET The next character in the PRT1 input buffer is assigned to variable A EOF Use the EOF operator to test for an empty input buffer before executing an input statement or function This prevents input statements from waiting indefinitely on empty input buffers Use the EOF statement to test for an empty input buffer for port PRT2 Use the EOF statement to test for an empty input buffer for port PRT1 gt 10 REM EXAMPLE PROGRAM gt 20 IF NOT EOF THEN A GET gt 30 REM IF BUFFER NOT EMPTY READ SINGLE CHARACTER FREE Use the system cont
18. and READ functions 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 functions Appendix A Decimal Hexidecimal Octal Lists the Decimal Hexidecimal Octal ASCIl equivalents ASCII Conversion Table Appendix B BASIC Command Statement and Lists the various commands statements and CALLs needed for BASIC CALL Quick Reference Guide programming Publication 1746 RM001A US P Related Documentation P 3 The following documents contain additional information regarding Rockwell Automation products To obtain a copy contact your local Rockwell Automation office or distributor For A BASIC and BASIC T manual that provides information on installing and using the 1746 BAS and 1746 BAS T modules Read this document SLC 500 BASIC and BASIC T Modules User Manual Publication Number 1746 UM004A US P A programming manual with detailed instructions on installing and using BASIC Development Software to program the BASIC and BASIC T modules BASIC Development Software Programming Manual 1746 PM001A US P An overview of the SLC 500 family of products SLC 500 System Overview 1747 S0001A US P A description of how to install and use a Modular Modular Hardware Style Installation and 1747 6 2 SLC 500 Processor Operation Manual A reference manual
19. gt 1 REM EXAMPLE PROGRAM gt 10 PUSH 3 REM CLEAR SLC MO AND M1 FILES gt 20 CALL 120 gt 30 END Purpose Use CALL 121 to get the ID number of the active SLC processor program This routine has no input arguments and one output argument The output argument is an integer value between 0 and 65536 that corresponds to the program ID number of the active program on the SLC processor Publication 1746 RIM001A US P 11 20 Status Functions Publication 1746 RM001A US P Syntax CALL 121 POP program ID number Example gt 1 REM EXAMPLE PROGRAM gt 10 CALL 121 gt 20 POP X REM GET SLC PROCESSOR PROGRAM ID gt 30 END Output Functions Chapter 12 This chapter describes and illustrates commands that allow the transfer of data from the BASIC or BASIC T module to external ports PRT1 PRT2 and DH485 within the BASIC program or from the command line Table 12 1 lists the corresponding mnemonics Table 12 1 Chapter Reference Guide If you need to Use this Page mnemonic Transfer data from the SLC 1 0 or M files to PRT1 or PRT2 CALL 23 12 2 ee data from the SLC processor to a remote DH485 data CALL 28 12 6 ile Handle all errors that are not handled by the ONERR statement CALL 29 12 13 Display the current PRT2 port setup CALL 31 12 14 Clear port PRT2 input and output buffers CALL 37 12 15 Transfer module output buffer
20. gt 10 gt 20 gt 30 REM EXAMPLE PROGRAM PRINT NOW EXECUTING ROM 3 CALL 72 END With ROM 1 selected gt RUN NOW EXECUTING ROM 1 NOW EXECUTING ROM 3 EXECUTING ROM 1 AGAIN READY gt GOSUB Purpose Execution Control and Interrupt Support Functions 8 11 Use the GOSUB statement to cause the module to transfer control of the program to the line number In num following the GOSUB statement In addition the GOSUB statement saves the location of the statement following GOSUB on the control stack so that you can perform a RETURN statement to return control to the statement following the most recently executed GOSUB statement You may nest the GOSUB statement up to 9 times The control stack C stack stores all information associated with loop control example DO WHILE DO UNTIL FOR NEXT and BASIC subroutines The control stack is 157 bytes long DO WHILE and DO UNTIL loops and GOSUB commands use 3 bytes of the control stack FOR NEXT loops use 17 bytes Teta Excessive nesting exceeds the limits of the control stack generating an error and causing the module to enter Command mode Syntax GOSUB In num Examples Simple Subroutine READY gt 1 REM EXAMPLE PROGRAM gt 10 FOR I 1 TO 5 gt 20 GOSUB 100 gt 30 NEXT I gt 40 END gt 100 PRINT I gt 110 RETURN READY gt RUN ok WDNR READY gt NEW Nested Subroutine gt 1 REM EXAMPLE PROGRAM gt 10 FOR I 1 TO 3 Publicatio
21. gt 110 PUSH 0 REM TURN OFF LED2 gt 120 CALL 112 REM SET THE LEDS READY gt RUN Purpose Use CALL 114 to transmit the DF1 data packet This routine has no input arguments and no output arguments When CALL 114 is performed the DF1 data is posted for the DF1 driver to transmit as a single message packet If half duplex slave operation is selected the message packet is transmitted the next time an ENQuiry is received from the DF1 master If full duplex operation is selected the message packet is transmitted immediately Use one or more PRINT PHO or PH1 statements to construct the desired data in the transmit buffer of port PRT2 After constructing the data in the transmit buffer use CALL 114 to initiate transmission of the data inside a DF1 message packet Caution must be exercised when building DF1 data packets Ifan attempt is made to transmit five or less bytes of data minimum is six bytes the message ERROR DF1 DATA PACKET TO TRANSMIT IS TOO SMALLis sent to the program port and the module enters Command mode If an attempt is made to place more than 256 bytes of data into the transmit buffer the message ERROR BUFFER OVERFLOW is sent to the program port and the module enters Command mode The user s program must wait for one transmission to complete before construction of another data packet may be performed Use CALL 115 to check the DF1 transmission status to determine when a transmission is complete Synta
22. 1 is enabled The modem handshaking selection made here overrides the handshaking parameter of the MODE command until DF1 is disabled Half Duplex Operational Codes Operational Corresponding Mode of Operation Special Operational Code Code Same as 0 11 except EOT is suppressed 0 NHS Disable DPD BCC Error Checking 32 1 NHS Enable DPD BCC Error Checking 33 2 NHS Disable DPD CRC Error Checking 34 3 NHS Enable DPD CRC Error Checking 35 4 HDMwo CC Disable DPD BCC Error Checking 36 5 HDMwo CC Enable DPD BCC Error Checking 37 6 HDMwoCC Disable DPD CRC Error Checking 38 7 HDMwoCC Enable DPD CRC Error Checking 39 8 HDMwCC Disable DPD BCC Error Checking 40 9 HDMwCC Enable DPD BCC Error Checking 41 10 HDMwCC Disable DPD CRC Error Checking 42 11 HDMwCC Enable DPD CRC Error Checking 43 Table 11 3 DF1 Operational Code Full Duplex Operational Codes Corresponding Mode of Operation 16 NHS ER Disable DPD BCC Error Checking 17 NHS ER Enable DPD BCC Error Checking 18 NHS ER Disable DPD CRC Error Checking 19 NHS ER Enable DPD CRC Error Checking 20 NHS ADER Disable DPD BCC Error Checking 21 NHS ADER Enable DPD BCC Error Checking 22 NHS ADER Disable DPD CRC Error Checking 23 NHS ADER Enable DPD CRC Error Checking 24 FDM ER Disable DPD BCC Error Checking 25 FDM ER Enable DPD BCC Error Che
23. 15 current selected program LET Assign a variable or string a value LET is 6 5 optional LIST List program to the console devise 4 11 LIST List program to serial printer s 4 12 LIST List program to device connected to port PRT1 4 12 LOGI Natural log 3 11 MODE Set port parameters of ports PRT1 PRT2 and 4 12 DH485 14 5 MTOP Read the last valid memory address 3 16 NEW Erase the program stored in RAM 4 14 NEXT Test for next loop condition 7 9 NOT One s complement 3 9 NULL Set NULL count after carriage return line feed i 4 14 Publication 1746 RM001A US P BASIC Command Statement and CALL Quick Reference Guide B 9 Mnemonic Required PUSHes or POPs Description Active In Page Command Mode Only ONERR Go to line number when an error is detected 8 12 ON GOSUB Conditional GOSUB 8 14 ON GOTO Conditional GOTO 7 11 ONTIME Generate an interrupt when TIME is equal to or 8 14 greater than ONTIME argument line number PHO Print hex value with zero suppression to 12 37 console device PHO Print hex value with zero suppression to PRT2 12 37 PH0 Print hex value with zero suppression to PRT1 12 37 PH1 Print hex value with no zero suppression to 12 37 console device PH1 Print hex value with no zero suppression to 12 37 PRT2 PH1 Print hex value with no zero suppression to 12 37 PRT1 PI PI 3 1415926 3 1
24. 20 Renumbers the program from line 900 on up Line number 900 becomes line number 1000 Any following line numbers increment by 20 Purpose Use the ROM command to tell the module interpreter to select the current program out of EEPROM or UVPROM The current program is displayed during a LIST command and executed when Run is typed Tantei Pour module can execute and store up to 255 programs in EEPROM depending on the size of the programs and the capacity of the EEPROM The programs are stored in a sequence string referred to as the EEPROM file in EEPROM for retrieval and execution RROM BASIC Commands 4 21 When you enter ROM integer the module selects that program out of EEPROM memory and makes it the current program If no integer is typed after the ROM command example Rom the module defaults to ROM 1 Since the programs are stored in sequence in EEPROM the integer following the ROM command selects the program the user wants to run or list If you attempt to select a program that does not exist example you type ROM 8 and only 6 programs are stored in the EEPROM the message ERROR PROM MODE is displayed The module does not transfer the program from EEPROM to RAM when the ROM mode is selected If you attempt to alter a program in the ROM mode by typing in a line number the message ERROR PROM MODE is displayed The XFER command allows you to transfer a program from EEPROM to RAM for editing purposes You do not
25. 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 SOR 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 XBY 3 17 the module Addition 3 3 Division 3 4 Exponentiation 5 3 4 Multiplication i 3 4 Subtraction 3 4 Logical AND AND 3 6 Logical OR OR 3 6 Publication 1746 RIM001A US P 3 2 Expressions and Operators Expressions and Operators Publication 1746 RM001A US P Table 3 1 Chapter Reference Guide Ifyou need t Usethismnemonic Page Logical Exclusive OR XOR 3 6 Direct communications to port PRT1 3 15 Direct communications to port PRT2 3 15 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 e arithmetic e logical e relational trigonometric e functional e logarithmic e string e special function Expressions Expressions are simple or complex Simple expression 12 EXP A 100 H 1 55 Complex expression SIN A SIN A COS A COS A 2 A stand alone variable var or constant const is also considered an expression Expressions are shown as expr Operators An operator performs a defined operation on variables or constant
26. 7 string operator 3 12 ATN quick reference guide B 71 trigonometric operator 3 8 Index backplane conversion data 2 4 BASIC Floating Point to 16 Bit Binary 9 3 BASIC Floating Point to 16 Bit Signed Integer 9 2 BASIC Module Interrupt 8 4 BASIC program line 1 1 line length 7 2 line numbers 7 7 Battery Condition 11 8 Battery Backed RAM Disable 5 7 Battery Backed RAM Enable 5 2 baud rate program port setup 74 2 BRKPNT BASIC command 4 2 quick reference guide B 7 C calendar See clock calendar function CALL 101 Upload User Memory Module Code to Host command line CALL 5 4 quick reference guide 8 5 CALL 103 Print PRT1 Output Buffer and Pointer command line CALL 5 5 quick reference guide 8 5 CALL 104 Print PRT1 Input Buffer and Pointer command line CALL 5 6 quick reference guide 8 5 CALL 105 Reset PRT1 to Default Settings quick reference guide 8 5 setup function 14 4 CALL 108 Enable DF1 Driver Communications quick reference guide 8 6 status function 11 12 CALL 109 Print Argument Stack command line CALL 5 7 quick reference guide 8 6 CALL 110 Print PRT2 Output Buffer Pointer command line CALL 5 8 quick reference guide 8 6 CALL 111 Print PRT2 Input Buffer Pointer command line CALL 5 8 quick reference guide 8 6 Publication 1746 RM001A US P ii Index CALL 112 User LED Control output function 12 25 quick reference guide 8 6 CALL 113 Disable DF1 Driver Communications quick reference guide 8 6 sta
27. 70 PRINT INVALID OR NO VALUE FOUND gt 80 END READY gt RUN INPUT A STRING TO CONVERT 123ABC 123ABC 123 READY gt RUN INPUT A STRING TO CONVERT 1 2E 7 1 2E 7 1 2 E 7 READY gt RUN INPUT A STRING TO CONVERT 1 3 6 INVALID OR NO VALUE FOUND READY gt String Functions 15 5 Publication 1746 RIM001A US P 15 6 String Functions CALL 64 Find a String in a String Publication 1746 RM001A US P Purpose Use CALL 64 to find a string within a string It locates the first occurrence position of this string This CALL has two input arguments The first is the string to be found the second is the string searched for a match One output argument is required If the number is not zero then a match was located at the position indicated by the value of the output argument This routine is similar to the BASIC INSTR findstr str example L INSTRS 1 2 Syntax PUSH string number to be found PUSH base string number CALL 64 POP match position Example gt 1 REM EXAMPLE PROGRAM gt 10 REM SAMPLE FIND STRING IN STRING ROUTINE gt 20 STRING 100 20 gt 30 1 456 gt 40 2 12345678 gt 50 PUSH 1 REM STRING NUMBER OF STRING TO BE FOUND gt 60 PUSH 2 REM BASE STRING NUMBER gt 70 CALL 64 REM GET THE LOCATION OF FIRST CHARACTER gt 80 POP L gt 90 IF L 0 THEN PRINT NOT FOUND gt 100 IF L gt 0 THEN PRINT FOUND AT LOCATION L gt 110 END
28. 72 RAM ROM Return execution control and interrupt support function 8 9 quick reference guide B 4 Publication 1746 RM001A US P iv Index CALL 73 Battery Backed RAM Disable command line CALL 5 7 quick reference guide B 4 CALL 74 Battery Backed RAM Enable command line CALL 5 2 quick reference guide B 4 CALL 75 Check SLC 500 Controller CPU Status quick reference guide B 4 status function 11 7 CALL 77 Protected Variable Storage command line CALL 5 2 quick reference guide B 4 CALL 78 Set Program Port Baud Rate quick reference guide B 4 setup function 14 2 CALL 80 Check Battery Condition quick reference guide B 4 status function 77 8 CALL 81 User Memory Module Check and Description command line CALL 5 3 quick reference guide B 4 CALL 82 Check User Memory Module Map command line CALL 5 4 quick reference guide B 4 CALL 84 Transfer DH 485 Interface File to BASIC Input Buffer input function 13 19 quick reference guide B 4 CALL 85 Transfer BASIC Output Buffer to DH485 Common Interface File output function 12 17 quick reference guide B 4 CALL 86 Check DH485 Interface File Remote Write Status quick reference guide B 4 status function 11 8 CALL 87 Check DH 485 Interface File Remote Read Status quick reference guide B 4 status function 71 9 CALL 88 BASIC Floating Point to SLC Floating Point math and backplane conversion function 9 4 quick reference guide B 4 CALL 89 SLC Floating Point to BASIC Floating Point
29. 98 Disable Port PRT2 DTR Signal Status Functions 11 11 Purpose Use CALL 97 to enable the Data Terminal Ready DTR signal from port PRT2 The DTR signal on PTR2 is enabled by default on powerup This CALL re enables the DTR signal if it has been disabled by CALL 98 Syntax CALL 97 Example gt 10 REM EXAMPLE PROGRAM gt 20 CALL 97 REM ENABLE DTR SIGNAL READY Purpose Use CALL 98 to disable the Data Terminal Ready DTR signal from port PRT2 Syntax CALL 98 Example gt 10 REM EXAMPLE PROGRAM gt 20 CALL 98 REM DISABLE DTR SIGNAL READY Publication 1746 RIM001A US P 11 12 Status Functions CALL 108 Enable DF1 Driver Communications Publication 1746 RM001A US P Purpose Use CALL 108 to enable DF1 driver communications via port PRT 2 TTP ie DF can only be enabled if jumper JW4 on the module is in the correct position Refer to the SLC 500 BASIC and BASIC T Modules User Manual publication number 1746 UM004A US P for additional information This routine has six input arguments and no output arguments The first input argument specifies the operational code selection that indicates the mode of operation for the DF1 driver The operational code specifies the following DF1 parameters e full duplex or half duplex slave operation e duplicate packet detection DPD selection e BCC or CRC error checking selection e enable embedded responses ER or auto detect embedded responses ADER
30. A through L You can also use the ASC operator to change individual characters in a defined string In general the ASC operator lets you manipulate individual characters in a string A simple program can determine if two strings are identical gt NEW gt 1 REM EXAMPLE PROGRAM gt 5 STRING 1000 40 gt 10 1 ABCDEFGHIJKL gt 20 PRINT 1 gt 30 ASC 1 1 gt 40 PRINT 1 gt 50 ASC 1 2 gt 60 PRINT 1 75 REM DECIMAL EQUIVALENT OF K ASC 1 3 READY gt RUN ABCDEFGHIJKL KBCDEFGHIJKL KCCDEFGHIJKL READY gt Publication 1746 RIM001A US P 3 14 Expressions and Operators Publication 1746 RM001A US P CHR expr Use the CHR operator to convert a numeric expression to an ASCII character Example Result gt PRINT CHR 65 A Like the ASC operator the CHR operator also selects individual characters in a defined ASCII string gt NEW gt 1 REM EXAMPLE PROGRAM gt 5 STRING 1000 40 gt 10 1 The module gt 20 FOR I 1 TO 16 PRINT CHR 1 I NEXT I READY gt RUN The module READY gt In the example above the expressions contained within the parentheses following the CHR operator have the same meaning as the expressions in the ASC operator Unlike the ASC operator you cannot assign the CHR operator a value A statement such as CHR 1 1 H is INVALID and generates an ERROR BAD SYNTAX message causing the module to go into Command mode
31. A is replaced by A plus one The word LET is always optional example LET A 2 is the sameasA 2 When LET is omitted the LET statement is called an IMPLIED LET We use the word LET to refer to both the LET statement and the IMPLIED LET statement Also use the LET statement to assign string variables LET 1 THIS IS A STRING or LET 2 1 Before you can assign strings you must execute the STRING expr expr statement or else a memory allocation error occurs that causes the module to enter the Command mode Assignment Functions 6 7 RESTORE Purpose Use the RESTORE statement to reset the internal read pointer to the beginning of the data so that it may be read again Syntax RESTORE Example gt 1 gt 10 gt 20 gt 30 gt 40 gt 50 gt 60 gt 70 gt 80 REM EXAMPLE PROGRAM FOR I 1 TO 3 READ A C PRINT A C NEXT I RESTORE READ A C PRINT A C DATA 10 20 10 2 20 2 SIN PI COS PI READY gt RUN 10 20 5 10 0 1 10 20 Publication 1746 RM001A US P 6 8 Assignment Functions Publication 1746 RM001A US P CLOCK1 Control Functions Chapter 7 This chapter describes and illustrates commands executed within the BASIC program or from the command line to control the internal clock or the flow of the BASIC program Table 7 1 lists the corresponding mnemonics Table 7 1 Chapter Reference Guide If you need to Use this mnemonic Page Disable the
32. AN NH NW RH N 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 gt PRINT 3 2 5 Publication 1746 RIM001A US P 3 4 Expressions and Operators Publication 1746 RM001A US P Divide Use the Division operator to divide the first expression by the second expression Example Result gt 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 gt PRINT 2 3 8 Multiply Use the Multiplication operator to multiply the first expression by the second expression Example Result gt PRINT 3 3 9 Subtract Use the Subtraction operator to subtract the second expression from the first expression Example Result gt PRINT 9 6 3 Negation Use the Negation operator to change an expression from positive to negative Example Result gt PRINT 9 4 13 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 o
33. An attempt to re dimension an array causes an array size error that causes the module to enter the Command mode If an array variable is used that was not dimensioned by a DIM statement BASIC assigns a default value of 10 to the array size All arrays are set equal to zero when the RUN command NEW command or the CLEAR statement is executed The number of bytes allocated for an array is six times the array size plus one 6 array size 1 For example the array A 100 requires 606 bytes of storage Memory size usually limits the size of a dimensioned array Syntax DIM Examples More than one variable can be dimensioned by a single DIM statement gt 1 REM EXAMPLE PROGRAM gt 10 DIM A 25 C 15 A1 20 Error on attempt to re dimension array gt 1 REM EXAMPLE PROGRAM gt 10 A 5 10 REM BASIC ASSIGNS DEFAULT OF 10 TO ARRAY A gt 20 DIM A 5 REM ARRAY RE DIMENSION ERROR ERROR ARRAY SIZE IN LINE 20 20 DIM A 5 REM ARRAY RE DIMENSION ERROR en X READY gt Purpose Use the LET statement to assign a variable to the value of an expression Syntax LET var expr Publication 1746 RM001A US P 6 6 Assignment Functions Publication 1746 RM001A US P Examples gt 1 REM EXAMPLE PROGRAM gt 10 LET A 10 SIN C 100 gt 1 REM EXAMPLE PROGRAM gt 10 LET A A 1 NOTE The sign used in the LET statement is not an equality operator It is a replacement operator The statement should be read
34. BASIC command 4 8 quick reference guide B 7 Enable Control C 4 5 DF1 Driver Communications 11 12 DF1 Packet Interrupt 8 2 Port PRT2 DTR Signal 11 11 Processor Interrupt 8 3 END control function 7 5 quick reference guide B 7 EOF quick reference guide B 7 special function operator 3 75 ERASE BASIC command 4 9 quick reference guide B 7 EXP logarithmic operator 3 77 quick reference guide B 7 Expanded ONERR Restart 8 5 Exponentiation arithmetic operator 3 4 quick reference guide B 10 Publication 1746 RM001A US P functional operators ABS 3 9 expressions 3 2 F Find a String in a String 15 6 Find the Length of a String 15 10 floating point numbers 2 3 FOR TO STEP NEXT control function 7 6 quick reference guide B 7 FREE quick reference guide B 7 special function operator 3 15 functional operators 3 9 INT 3 10 NOT 3 9 PI 3 10 RND 3 11 SGN 3 10 SOR 3 10 G GET input function 13 38 quick reference guide 8 8 Get DF1 Packet Length 13 25 Get Number of Characters in PRT1 Buffers 11 10 Get Number of Characters in PRT2 Buffers 11 2 Get Numeric Input Character from PRT2 13 15 Get SLC Processor Program ID Number 11 19 GET input function 13 38 quick reference guide 8 8 GET input function 13 38 quick reference guide B 8 GOSUB execution control and interrupt support function 8 11 quick reference guide B 8 GOTO control function 7 7 quick reference guide B 8 H hierarchy of operations 3
35. CONFIGURATION IS gt 80 REM 1200 BAUD 8 BITS CHAR NO PARITY 1 STOP BIT AND gt 90 REM SOFTWARE HANDSHAKING ENABLED gt 100 PUSH 8 0 1 1 0 CALL 30 gt 110 CALL 31 19200 Baud Hardware Handshaking OFF 1 Stop Bit s No Parity 8 Bits Char Xon Xoff gt Purpose Use CALL 78 to change the program port baud rate from its default value 1200 baud to one of the following 300 600 1200 2400 4800 9600 or 19200 baud The default baud rate for the program port is 1200 baud if port PRT1 is configured as the program port or 19200 baud if port DH485 is configured as the program port PUSH the desired baud rate and CALL 78 The program port remains at this baud rate unless CALL 73 is invoked or the following conditions are met e The battery is dead or has been removed e The battery backup capacitor is discharged e The EEPROM is removed or not programmed e The power is cycled If this happens the baud rate defaults to 1200 baud Setup Functions 14 3 Syntax PUSH baud rate CALL 78 Example gt 1 REM EXAMPLE PROGRAM gt 10 PUSH 4800 gt 20 CALL 78 CALL 99 Reset Print Purpose Head Pointer Use CALL 99 to reset the internal print head character counter of your printer when printing out wide forms This CALL prevents the automatic CR LF at character 79 You must keep track of the characters in each line Syntax CALL 99 Example gt 10 REM EXAMPLE PROGRAM gt 20 REM THIS PRINTS TIME BEYOND 80TH COLUM
36. CPU input image buffer 11 4 CALL 56 PUSH number of words to be transferred Transfer CPU M0 file to module input buffer 13 18 POP processor status CALL 57 PUSH number of words to be transferred Transfer module output buffer to CPU M1 file 12 16 POP processor mode CALL 58 POP module file MO write status Check M0 file status 1 5 CALL 59 POP module file M1 read status Check M1 file status 1 6 CALL 60 PUSH number of times to repeat character String repeat 15 1 PUSH base string number CALL 61 PUSH string number to be appended String append concatenation 15 2 PUSH base string number CALL 62 PUSH number to convert to string Number to string conversion 15 3 PUSH string number to receive the value CALL 63 PUSH string number to convert String to number conversion 15 4 POP validity of the value POP actual value Publication 1746 RM001A US P B 4 BASIC Command Statement and CALL Quick Reference Guide Mnemonic Required PUSHes or POPs Description Active In Page Command Mode Only CALL 64 PUSH string number to be found Find a string in a string 15 6 PUSH base string number POP match position CALL 65 PUSH new string number Replace a string in a string 15 7 PUSH old string number to be replaced PUSH base string number CALL 66 PUSH insert position Insert string in a strin
37. Common Interface File Publication 1746 RM001A US P Purpose Use CALL 93 to write up to 40 words starting at word 0 of the module output buffer to the remote DH485 Common Interface File at the designated node address starting at the designated word offset This routine has four input arguments and one output argument The first input argument is the node address of the remote device 0 to 31 If the number is not within the range 0 to 31 then the output argument equals 10 and the write message does not take place The second input argument is the starting word offset within the file on the remote device 0 to 32767 If the number is not within the range 0 to 32767 then the output argument equals 12 and the transfer does not take place The offset will be twice of what is expected For example if an IMPORTANT P pe IMPORTANT offset of 3 was PUSHed the data will be written to the remote DH485 data file beginning at element 6 The third input argument is the number of words to be transferred If the number is not within the range specified below then the output argument equals 13 and the transfer does not take place The fourth input argument is the message time out value This value is the number of hundreds of milliseconds that are allowed to receive the write response 1 to 50 0 1 to 5 0 seconds If the write response is not received within this time the message aborts with the output argument equal to 55 If the number
38. DH485 data file to the module input buffer starting at word 0 This routine has six input arguments and one output argument The first input argument is the node address of the remote device 0 to 31 If the number is not within the range 0 to 31 then the output argument equals 10 and the read message does not take place The second input argument is the file number on the remote device 0 to 255 If the number is not within the range 0 to 255 then the output argument equals 11 and the read message does not take place The third input argument is the file type read from the remote device Valid file type codes are ASC N ASC S ASC C ASC T ASC B and ASC R If the file type is not one of these valid types then the output argument equals 241 and the read message does not take place Table 13 5 FileType to be Read from Remote Device File Type File Type Code Words Element Integer File ASC N 1 word element Status File ASC S 1 word element Counter File ASC C 3 words element Timer File ASC T 3 words element Bit File ASC B 1 word element Control File ASC R 3 words element The fourth input argument is the starting element offset within the file on the remote device 0 to 32767 If the number is not within the range 0 to 32767 then the output argument equals 12 and the transfer does not take place The offset will be twice of what is expected For example if an IMPORTANT P pS IMPORTANT offset
39. Excessive nesting exceeds the limits of the control stack generating an error and causing the module to enter Command mode Syntax FOR expr TO expr STEP expr NEXT expr Examples gt 1 REM EXAMPLE PROGRAM gt 5 E 0 C 10 D 2 gt 10 FOR A E TO C STEP D gt 20 PRINT A gt 30 NEXT A gt 40 END gt RUN Fon RN O 0 READY gt 1 REM EXAMPLE PROGRAM gt 10 FOR I 1 TO 4 gt 20 PRINT I gt 30 NEXT I gt 40 END READY gt RUN L 22 3 24 GOTO Control Functions 7 7 In the first example since E 0 C 10 D 2 and the PRINT statement at line 20 executes 6 times the values of A that are printed are 0 2 4 6 8 and 10 A represents the name of the index or loop counter The value of E is the starting value of the index The value of C is the limit value of the index and the value of D is the increment to the index If the STEP statement and the value D are omitted the increment value defaults to 1 therefore STEP is an optional statement The NEXT statement returns the loop to the beginning of the loop and adds the value of D to the current index value The current index value is then compared to the value of C the limit value of the index If the index is less than or equal to the limit control transfers back to the statement after the FOR statement Stepping backward FOR I 100 TO 1 STEP 1 is permitted in the module The NEXT statement is always followed by the appropriate variable You may
40. FOR I 1 TO 5 PRINT I NEXT I PRINT PASSED FOR NEXT LOOP PRINT THIS IS THE END END READY gt SNGLSTP 20 SINGLE STEP ENABLED STOP LINE 20 STOP LINE 30 STOP LINE 20 STOP LINE 30 STOP LINE 20 STOP LINE 30 READY gt SNGLSTP 0 SINGLE STEP DISABLED PASSED FOR NEXT LOOP THIS IS THE END BASIC Commands 4 25 VER Purpose Use the VER command to print the module sign on message that displays the current version of the firmware Syntax VER Example gt VER SLC 500 module Catalog Number 1746 BAS Firmware release x xx Allen Bradley Company Copyright 19xx All rights reserved gt Publication 1746 RIM001A US P 4 26 BASIC Commands XFER Purpose Use the XFER command to transfer the current selected program in ROM to RAM and select RAM mode After the XFER command executes you can edit the program in the same way you edit any RAM program IMPORTANT The XFER command clears existing RAM programs Syntax XFER Example READY gt XFER Publication 1746 RM001A US P CALL 73 Battery Backed RAM Disable Chapter 5 Command Line CALLs This chapter describes and illustrates CALLs that cause a function to occur within the BASIC or BASIC T module These CALLs cannot be executed within the BASIC program but are entered at the command line Table 5 1 lists the corresponding mnemonics Table 5 1 Chapter Reference Guide
41. If you want to transfer control to different line numbers using the IF statement you may omit the GOTO statement The following examples give the same results gt 20 IF INT A lt 10 THEN GOTO 100 ELSE GOTO 200 or gt 20 IF INT A lt 10 THEN 100 ELSE 200 You can replace the THEN statement with any valid module statement as shown below gt 30 IF A lt gt 10 THEN PRINT A ELSE 10 gt 30 IF A lt gt 10 PRINT A ELSE 10 NEXT Control Functions 7 9 Example 2 You may execute multiple statements following the THEN or ELSE if you use a colon to separate them gt 30 IF A lt gt 10 THEN PRINT A GOTO 150 ELSE 10 gt 30 IF A lt gt 10 PRINT A GOTO 150 ELSE 10 In these examples if A does not equal 10 then both PRINT A and GOTO 150 are executed If A equals 10 then control passes to 10 Example 3 You may omit the ELSE statement If you omit the ELSE statement control passes to the next statement gt 1 REM EXAMPLE PROGRAM gt 20 IF A 10 THEN 40 gt 30 PRINT A In this example if A equals 10 then control passes to line number 40 If A does not equal 10 line number 30 is executed Purpose Use the NEXT statement to return the FOR TO STEP NEXT loop to the beginning of the loop and add the value of the index increment to the index The current index value is then compared to the index limit to determine if another loop should be performed Syntax NEXT Publication 1746 RM001A US P 7 10 Control Functions Exa
42. MESSAGE TIME OUT VALUE X100MS REM LOCAL SLC FILE TYPE MO REM WORD OFFSET INTO LOCAL SLC FILE REM INTERNAL STRING NUMBER NOT USED FOR THIS THEN PRINT CALL 28 DISABLED THEN PRINT CALL 28 BAD INPUT PARAMETER THEN PRINT PORT DH485 NOT ENABLED Copy the data to be sent to the remote DH485 node to the local file the MO file associated with the slot number of the module Latch the CALL 28 request bit word 0 bit 11 Publication 1746 RIM001A US P 12 12 Output Functions Input PB to initiate CALL 28 1 2 0 1 B3 0 COP 0000 J E J E COSR Copy File 0 11 0 Source N7 0 Dest M0 1 0 Length 20 CALL 28 Request Bit 0 1 oa Buffer Status Byte if Non zero 1 1 NEQ MOV 0001 Not Equal Move 11 Source A 1 Source Handshake Bit from Module Source B Dest Command Failed Indication 0 3 lt 0 q Command Success Indication EQU 0 Equal Cl Source A Source B 0 0 Command Failed Indication CALL 28 Request Bit 0 1 0002 Publication 1746 RM001A US P CALL 29 Read Write to a PLC SLC from the Module Internal String Output Functions 12 13 Purpose Use CALL 29 in conjunction with CALLs 122 or 123 to communicate between remote PLCs and the module internal string without local SLC processor interaction You can also use CALL 29 in conjunction with CALLs 27 or 28 to communicate between remote SLCs and the module internal string without loca
43. PRT2 and DH485 MODE 4 12 Erase the program stored in RAM NEW 4 14 Set NULL count after carriage return line feed NULL 4 14 Save the current program in EPROM PROG 4 15 Save the baud rate information in EPROM PROG 4 16 Save the baud rate information in EPROM and execute the PROG2 4 17 program after reset Evoke RAM mode RAM 4 19 Specify a remark or comment line REM 4 19 Renumber the BASIC program REN 4 20 Select ROM mode ROM 4 20 Select ROM mode and execute the selected program RROM 4 21 Execute a program RUN 4 22 Initiate single step program execution SNGLSTP 4 23 Verify the module firmware version VER 4 25 Transfer a program from ROM to RAM XFER 4 26 Publication 1746 RM001A US P 4 2 BASIC Commands BRKPNT Purpose Use the BRKPNT command to set a program break point at the line number specified by this command Program execution stops just before the line number specified by the BRKPNT command If the line number is zero the break point is disabled After the break point is reached you can examine variables by using assignment statements Continue from the break point by using the CONT command Once the break point is reached it is disabled To stop at the same place twice set the break point twice The BRKPNT command works only on programs executing from RAM It does not stop a program executing from ROM Syntax BRKPNT In num Example gt 1 REM EXAMPLE PROGRAM gt 10 D 0 SU 0 AV 0 gt 20 RE
44. PUSHed or POPped Syntax CALL 94 Example gt CALL 94 19200 Baud Hardware Handshaking OFF 1 Stop Bit s No Parity 8 Bits Char Xon Xoff Purpose Use CALL 96 to clear port PRT1 input and output buffers Use the following PUSHes to clear the corresponding buffer e PUSH 0 to clear the output buffer e PUSH 1 to clear the input buffer e PUSH 2 to clear both buffers CALL 112 User LED Control Output Functions 12 25 Tata l port PRTI is configured for DH485 protocol this CALL has no effect Syntax PUSH buffer selection CALL 96 Example gt 1 REM EXAMPLE PROGRAM gt 10 PUSH 0O CALL 96 REM CLEAR PRT1 OUTPUT BUFFER READY gt Purpose Use CALL 112 to activate or de activate the user LEDs LED1 and LED2 Two inputs arguments are required and no output arguments The first input argument activates or de activates LED 1 The second input argument activates or de activates LED2 An input argument of one activates the LED An input argument of zero deactivates the LED Any other value has no effect on that particular LED NOTE When you change to Command mode the user defined LEDs remain in their last state until you execute another CALL112 Syntax PUSH LED1 state PUSH LED2 state CALL 112 Publication 1746 RIM001A US P 12 26 Output Functions CALL 114 Transmit DF1 Packet Publication 1746 RM001A US P Example gt 1 REM EXAMPLE PROGRAM gt 100 PUSH 1 REM TURN ON LED1
45. REM EXAMPLE PROGRAM gt 120 CALL 58 REM START WAITING ON MO UPDATE gt 130 POP S gt 140 IF S 2 THEN PRINT PROCESSOR DOES NOT SUPPORT THIS FUNCTION gt 150 IF S 2 THEN STOP gt 160 IF S 0 THEN GOTO 120 gt 170 PUSH 64 gt 180 CALL 56 gt 190 POP A gt 200 PRINT CALL 56 OUTPUT IS A READY gt RUN CALL 56 OUTPUT IS 0 Publication 1746 RIM001A US P 11 6 Status Functions CALL 59 Check M1 File Publication 1746 RM001A US P Purpose Use CALL 59 to determine if the Module File M1 located in the module has been read by the Logic Processor since the last time it was checked This routine has no input arguments and one output argument The output argument is equal to 0 if the Logic Processor has not read from the Module File M1 since the last time this CALL was executed or since the module was powered up whichever occurred last e 1 if the Logic Processor has read from the Module File M1 since the last time this CALL was executed or since the module was powered up whichever occurred last e 2 if the Logic Processor does not support this capability as with the SLC 5 01 processor Syntax CALL 59 POP module file M1 read status Example gt 1 REM EXAMPLE PROGRAM gt 100 PUSH 64 gt 110 CALL 56 REM COPY BASIC OUTPUT BUFFER TO M1 gt 120 POP A gt 130 IF A 2 THEN PRINT SLC DOES NOT SUPPORT THIS FUNCTION gt 140 IF A 2 THEN STOP gt 150 IF A lt gt 0 THE GO
46. SECONDS TIMER INTERRUPT AT 4 005 SECONDS TIMER INTERRUPT AT 6 015 SECONDS TIMER INTERRUPT AT 8 01 SECONDS TIMER INTERRUPT AT 10 01 SECONDS In the example above the time printed out is 01 seconds later than the time that was supposed to be printed This is caused by the terminal used in the example operating at 19200 baud which causes a 01 second delay in printing To execute the ONTIME interrupt at a fraction of a second use DBY 71 X where X 0 to 200 Each count represents a 5 millisecond time interval Purpose Use the PUSH statement to place the arithmetic expression or expressions in the module argument stack This statement evaluates the arithmetic expression or expressions following the PUSH statement and then places them in sequence on the argument stack The PUSH and POP statements provide a simple means of passing parameters to CALL routines In addition the PUSH and POP statements are used to pass parameters to BASIC subroutines and to SWAP variables The last value PUSHed onto the argument stack is the first value POPped off the argument stack Publication 1746 RM001A US P 8 16 Execution Control and Interrupt Support Functions Publication 1746 RM001A US P You can push more than one expression onto the argument stack using a single PUSH statement with multiple expressions expr expr expr Each expression must be followed by a comma The last value PUSHed onto the argument stack is the last ex
47. Table 10 1 Chapter Reference Guide If you need to Use this mnemonic Page Set the clock calendar time hour minute second CALL40 for Set the clock calendar date day month year CALL 41 10 2 Set the clock calendar day of week CALL 42 10 3 Retrieve a date time string CALL 43 10 4 Retrieve the date numeric day month year CALL 44 10 4 Retrieve a time string CALL 45 10 5 Retrieve a time numeric CALL 46 10 6 Retrieve the day of week string CALL 47 10 6 Retrieve the day of week numeric CALL 48 10 7 Retrieve a date string CALL 52 10 7 CALL 40 Set Clock Purpose Calendar Time Use CALL 40 to set the following clock calendar time functions e H hours 0 to 23 only a 24 hour clock is available e M minutes 0 to 59 e S seconds 0 to 59 Syntax PUSH hours PUSH minutes PUSH seconds CALL 40 Publication 1746 RIM001A US P 10 2 Clock Calendar Functions Example Program the wall clock for 1 35 P M programmed as 13 35 only a 24 hour clock is available gt 1 REM EXAMPLE PROGRAM gt 10 H 13 M 35 S 00 gt 20 REM HOURS 13 MINUTES 35 SECONDS 00 gt 30 PUSH H M S gt 40 CALL 40 READY gt RUN READY gt CALL 41 Set Clock Purpose Calendar Date Use CALL 41 to set the following clock calendar functions e D day e M month e Y year Three values are PUSHed and none are POPped Syntax PUSH day PUSH month
48. US P Purpose Use CALL 66 to insert a string within another string The CALL expects three arguments The first argument is the position at which to begin the insert The second argument is the string number of the characters inserted into the base string The third argument is the number of the base string This routine has no output arguments Tae lE the new string length exceeds the length allocated by the string command an error message is printed on the console device and the module enters Command mode Syntax PUSH insert position PUSH string number of inserted character PUSH base string number CALL 66 Example gt 1 REM EXAMPLE PROGRAM gt 10 REM SAMPLE ROUTINE TO INSERT A STRING IN A STRING gt 20 STRING 100 15 gt 30 0 1234590 gt 40 1 67890 gt 50 PRINT BEFORE gt 60 PRINT 0 0 gt 70 PUSH 6 REM POSITION TO START THE INSERT gt 80 PUSH 1 REM STRING NUMBER TO BE INSERTED gt 85 PUSH 0O REM BASE STRING NUMBER gt 90 CALL 66 REM INVOKE INSERT A STRING IN A STRING gt 100 PRINT 0 0 gt 110 END READY gt RUN BEFORE 0 1234590 0 123456789090 READY gt String Functions 15 9 CALL 67 Delete a String in a String Purpose Use CALL 67 to delete a string from within another string The CALL expects two arguments The first argument is the base string number The second is the number of the string deleted fro
49. Write module output buffer to remote DH485 12 22 PUSH starting element offset x2 of remote interface file device file PUSH number of words to be transferred PUSH message time out value POP status of message instruction CALL 94 None Print current PRT1 port setup 2 24 CALL 95 PUSH buffer selection Get number of characters in PRT1 buffers 1 10 POP number of characters CALL 96 PUSH buffer selection Clear port PRT1 input and output buffers 2 24 CALL 97 None Enable port PRT2 DTR signal 1 11 CALL 98 None Disable port PRT2 DTR signal 1 11 CALL 99 None Reset print head pointer 14 3 CALL 101 PUSH starting address Upload user memory module code to host 5 4 PUSH ending address CALL 103 None Print port PRT1 output buffer and pointer 5 5 CALL 104 None Print port PRT1 input buffer and pointer 5 6 CALL 105 None Reset port PRT1 to default settings 14 4 Publication 1746 RM001A US P B 6 BASIC Command Statement and CALL Quick Reference Guide Mnemonic Required PUSHes or POPs Description Active In Command Mode Only Page CALL 108 PUSH operational code PUSH poll timeout or ACKnowledge timeout PUSH message retries or ENQuiry retries PUSH RTS On delay or NAK received retries PUSH RTS Off delay or NULL value PUSH module DF1 address Enable DF1 driver communications CALL 109 None Print the argument stack 3 7 CALL 110 None Print port PRT2 output
50. a transmission is completed and a Request To Send RTS is deactivated The valid range for the RTS Off Delay is 0 to 65499 This argument is only used if HDMwCC or HDMwoCC is selected through the first input argument This input argument is only used for half duplex mode When full duplex mode is selected a NULL value must be PUSHed The sixth input argument specifies the module address that the DF1 driver responds to when receiving enquires from a remote DF1 device Legal values are 0 to 254 This input argument is used for half duplex and full duplex mode Publication 1746 RIM001A US P 11 18 Status Functions CALL 113 Disable DF1 Driver Communications CALL 120 Clear module Input and Output Buffers Publication 1746 RM001A US P Syntax PUSH operational code PUSH Poll timeout or ACKnowledge timeout PUSH message retries or ENQuiry retries PUSH RTS On delay or NAK received retries PUSH RTS Off delay or NULL value PUSH module DF1 address CALL 108 Example gt 1 REM EXAMPLE PROGRAM gt 10 PUSH 5 REM HDMWOCC ENABLE DPD BCC ERROR CHECKING gt 20 PUSH 200 REM WAIT 1 SECOND TO BE POLLED BY MASTER gt 30 PUSH 2 REM PERFORM 2 RETRIES gt 40 PUSH 4 REM 20 MS RTS ON DELAY gt 50 PUSH 4 REM 20 MS RTS OFF DELAY gt 60 PUSH 10 REM module ADDRESS OF 10 gt 70 CALL 108 gt 80 END Purpose Use CALL 113 to disable DF1 driver communications This routine has no input arguments and no output argumen
51. allocated for strings Memory is allocated using the STRING statement Strings are declared and manipulated through the operator Publication 1746 RM001A US P 2 2 Data Types Publication 1746 RM001A US P 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 gt 10 STRING 106 20 gt 20 1 THIS IS A STRING gt 30 INPUT WHAT S YOUR NAME 2 gt 40 PRINT 1 2 gt 50 END READY gt RUN WHAT S YOUR NAME FRED THIS IS A STRING FRED READY gt 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 Data Types 2 3 Numeric Data Types There are two different numeric data types e integer numbers e floating point numbers You can enter and display numbers in four formats integer decimal hexadecimal and exponential Example 129 34 98 OA6EH 1 23456E 3 The BASIC or BASIC T module interprets all numbers as floating point numbers except when performing logica
52. buffer and pointer 5 8 CALL 111 None Print port PRT2 input buffer and pointer 5 8 CALL 112 PUSH LED1 state PUSH LED2 state User LED control 12 25 CALL 11 None Disable DF1 driver communications CALL 11 None Transmit DF1 packet 12 26 CALL 11 POP DF1 transmit status Check DF1 XMIT status 12 27 CALL 1 POP length of DF1 packet Get DF1 packet length 13 25 co N on P ow CALL 11 PUSH CALL enable disable PUSH selection of destination file and or string PUSH word offset in destination file PUSH string number PUSH maximum word length POP CALL 118 status Allow unsolicited writes from a remote SLC or PLC node 13 26 CALL 119 None Reset port PRT2 to default settings CALL 120 USH decimal equivalent Clear module input and output buffers CALL 121 OP program ID number Get SLC processor program ID number CALL 122 USH type of PLC READ command USH remote PLC node address USH file number of remote PLC USH file type on remote PLC USH starting element offset on remote PLC USH number of elements to be transferred USH message time out value USH selection of destination file USH word offset within destination file USH string number POP CALL 122 status m en eS De en ee ee ee ee e me me Read a PLC data file Publi
53. 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 expr The dimension of a string variable the expr value ranges from 0 to 254 This means that you can define and manipulate 255 different strings in the module Initially no memory is
54. gt 60 STR 24569 REM STORE L IN PROTECTED AREA gt 70 REM TO RETRIEVE PROTECTED VARIABLES gt 80 LD 24575 REM REMOVE K FROM PROTECTED AREA gt 90 POP K gt 100 LD 24569 REM REMOVE L FROM PROTECTED AREA gt 110 POP L gt 120 REM USE LD AFTER POWER LOSS AND BATTERY BACK UP IS USED Purpose Use CALL 81 to check the user memory module before burning a program into the memory module This routine e determines the number of memory module programs e determines the number of bytes left in the memory module e determines the number of bytes in the RAM program e prints a message indicating if enough space is available in the memory module for the RAM program e checks memory module checksum if program is found e prints a caution message is checksum fails IMPORTANT CALL 81 cannot detect a defective memory module No PUSHes or POPs are needed Syntax CALL 81 Publication 1746 RM001A US P 5 4 Command Line CALLs CALL 82 Check User Memory Module Map CALL 101 Upload User Memory Module Code to Host Publication 1746 RM001A US P Example gt CALL 81 Number of BASIC programs in E EPROM 3 Available bytes to end of user E EPROM 7944 Available bytes to beginning of assembly pgm 3848 Length of BASIC program in RAM 76 Program will fit in E EPROM READY gt Purpose Use CALL 82 to check the user memory module and display a map of where all the BASIC programs are s
55. has no input or output arguments Syntax CALL 17 Example gt 1 REM EXAMPLE PROGRAM gt 10 REM DISABLE DF1 PACKET INTERRUPT ENABLED WITH CALL 16 gt 20 CALL 17 Purpose Use CALL 20 to allow the processor to interrupt the module One argument is PUSHed and no arguments are POPped The PUSH is the BASIC line number of the beginning of the interrupt routine that the program should jump to when word 0 bit 15 in the CPU output image table toggles from a low to a high value The module detects this transition automatically and jumps to an interrupt routine A RETI executed within the interrupt routine returns you to the point in the module program before the interrupt occurred The module monitors CPU output file word 0 bit 15 at the end of every BASIC line and generates the interrupt if the bit goes high The CPU must hold the interrupt request bit low for at least 10 milliseconds prior to requesting interrupt service The bit must be held high for at least one scan so the bit can be detected by the module If another interrupt is detected before the previous one is fully serviced the new interrupt is marked pending Only one interrupt is pending at a time Interrupts are disabled when the module is in Command mode CALL 20 disabled is the default of the module when entering Run mode CALL 20 must be re executed every time Run mode is entered Syntax PUSH BASIC line number CALL 20 Publication 1746 RIM001A US P 8 4 Execut
56. integrity is guaranteed during this transfer File integrity is not Handshaking bits can be used in your application program to provide file integrity Syntax CALL 54 POP processor mode Example gt 1 REM EXAMPLE PROGRAM gt 30 CALL 54 REM XFER BASIC OUTPUT BUFFER TO CPU INPUT IMAGE TABLE gt 40 POP X REM LOGIC PROCESSOR STATUS IS IN X gt 50 IF X lt gt 0 THEN PRINT PROCESSOR NOT IN RUN MODE READY gt RUN READY gt CALL 57 Transfer Purpose BASIC Output Buffer to Use CALL 57 f eee d 100 from the modul tot t tart tw t 1 Fil se CAI o transfer up to 64 words starting at wor ro e module output buffer to the CPU M1 file starting at word 0 This routine has one input argument and one output argument The input argument is the number of words to be transferred 1 to 64 If the number is not within the range 1 to 64 no transfer occurs and the output argument is set to 10 If the input argument is a valid number then the output argument is the status of the Logic Processor It can have one of the following values e 0 Successful transfer SLC processor in Run mode e 1 Successful transfer SLC processor in Program mode e 2 Successful transfer SLC processor in Test mode e 10 Illegal length specified e 11 SLC processor does not support this capability Word integrity is guaranteed during this transfer File integrity is not Handshaking bits can be used in your application program to provide file integr
57. is too large 235 EB Target node cannot respond because target node denies access 236 EC Target node cannot respond because requested function is currently unavailable 241 F1 module detects illegal target file type 250 FA Target node cannot respond because another node is file owner has sole file access 251 FB Target node cannot respond because another node is program owner has sole access to all files This CALL is implemented as a Protected Typed Logical Write with two address fields Syntax PUSH remote device node address PUSH remote device file number Output Functions 12 21 PUSH starting element offset x2 of remote device file PUSH remote device file type PUSH number of elements to be transferred PUSH message time out value CALL 91 POP status of message instruction Example gt 1 REM EXAMPLE PROGRAM 10 PUSH 5 REM THE TIME OUT VALUE 0 5 SECOND CALL 91 REM WRITE DATA FROM OUTPUT BUFFER gt 10 PUSH 1 REM REMOTE NODE ADDRESS 1 gt 20 PUSH 7 REM REMOTE FILE 7 gt 30 PUSH ASC N REM FILE TYPE INTEGER gt 40 PUSH O REM OFFSET 0 gt 50 PUSH 10 REM WORD LENGTH gt 60 gt 70 gt 80 POP R REM GET THE OUTPUT ARGUMENT gt 90 IF R lt gt 0 PRINT READ ERROR CODE R READY gt RUN READ ERROR CODE 5 READY gt Publication 1746 RIM001A US P 12 22 Output Functions CALL 93 Write Output Buffer to Remote DH485
58. is 0 or greater than the maximum number of characters supported by this device C6 Illegal address address does not exist or does not point to something usable in this command C7 Illegal size file is wrong size address is past end of file C8 Cannot complete request c9 Data or file is too large CA Request is too large transaction size plus word address is too large CB Access denied privilege violation CC Resource is not available condition cannot be generated CD Resource is already available condition already exists CE Command cannot be executed CF Overflow histogram overflow DO No access D1 Illegal data type information D2 Invalid parameter invalid data in search or command block Output Functions 12 33 Table 12 11 Transaction Status Codes Code Indicates D3 Address reference exists to deleted area D4 Command execution failure for unknown reason PLC 3 histogram overflow D5 Data conversion error D6 The scanner is not able to communicate with a 1771 chassis adapter D7 The adapter is not able to communicate with the module D8 The 1771 module response was not valid D9 Duplicated label DA File is open another station owns it DB Another station is the program owner Syntax PUSH type of PLC WRITE command PUSH remote PLC node address PUSH file number of remote PLC PUSH file type on remote PLC PUSH starting word offset on remote PLC PUSH number of
59. is the program owner Input Functions 13 37 Syntax PUSH type of PLC READ command PUSH remote PLC node address PUSH file number of remote PLC PUSH file type on remote PLC PUSH starting element offset on remote PLC PUSH number of elements to be transferred PUSH message time out value PUSH selection of destination file PUSH word offset within destination file PUSH string number CALL 122 POP CALL 122 status Example gt 1 REM EXAMPLE PROGRAM gt 10 REM ENABLE DF1 PLC REMOTE READ COMMAND gt 20 PUSH 5 REM PLC 5 FILE gt 30 PUSH 0 REM NODE ADDRESS OF PLC 5 gt 40 PUSH 7 REM FILE NUMBER OF PLC 5 gt 50 PUSH ASC N REM FILE TYPE OF PLC 5 gt 60 PUSH O REM STARTING WORD OFFSET OF PLC 5 FILE gt 70 PUSH 20 REM NUMBER OF DATA WORDS TO READ gt 80 PUSH 10 REM COMMAND TIME OUT VALUE X100MS gt 90 PUSH 1 REM DESTINATION IS SLC M1 FILE gt 100 PUSH O REM WORD OFFSET WITHIN M1 FILE gt 110 PUSH O REM STRING NUMBER NOT USED FOR THIS EXAMPLE gt 120 CALL 122 gt 130 POP S REM STATUS OF THE CALL gt 140 IF S lt gt 0 THEN PRINT UNSUCCESSFUL CALL 122 SETUP gt 150 GOTO 150 REM CALL 122 is active while BASIC program is running Publication 1746 RM001A US P 13 38 Input Functions TON 0000 Timer On Delay EN gt DN Timer T4 0 Initiate CALL 122 in the module Time Base 0 01 DN gt a ona gt Preset 1000 every 10 seconds via timer T4 0 Aecim L 122 R
60. math and backplane conversion function 9 5 quick reference guide B 4 CALL 90 Read Remote DH 485 Data to BASIC Input Buffer input function 13 20 quick reference guide B 5 Publication 1746 RM001A US P CALL 91 Write BASIC Output Buffer to Remote DH485 Data File output function 12 18 quick reference guide B 5 CALL 92 Read Remote DH485 Common Interface File to BASIC Input Buffer input function 73 23 quick reference guide B 5 CALL 93 Write Output Buffer to Remote DH485 Common Interface File output function 12 22 quick reference guide B 5 CALL 94 Display Current PRT1 Port Setup output function 12 24 quick reference guide B 5 CALL 95 Get Number of Characters in PRT1 Buffers quick reference guide B 5 status function 77 10 CALL 96 Clear PRT1 Input Output Buffers output function 12 24 quick reference guide B 5 CALL 97 Enable Port PRT2 DTR Signal quick reference guide B 5 status function 11 11 CALL 98 Disable Port PRT2 DTR Signal quick reference guide B 5 status function 11 11 CALL 99 Reset Print Head Pointer quick reference guide B 5 setup function 74 3 CBY quick reference guide B 7 special function operator 3 16 character set 1 1 CHR quick reference guide B 7 string operator 3 14 CLEAR assignment function 6 1 quick reference guide B 7 clear BASIC Module Input and Output Buffers 77 78 Module Input and Output Buffers 77 78 PRT1 Input Output Buffers 12 24 PRT1 input output buffers 12 24 PRT2 Input Output Buffer
61. nest FOR NEXT loops up to 9 times gt 1 REM EXAMPLE PROGRAM gt 1 REM EXAMPLE PROGRAM gt 10 FOR I 1 TO 4 gt 10 FOR I 0 TO 8 STEP 2 gt 20 PRINT I gt 20 PRINT I gt 30 NEXT I gt 30 NEXT I gt 40 END gt 40 END gt RUN gt RUN gt 1234 0 2 4 6 8 READY READY Purpose Use the GOTO statement to cause BASIC to transfer control to the line number In num specified Syntax GOTO In num Example gt 1 REM EXAMPLE PROGRAM gt 50 GOTO 100 Publication 1746 RIM001A US P 7 8 Control Functions IF THEN ELSE Publication 1746 RM001A US P If line 100 exists this statement causes execution of the program to resume at line 100 If line number 100 does not exist the message ERROR INVALID LINE NUMBER is printed to the console device and the module enters the Command mode Unlike the RUN command the GOTO statement if executed in the Command mode does not clear the variable storage space or interrupts However if the GOTO statement is executed in the Command mode after a line is edited the module clears the variable storage space and all BASIC evoked interrupts Purpose Use the IF THEN ELSE statement to set up a conditional test Syntax IF rel expr THEN valid statement ELSE valid statement Examples Example 1 gt 1 REM EXAMPLE PROGRAM gt 10 IF A 100 THEN A 0 ELSE A A 1 Upon execution of line 10 IF A is equal to 100 THEN A is assigned a value of 0 IF A does not equal 100 A is assigned a value of A 1
62. nesting exceeds the limits of the control stack generating an error and causing the module to enter Command mode Syntax DO UNTIL rel expr Control Functions 7 5 END Examples Simple DO UNTIL gt 1 REM EXAMPLE PROGRAM gt 10 A 0 gt 20 DO gt 30 A A 1 gt 40 PRINT A gt 50 UNTIL A 4 gt 60 PRINT DONE gt 70 END gt RUN Purpose Nested DO UNTIL gt 1 gt 10 gt 20 gt 30 gt 40 gt 50 gt 60 gt 70 gt 80 gt 90 RUN REM EXAMPLE PROGRAM DO A A 1 DO C C 1 PRINT A C A C UNTIL C 3 c 0 UNTIL A 3 END Use the END statement to terminate program execution CONT does not operate if the END statement is used to terminate execution An ERROR CAN T CONTINUE prints to the console Always include an END statement to properly terminate a program Syntax END Example End Statement Termination gt 1 REM EXAMPLE PROGRAM gt 10 FOR I 1 TO 4 gt 20 PRINT I gt 30 NEXT I gt 40 END Publication 1746 RM001A US P 7 6 Control Functions FOR TO STEP NEXT Publication 1746 RM001A US P Purpose Use the FOR TO STEP NEXT statement to set up and control program loops The control stack C stack stores all information associated with loop control example DO WHILE DO UNTIL FOR NEXT and BASIC subroutines The control stack is 157 bytes long DO WHILE and DO UNTIL loops and GOSUB commands use 3 bytes of the control stack FOR NEXT loops use 17 bytes TTT he
63. number is not within the range 0 to 32767 then the output argument equals 12 and the transfer does not take place The offset will be twice of what is expected For example if an IMPORTANT P p e IMPORTANT offset of 3 was PUSHed the data will be written to the remote DH485 data file beginning at element 6 The third input argument is the number of words to be transferred If the number is not within the range 1 to 40 then the output argument equals 13 and the transfer does not take place The fourth input argument is the message time out value This value is the number of hundreds of milliseconds that are allowed to receive the read response 1 to 50 0 1 to 5 0 seconds If the read response is not received within this time the message aborts with the output argument equal to 55 If the number is not within the range 1 to 50 the output argument equals 14 and the transfer does not take place The read data from the remote device is read into the module input buffer starting at word 0 and filling as many words as specified by the word length of the message Upon return from the CALL the output argument specifies the status of the message instruction Table 13 8 defines the output arguments Publication 1746 RM001A US P 13 24 Input Functions Table 13 8 Output Argument Decimal Hexadecimal Description Output Output 0 00 Successful Completion
64. of 3 was PUSHed the data will be written to the remote DH485 data file beginning at element 6 The fifth input argument is the number of elements to be transferred If the number is not within the valid length range specified in Table 13 6 then the output argument equals 13 and the transfer does not take place Input Functions 13 21 Table 13 6 Valid Length Range File Type Code Valid Length Range ASC N 1 to 40 ASC S 1 to 40 ASC C 1 to 13 ASC T 1 to 13 ASC B 1 to 40 ASC R 1 to 13 The sixth input argument is the message time out value This value is the number of hundreds of milliseconds that are allowed to receive the read response 1 to 50 0 1 to 5 0 seconds If the read response is not received within this time the message aborts with the output argument equal to 55 If the number is not within the range 1 to 50 the output argument equals 14 and the transfer does not take place The read data from the remote device is read into the module input buffers starting at word 0 and filling as many words as specified by the element length of the message The output argument specifies the status of the message instruction Upon return from the CALL the output argument has the following definition Table 13 7 Output Argument Decimal Hexadecimal Description Output Output 0 00 Successful Completion 2 02 Target node cannot accept the message
65. of transaction Publication 1746 RIM001A US P 12 14 Output Functions CALL 31 Display Current PRT2 Port Setup Publication 1746 RM001A US P Example CALL 122 must be enabled with internal string only prior to executing CALL 29 in this example Upon execution of CALL 29 an attempt is made to transfer one element from integer file 10 starting at element 0 of the PLC 5 at node 3 to the internal string 1 of the module gt 1 gt 10 gt 20 gt 21 gt 25 gt 30 gt 40 gt 50 gt 60 gt 70 gt 80 gt 90 gt 100 REM EXAMPLE PROGRAM REM EXECUTE DF1 PLC REMOTE READ FROM INTERNAL REM STRING WITH NO SLC INTERVENTION REM SET UP CALL 122 PUSH 5 3 10 ASC N 0 10 10 1 1 1 CALL 122 POP STATUS PUSH 122 CALL 29 POP S IF S 1 THEN PRINT CALL 122 NOT ACTIVE IF S 255 THEN PRINT SLC FILE CHOSEN FOR CALL 122 IF S 0 THEN PRINT SUCCESSFUL TRANSFER IF S lt gt 0 THEN PRINT UNSUCCESSFUL TRANSFER END CALL 29 does not require SLC bit handshaking at the end of the command unlike CALLs 27 28 122 and 123 when using an SLC file as a source or destination Purpose Use CALL 31 to display the current PRT2 port configuration on the program port terminal screen No arguments are PUSHed or POPped Syntax CALL 31 Example gt CALL 31 1200 Baud Hardware Handshaking OFF 1 Stop Bit s No Parity 8 Bits Char Xon Xoff READY gt CALL 37 Clear PRT2
66. one output argument The first input argument is the starting offset in the DH485 Common Interface File and the module input buffer 0 to 39 Ifthe number is not within the range 0 to 39 the output argument equals 1 and the transfer does not take place The second input argument is the length in words to be transferred 1 to 40 If the number of words is not within the range 1 to 40 the output argument equals 2 and the transfer does not take place e 0 Successful transfer e 1 Illegal starting offset e 2 Illegal length Word integrity is guaranteed during this transfer File integrity is not Handshaking bits can be used in your application program to provide file integrity Syntax PUSH starting word offset in DH485 interface file PUSH number of words to be transferred CALL 84 POP transfer status Example gt 1 REM EXAMPLE PROGRAM gt 40 PUSH 0 REM OFFSET ADDRESS 0 gt 50 PUSH 32 REM WORD OFFSET 32 gt 60 CALL 84 REM TRANSFER THE DATA TO THE BASIC INPUT BUFFER gt 70 POP R REM GET THE OUTPUT ARGUMENT gt 80 IF R lt gt 0 THEN PRINT TRANSFER ERROR CODE R REM PRINT ERROR READY gt RUN READY gt Publication 1746 RM001A US P 13 20 CALL 90 Read Remote Input Functions DH485 Data File to BASIC Input Buffer Publication 1746 RM001A US P Purpose Use CALL 90 to read up to 40 words from the designated node address file number file type and element offset of a remote
67. only works if you have enabled software handshaking on the program port Syntax CTRL S Example gt LIST 1 REM EXAMPLE PROGRAM 10 A 1 20 DO CTRL S CTRL Q 30 A Atl 40 PRINT A 50 WHILE A lt 20 READY gt In this example the output is suspended when CTRL S is pressed The output is continued after CTRL Q is pressed Publication 1746 RIM001A US P 4 8 BASIC Commands Control 0 EDIT Publication 1746 RM001A US P Purpose Use the CTRL Q command to restart a LIST command or PRINT output that is interrupted by CTRL S Syntax CTRL Q Example gt LIST 1 REM EXAMPLE PROGRAM 10 A 1 20 DO CTRL S CTRL Q 30 A A 1 40 PRINT A 50 WHILE A lt 20 READY gt In this example the output is suspended when CTRL S is pressed The output is continued after CTRL Q is pressed Purpose Use the EDIT command to access the BASIC line editor Use this editor to edit a line of the current program in RAM Table 4 2 lists the BASIC editor operations ERASE Table 4 2 BASIC Editor Operations BASIC Commands 4 9 Operation Function Key Strokes Move Use the Move operation to provide Space bar moves the cursor one right left cursor control space to the right Backspace moves the cursor one space to the left Replace Use the Replace operation to replace Press the key that corresponds to the the character at the current cursor char
68. parameters for port DH485 BASIC Commands 4 13 Table 4 3 PRT1 and PRT2 Port Parameters Port Parameters Selections Default Settings baud rate 300 600 1200 2400 4800 9600 19200 1200 arg1 parity None N Even E Odd 0 N arg2 number of data bits 7 or 8 8 arg3 number of stop bits 1 or 2 1 arg4 handshaking No handshaking N S Software handshaking S Hardware handshaking H Hardware and software handshaking B argh storage type Store information in user ROM and RAM E R Store information in battery backed RAM R MEITSIT lE ny argument other than port name and baud rate is left blank then that argument defaults to the previously specified value for that argument Table 4 4 DH485 Port Parameters Port Parameters Selections Default Settings baud rate 300 600 1200 2400 4800 9600 19200 19200 arg1 host node address 0 to 31 0 arg2 module node address 0 to 31 1 arg3 maximum node address 1 to 31 31 arg4 not used arg5 storage type Store information in user ROM and RAM E R Store information in battery backed RAM R These lE any argument other than port name is left blank then that argument defaults to the previously specified value for that argument Syntax MODE port name baud rate arg arg2 arg3 arg4 arg5 Publication 1746 RIM001A US P 4 14 BASIC Commands NEW NULL Publication 1746 RM001A US P Example
69. point number The range of the module floating point number is 1E7 to 99999999E 7 Publication 1746 RIM001A US P 9 6 Math and Backplane Conversion Functions Publication 1746 RM001A US P SLC floating point numbers are stored in two 16 bit words IMPORTANT Due to the fact that the SLC floating point number is a 7 digit floating point number and the module is an 8 digit floating point number some round off error may be introduced during number conversions Syntax This routine has one input and one output argument The input argument is the address of the module s input buffer containing the value to be converted Addresses 100 163 are from the MO file and 200 207 are from the SLC Output Image The output argument is the converted value PUSH input buffer of value to be converted CALL 89 POP converted value Example gt 50 PUSH 2 REM Transfer 2 words 1 floating point value from MO file to BASIC input buffer for conversion gt 60 CALL 56 REM Transfers data from MO file to BASIC input buffer gt 70 POP 5 REM Status for CALL 56 gt 80 PUSH 100 REM module input buffer address gt 90 CALL 89 gt 100 POP C REM The variable C will contain the converted value Chapter 10 Clock Calendar Functions This chapter describes and illustrates commands that set and display the real time clock calendar within the BASIC program or from the command line Table 10 1 lists the corresponding mnemonics
70. read is placed into the input word 1 bits 0 7 The possible status codes are shown in Table 13 12 The status is valid when the module sets the input file word 0 bit 10 Table 13 12 Transaction Status Codes Code indicates 0 flransferOK 1 Transmission failed 2 Enquiry timeout 3 With handshaking selected either a loss of CTS signal while transmitting or a fatal transmitter failure occurred Without handshaking selected a fatal transmitter failure occurred 4 Transmission failure due to modem disconnection DCD signal loss for more than 10 seconds if modem handshaking with constant carrier is selected 5 DF1 driver is not enabled 6 Message timed out 81 Illegal command or format 82 Host has a problem and will not communicate 83 Remote station host is not there disconnected or shut down 84 Host could not complete function due to hardware fault 85 Addressing problem or memory protect rungs 86 Function disallowed due to command protection selection 87 Processor is in Program mode 88 Compatibility mode file missing or communication zone problem 89 Remote station cannot buffer command 8B Remote station problem due to download 8C Local station cannot execute command due to active IPBs C1 Illegal address format field has an illegal value C2 Illegal address format not enough fields specified C3 Illegal address format too m
71. remote node address USH remote file number USH remote file type USH starting word offset of remote file USH number of words to be transferred USH message time out value USH selection of destination file USH word offset within destination file USH string number OP CALL 27 status Transfer data from a remote DH485 data file to the SLC processor CALL 28 USH type of WRITE command USH remote node address USH remote file number USH remote file type USH remote starting word offset USH number of words to be transferred USH message time out value USH selection of source file USH word offset within source file USH string number OP CALL 28 status Transfer data from the SLC processor to a remote DH485 data file CALL 29 U USH CALL 27 28 122 or 123 for the CALL you want activated POP status of transaction Handle all errors that are not handled by the ONERR statement CALL 30 PUSH bits per word PUSH parity enable PUSH number of stop bits PUSH software handshaking enable disable PUSH hardware handshaking enable disable Set PRT2 port parameters CALL 31 None Display current PRT2 port setup CALL 35 POP ASCII value of character Get numeric input character from port PRT2 CALL 36 PUSH buffer selection POP number of characters Get number of characters in PRT2 buffers CALL 37 PUSH buffer s
72. save memory ITST 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 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 e single dimension expression example J 4 G A 6 I 10 SIN X e number followed by a single dimension expression example A1 8 P7 10 SIN X W8 A C e number 0 to 9 or letter example AA AC XX Al X3 G8 except for the following combinations CR DO IE IF IP ON PI SP TO UI UO IMPORTANT Reserved words words already used in BASIC functions or statements cannot be used as variable names Variable Types Type declaration characters indicate
73. status Example gt 1 REM EXAMPLE PROGRAM gt 10 CALL 80 gt 20 POP C gt 30 IF C lt gt 0 THEN PRINT BATTERY LOW gt 40 END READY gt RUN BATTERY LOW Purpose Use CALL 86 to determine if the DH485 Common Interface File located in the module has been updated since the last time it was checked This routine has no input arguments and one output argument The output argument is equal to e 0 ifa device on the DH485 Serial Communications Link has not written to the DH485 Serial Common Interface File since the last time this CALL was executed or since the module was powered up whichever occurred last e 1 ifa device on the DH485 Serial Communications Link has written to the DH485 Common Interface File since the last time this CALL was executed or since the module was powered up whichever occurred last Syntax CALL 86 POP DH485 interface file remote write status Example gt 1 REM EXAMPLE PROGRAM gt 100 CALL 86 REM CHECK FILE STATUS CALL 87 Check DH485 Interface File Remote Read Status Status Functions 11 9 gt 110 POP X REM GET THE STATUS gt 120 IF X lt gt 1 THEN GOTO 100 REM WAIT ON THE DATA READY gt Purpose Use CALL 87 to determine if the DH485 Common Interface File located in the module has been read by a device on the DH485 Serial Communications Link since the last time it was checked This routine has no input arguments and one output argument The output argument is e
74. subroutines using the same variable names example GLOBAL VARIABLES If you cannot use the same variables in a subroutine as in the main program you can re assign a number of variables example A Q before a GOSUB statement is executed If you reserve some variable names just for subroutines S1 S2 and pass variables on the stack as shown in the previous example you can avoid any GLOBAL variable problems in the module The PUSH and POP statements accept dimensioned variables A 4 and S1 12 as well as scalar variables This is useful when using CALL routines in which large amounts of data must be PUSHed or POPped as shown below gt 1 REM EXAMPLE PROGRAM gt 40 FOR I 1 TO 64 gt 50 PUSH I gt 60 CALL 10 gt 70 POP A I gt 80 NEXT I Publication 1746 RIM001A US P 8 18 Execution Control and Interrupt Support Functions RETI RETURN Publication 1746 RM001A US P Purpose Use the RETI statement to exit from an interrupt ONTIME CALL 16 or CALL 20 that is processed in a module program The RETI statement functions the same as the RETURN statement except that it also clears a software interrupt flag so interrupts can again be acknowledged If you fail to execute the RETI statement in the interrupt procedure all future interrupts are ignored Syntax RETI Example gt 1 REM EXAMPLE PROGRAM gt 10 TIME 0 CLOCK1 ONTIME 2 100 DO gt 20 WHILE TIME lt 10 END gt 100 PRINT TIMER INTERRUPT AT TIM
75. the module output buffer written to the remote device starting at word 0 and filling as many words as specified by the element length of the message Upon return from the CALL the output argument specifies the status of the message instruction Table 12 6 defines the output argument Publication 1746 RIM001A US P 12 20 Output Functions Publication 1746 RM001A US P Table 12 6 Output Argument Decimal Hexadecimal Description Output Output 0 00 Successful Completion 2 02 Target node cannot accept the message at this time 3 03 Target node cannot respond because message is too large 4 04 Target node cannot respond because it does not understand the command parameters 5 05 module is off line not on link 6 06 Target node cannot respond because requested function is not available 7 07 Target node does not respond 10 0A module detects illegal target node address 11 0B module detects illegal file number 12 OC module detects illegal target file element offset 13 oD module detects illegal target file length 14 OE module detects illegal time out value 16 10 Target node cannot respond because of incorrect command parameters or unsupported command 55 37 Message timed out time out value exceeded 80 50 Target node is out of memory 96 60 Target node cannot respond because file is protected 231 E7 Target node cannot respond because length requested
76. the output image buffer since the last time this CALL was executed or since the module was powered up whichever occurred last e 1 ifthe Logic Processor has written to the output image buffer since the last time this CALL was executed or since the module was powered up whichever occurred last e 2 if the Logic Processor does not support this capability as with the SLC 5 01 processor Syntax CALL 51 POP output image buffer status Example gt 1 REM EXAMPLE PROGRAM gt 120 CALL 51 REM WAIT ON SLC gt 130 POP S gt 140 IF S 2 THEN PRINT THE SLC DOES NOT SUPPORT THIS FUNCTION gt 150 IF S 2 THEN STOP gt 160 IF S 0 THEN GOTO 120 gt 170 PRINT OUTPUT IMAGE HAS BEEN UPDATED READY gt RUN THE SLC DOES NOT SUPPORT THIS FUNCTION STOP IN LINE 160 READY Publication 1746 RM001A US P 11 4 Status Functions CALL 55 Check CPU Input Image Buffer Publication 1746 RM001A US P Purpose Use CALL 55 to determine if the SLC 500 controller input image buffer located in the module has been read by the Logic Processor since the last time it was checked This routine has no input arguments and one output argument The output argument is equal to e 0 if the Logic Processor has not read from the input image buffer since the last time the CALL was executed or since the module was powered up whichever occurred last e 1 if the Logic Processor has read from the input image buffer s
77. to convert a module floating point value between 0 and 65535 to its 16 bit binary representation The resulting value is then stored in the module output buffer The first value PUSHed is the data to be converted The second value PUSHed is the address number 0 to 207 of the word in the module output buffer IMPORTANT an attempt is made to write to word 200 of the BASIC output uffer an error message is displayed and the module returns to Command mode The bits of word 200 are defined The fractional part of the module floating point value is truncated If the module floating point value is less than 0 then the value placed in the module output buffer is 0 If the value is greater than 65535 then the value placed in the module output buffer is 65535 The programmer is responsible for checking the range of the number before conversion Syntax PUSH value to be converted PUSH word number of module output buffer CALL 25 Publication 1746 RM001A US P 9 4 Math and Backplane Conversion Functions CALL 88 BASIC Floating Point to SLC Floating Point Publication 1746 RM001A US P Example gt 1 REM EXAMPLE PROGRAM gt 40 PUSH 9E 1 REM THE VALUE TO BE CONVERTED gt 50 PUSH 0 REM 1ST WORD OF BASIC OUTPUT BUFFER gt 60 CALL 25 REM DO F P TO 16 BIT BINARY CONVERSION gt READY Purpose This CALL may only be used with a SLC 5 03 5 04 or 5 05 processor These are the only SLC processors that support the float
78. to the CPU input image buffer CALL 54 12 15 Transfer module output buffer to the CPU M1 file CALL 57 12 16 Transfer module output buffer to the DH485 interface file CALL 85 12 17 Write module output buffer to the remote DH485 data file CALL 91 12 18 Write module output buffer to the remote DH485 interface file CALL 93 12 22 Print current PRT1 port setup CALL 94 12 24 Clear port PRT1 input and output buffers CALL 96 12 24 User LED control CALL 112 12 25 Transmit the DF1 packet CALL 114 12 26 Check the DF1 XMIT status CALL 115 12 27 Write to a PLC data file CALL 123 12 28 Print hex value with zero suppression to the console device PHO 12 37 Print hex value with zero suppression to PRT2 PHO 12 37 Print hex value with zero suppression to PRT1 PH0 12 37 Print hex value with no zero suppression to the console device PH1 12 37 Print hex value with no zero suppression to PRT2 PH1 12 37 Print hex value with no zero suppression to PRT1 PH1 12 37 Print variables strings or literals to the console device P is PRINT 12 35 shorthand for print Print to port PRT2 PRINT 12 35 Print to port PRT1 PRINT 12 35 Print carriage return PRINT CR 12 36 Print spaces PRINT SPC 12 36 Print tabs PRINT TAB 12 36 Print numeric values in scientific notation PRINT USING Fx 12 36 Publication 1746 RIM001A US P 12 2 Output Functions CALL 23 Transfer Data from the CPU Files to Port 1 or 2 Publication 1746 RM00
79. transferred PUSH message time out value CALL 92 POP status of message instruction Publication 1746 RM001A US P CALL 117 Get DF1 Packet Length Input Functions 13 25 Example gt 1 REM EXAMPLE PROGRAM gt 30 PUSH 1 REM REMOTE NODE ADDRESS 1 gt 40 PUSH 0 REM OFFSET 0 gt 50 PUSH 10 REM WORD LENGTH 10 gt 60 PUSH 5 REM TIME OUT VALUE 0 5 SECONDS gt 70 CALL 92 gt 80 POP R REM GET THE OUTPUT ARGUMENT gt 90 IF R lt gt 0 THEN PRINT READ ERROR CODE IS R REM PRINT ERROR READY gt RUN READ ERROR CODE IS 5 Purpose Use CALL 117 to get the length of the DF1 data packet This routine has no input arguments and one output argument The output argument returns the length of the oldest DF1 packet queued up in the DF1 receive buffer TTP Ge the receive buffer is found empty then 0000 is returned to the argument stack When CALL 117 is read in a program the module checks to see if DF1 communications has been enabled through CALL 108 If DF1 communications have not been enabled an error message is printed to the console device and the module enters Command mode After the length of the DF1 packet has been retrieved it must be used in conjunction with the GET statement to retrieve the data in the received DF1 packet Syntax CALL 117 POP length of DF1 packet Example gt 1 REM EXAMPLE PROGRAM gt 10 CALL 117 gt 20 POP X gt 30 END Publication 1746 RIM001A US
80. type PROG the module displays the number in the EEPROM FILE the program occupies Programming takes only a few seconds Syntax PROG Example gt LIST 1 REM EXAMPLE PROGRAM 10 FOR I 1 TO 10 20 PRINT I 30 NEXT I 40 END READY gt PROG ROM 12 Programming sequence successful READY gt ROM 12 gt LIST 1 REM EXAMPLE PROGRAM 10 FOR I 1 TO 10 20 PRINT I 30 NEXT I 40 END READY gt The program just placed in the EEPROM is the 12th program stored Publication 1746 RIM001A US P 4 16 BASIC Commands PROG1 Publication 1746 RM001A US P Tae lE vou exceed the available EEPROM space you cannot continue programming until it is erased Use the ERASE command to erase the last program stored in EEPROM Be sure to use CALL 81 or CALL 82 to determine memory space prior to programming your EEPROM Refer to chapter 5 for information regarding CALLs 81 and 82 MATAA Before you attempt to program an EEPROM read the PROG PROGI and PROG2 sections of this chapter Purpose Use the PROG1 command to program the resident EEPROM with port information for all three ports as well as store MTOP information At module powerup the module reads this information and initializes MTOP and all three serial ports The sign on message is sent to the console immediately after the module completes its reset sequence If the baud rate on the console device changes you must re program the EEPROM to make the module compatible with t
81. valid data and status are available Input File Word 0 Bit 10 SLC Processor SLC Backplane BASIC or BASIC T Module 6 The SLC retrieves the data and status from the buffer and resets output file word 0 bit 10 to inform the module that data was received Reset Output File Word 0 Bit 10 SLC Processor SLC Backplane _ BASIC or BASIC T Module 7 The module resets the input file word 0 bit 10 on the same end of scan cycle in which the output file word 0 bit 10 was reset Reset Input File Word 0 Bit 10 SLC Processor SLC Backplane BASIC or BASIC T Module The SLC processor must not set then reset the output file word 0 bit 10 on the same ladder logic cycle If this occurs the module may miss the bit being set This CALL is active until it is re executed with different input parameters This CALL has ten input arguments and one output argument The first input argument is the type of PLC READ command issued e 0 Disable the previously executed CALL e 2 Common interface file PLC 2 unprotected READ command e 3 PLC 3 file word range READ command e 5 PLC 5 file typed READ command The second input argument is the node address of the remote PLC device 0 through 255 If the number is not within this range the status equals 2 and the read message does not occur Publication 1746 RM001A US P Input Functions 13 33 The third input argument is the file number to be read on the PLC remo
82. 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 RIM001A 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 Absolutevalue ABS a 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 DBY 3 16 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 LEN 3 15 program Natural log LOG 3 11 Read the last valid memory address MTOP 3 16 One s complement NOT
83. 0 Print PRT2 Output Buffer Pointer 5 8 CALL 111 Print PRT2 Input Buffer Pointer 5 8 Chapter 6 CLEAR aerate e ae outea ona tana Hts oa A ante einer 6 1 GT andes nn gh oss ot ant hacks tine OEE 6 3 CER estes GnGut hada nausea enh ah dt cashed de Ante ae 6 3 1DE goes ls de tes aegis dar cet adic tain ge neg delaras a eacite TE 6 4 BIN is in tet Satan Ade att yA a E bcs ial Bi anan Eei 6 4 E A a NACE cet Ah E a eee Ie aA AD Use EOE 6 5 PUB SOR Bag cig Ait Sa cine Gt okt th alas eel ca ds TE sg e 6 7 Chapter 7 CLOCKI Paci dd Nr esha te tad de ge ca nae tara aa D E edn 7 1 CLOCK vita eruies Mae eng enpa chherageease needa thes 7 2 DOS ee Gaiety aaae btn dome dudde tet Mee 7 3 DONI esoe ee ae A ODIAR 7 4 S e E E E uae hoes tet E A N 7 5 FORTOASTEPNEXT era rn AEAN led a ake 76 GOTO oi weed beer ee ice tae Meena ee ie ea oA eee 7 7 I THEN ELS Ee escorts stg a mia adeat a apie wR ana Palace ier gly eae 7 8 Table of Contents iii NEX Fanci a Gk a oes Bea E eae Gad E N EG 7 9 ON GOTO 5 accede were ha Ge Ra Ro aria Rand E EES 7 11 Chapter 8 Execution Control and CALL 16 Enable DF1 Packet Interrupt 0 cece cece eeees 8 2 Interrupt Support Functions CALL 17 Disable DF1 Packet Interrupt 520245 8 3 CALL 20 Enable Processor Interrupt 214 4 serine eviews 8 3 CALL 21 Disable Processor Interrupts scan Si idax oda Seen 8 4 CALL 26 Moduledntertipt 2 04 ody Glo iteta
84. 0 gt 50 gt 60 gt 100 gt 110 gt 120 REM EXAMPLE PROGRAM TIME 0 DBY 71 0 CLOCK1 ONTIME 2 100 DO WHILE TIME lt 10 END PRINT TIMER INTERRUPT AT TIME SECONDS ONTIME TIME 2 100 RETI READY gt RUN TIMER INTERRUPT AT TIMER INTERRUPT AT TIMER INTERRUPT AT TIMER INTERRUPT AT 2 01 SECONDS 4 015 SECONDS 6 01 SECONDS 8 01 SECONDS TIMER INTERRUPT AT 10 01 SECONDS Purpose Use the CLOCKO zero statement to disable or turn off the free running clock resident on the BASIC module After CLOCKO is executed the special function operator TIME no longer increments CLOCKO is the only module statement that can disable the free running clock CLEAR and CLEARI do not disable the free running clock only its associated ONTIME interrupt Tanita CLOCK and CLOCK0 are independent of the clock calendar Syntax CLOCKO Example READY gt CLOCKO DO WHILE Control Functions 7 3 Purpose Use the DO WHILE statement to set up loop control within a module program The operation of this statement is similar to the DO UNTIL rel expr All statements between the DO and the WHILE rel expr are executed as long as the relational expression following the WHILE statement is true You can nest DO WHILE statements The control stack C stack stores all information associated with loop control example DO WHILE DO UNTIL FOR NEXT and BASIC subroutines The control stack is 157 bytes long DO
85. 0 POP POP argument stack to variables 8 17 PRINT Print variables strings or literals to console 2 35 device P is shorthand for print PRINT Print to port PRT2 12 35 PRINT Print to port PRT1 12 35 PRINT CR Print carriage return 12 36 PRINT SPC Print spaces 12 36 PRINT TAB Print tabs 12 36 PRINT Print numeric values in scientific notation 12 36 USING Fx PRINT Print numeric values in decimal notation 2 36 USING PRINT Restore the default print mode 2 37 USING 0 PROG Save the current program in EPROM 7 4 15 PROG Save baud rate information in EPROM i 4 16 PROG2 Save baud rate information in EPROM and 4 17 execute program after reset PUSH PUSH expressions on argument stack 8 15 RAM Evoke RAM mode 4 19 READ READ data in data statement 13 45 Publication 1746 RIM001A US P B 10 BASIC Command Statement and CALL Quick Reference Guide Mnemonic Required PUSHes or POPs Description Active In Page Command Mode Only REM Specify a remark or comment line 4 19 REN Renumber BASIC program 4 20 RESTORE RESTORE read point 6 7 RETI Return from interrupt 8 18 RETURN RETURN from subroutine 8 18 RND Random number 3 11 ROM Select ROM mode i 4 20 RROM Select ROM mode and execute the selected i 4 21 program RUN Execute a program i 4 22 SGN Sign 3 10 SIN Return the sine of argument 3 8 SNGLSTP Initiate s
86. 00 Example gt CALL 111 6E00H 00 6E10H 00 6E20H 00 6E30H 00 6E40H 00 6E50H 00 6E60H 00 6E70H 00 6E80H 00 6E90H 00 6EAOH 00 6EBOH 00 6ECOH 00 6EDOH 00 6EEOH 00 6EFOH 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 Input queue 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 front pointer is 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 PRT2 Input Queue OOH OOH OOH OOH 00 OOH OOH OOH OOH 00 OOH OOH OOH OOH 00 OOH OOH OOH OOH 00 OOH OOH OOH OOH 00 OOH OOH OOH OOH 00 OOH OOH OOH OOH 00 OOH OOH OOH OOH 00 OOH OOH OOH OOH 00 OOH OOH OOH OOH 00 OOH OOH OOH OOH 00 OOH OOH OOH OOH 00 OOH OOH OOH OOH 00 OOH OOH OOH OOH 00 OOH OOH OOH OOH 00 OOH OOH OOH OOH 00 6E00H 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 Command Line CALLs 5 9 OOH OOH OOH OOH OOH OOH OOH OOH OOH OOH OOH OOH OOH OOH OOH OOH OOH OOH OOH OOH OOH OOH OOH OOH OOH OOH OOH OOH OOH OOH OOH OOH OOH OOH OOH OOH OOH OOH OOH OOH OOH OOH OOH OOH OOH OOH OOH OOH OOH OOH OOH OOH OOH OOH OOH OOH OOH OOH OOH OOH OOH OOH OOH OOH OOH OOH OOH OOH OOH OOH OOH OOH OOH OOH OOH OOH OOH OOH OOH OOH Publication 1746 RIM001A US P 5 10 Command Line CALLs Publication 1746 RM001A US P CLEAR Chapter 6 Assignm
87. 01A US P 6 4 Assignment Functions DATA DIM Publication 1746 RM001A US P Purpose Use the DATA statement to specify the expressions that you can retrieve with a READ statement If multiple expressions per line are used you must separate them with a comma Every time a READ statement is encountered the next consecutive expression in the DATA statement is evaluated and assigned to the variable in the READ statement You can place DATA statements anywhere within a program They are not executed and do not cause an error DATA statements are considered chained and appear as one large DATA statement If at anytime all the data is read and another READ statement is executed the program terminates and the message ERROR NO DATA IN LINE XX prints to the console device The module returns to Command mode Syntax DATA Example gt LIST 1 REM EXAMPLE PROGRAM 10 DIM A 4 20 DATA 10 ASC A ASC C 35 627 30 FOR I 0 TO 3 40 READ A I 50 NEXT I 60 FOR J 0 TO 3 70 PRINT A J 80 NEXT J READY gt RUN 35 627 TMP he Ou cannot use the CHR operator in a DATA statement Purpose Use the DIM statement to reserve storage for matrices The storage area is first assumed to be zero Matrices in the BASIC module may have only one dimension and the size of the dimensioned array may not exceed 254 elements Assignment Functions 6 5 LET Once a variable is dimensioned in a program it may not be re dimensioned
88. 1 00018 Rs a A i S D _ DN 10 10 Status OK Buffer Data if Status OK 1 1 0 EQU COP 0002 J E Equal Copy File 10 Source A a Source M1 1 0 0 Dest N10 20 Source B 0 Length 21 Bad Command Status Buffer Status Byte if Non zero NEQ MOV Not Equal Move Source A 1 11 Source 0 Source B 0 Dest 0 CALL 27 Request Bit 0 1 cy Reset Alarm PB 100o Command Failed Indication 1 2 0 B3 0 0 3 0003 c E 0SR_ _ _ yj 0 0 0 0004 CEND gt CALL 29 Read Write to a PLC SLC from the Module Internal String Purpose Use CALL 29 in conjunction with CALLs 122 or 123 to communicate between remote PLCs and the module internal string without local SLC processor interaction You can also use CALL 29 in conjunction with CALLs 27 or 28 to communicate between remote SLCs and the module internal string without local SLC processor interaction CALLs 27 28 122 or 123 must be executed within the BASIC program before CALL 29 CALL 29 is active when the internal string is the only choice in CALLs 27 28 122 or 123 In this situation it is not practical to use the SLC input and output image files to begin the transfer and to pass the status The SLC processor does not need to be involved If an SLC file is chosen instead the local SLC processor controls the transfer with the input and output image bits In this instance a status of 255 is returned when CALL 29 is attempted One argument is PUSHed and one argument is POPped The input argument
89. 123 456 gt 30 PRINT 0123 234 gt 40 PRINT 123 456 2 1 READY gt RUN 4 67 123 45 0 01 0 23 123 45 2 10 READY gt Use the PRINT USING 0 expression to restore the default print mode if the mode was altered by the PRINT USING Fx expression or by the PRINT USING expression Purpose Use the PHO and PH1 statements to direct the module to output a hexadecimal value to the console device These statements function the same as the PRINT statement except that the values are printed out in a hexadecimal format The PHO statement suppresses two leading zeros if the number printed is less than 255 OFFH The PH1 statement always prints out four hexadecimal digits The character H is always printed after the number when PHO or PH1 is used to direct an output The values printed are always truncated integers If the number printed is not within the range of valid integer example is between 0 and 65535 OFFFFH inclusive the module defaults to the normal mode of print If this happens no H prints out after the value Since integers are entered in either decimal or hexadecimal form the statements PRINT PHO and PH1 can be used to perform decimal to hexadecimal and hexadecimal to decimal conversion All comments that apply to the PRINT statement apply to the PHO and PH1 statements Tianhe You must ensure that buffer space is available anytime that you are printing data out of the serial port using hardware hands
90. 1746 RIM001A US P 12 30 Output Functions Publication 1746 RM001A US P The second input argument is the decimal node address of the PLC remote device 0 through 254 If the number is not within this range the status equals 2 and the write message does not occur The third input argument is the file number to be written to on the PLC remote device 0 through 255 If the number is not within this range the status equals 2 and the write message does not occur The parameter is PUSHed but ignored if the common interface file is chosen in the first parameter The fourth input argument is the destination file type on the remote device This number is ignored if the common interface file is chosen in the first parameter assumes integer file If the file type code is not one of these shown below the status equals 2 and the write message does not take place Table 12 9 FileType Written to the Remote Device File Type File Type Code Words Element 1 word 16 bits Integer File ASC N 1 word element Status File ASC S 1 word element Counter File ASC C 3 words element Timer File ASC T 3 words element Bit File ASC B 1 word element Control File ASC R 3 words element Input File ASC I 1 word element Output File ASC 0 1 word element The fifth input argument is the starting word offset within the file on the PLC 2 remote device 0 through 32766 For PLC 3 integer binary or status files the value i
91. 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 lt 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 gt 94 5E 136 A 126 7E 176 31 1F 037 US 63 3F 077 95 5F 137 e 127 7F 177 DEL Publication 1746 RM0 01A US P A 2 Decimal Hexadecimal Octal ASCIl Conversion Table Publication 1746 RM001A US P Mnemonic List Appendix B BASIC Command Statement and CALL Quick Reference Guide description and location The table below lists the various mnemonics found in this manual along with a Overview Mnemonic Required PUSHes or POPs Description Active In Page Command Mode Only ABS Absolute value 3 9 ASC Return integer value of ASCII character 3 12 ATN Return arctangent of argument 3 8 BRKPNT Set program break point 4 2 CALL 14 PUSH word number of module input buffer 16 bit signed integer to BASIC floating point 9 1 POP converted value CALL 15 PUSH word number of module input buffer 16 bit unsigned integer to BASIC floating point 9 2 POP converted value CALL 16 PUSH BASIC line number Enable the interrupt capability when a DF1 8 2 packet is received CALL 17 None Disable the DF1 packet interrupt capability 8 3 CALL 18 None Re enable the CTRL C break function 4 5 CALL 19 None Disable the CT
92. 1A US P Table 12 1 Chapter Reference Guide If you need to Use this i Page mnemonic Print numeric values in decimal notation PRINT USING 12 36 Restore the default print mode PRINT USING 0 12 37 Store variable ST 12 38 Purpose Use CALL 23 to transfer data from the CPU output data file or the CPU M0 file directly to the module serial port and or to a string within the module The data is transferred low byte first then high byte or high byte first then low byte to the module port The data can also be stored in a string for access by the BASIC program The byte swap selection low byte first then high byte or high byte first then low byte of the last CALL 23 or CALL 22 executed determines the data packing method for all ports enabled by CALL 23 The low byte of the first word of the source file contains the character count byte count of the data being transferred If the byte count is larger than the file selected only the maximum number of bytes within the file are transferred The high byte of the first word is not used Execute CALL 23 to set up the data transfer parameters After the CALL is executed the module gets data from the source file and transfers it to port PRT1 port PRT2 or an internal string Input and Output image file bits word 0 bits 6 and 7 for the slot containing the module are used to initiate and notify completion of the transfer The operation is described below 1 T
93. 2 02 Target node cannot accept the message at this time 3 03 Target node cannot respond because message is too large 4 04 Target node cannot respond because it does not understand the command parameters 5 05 module is off line not on link 6 06 Target node cannot respond because requested function is not available 7 07 Target node does not respond 10 0A module detects illegal target node address 11 0B module detects illegal file number 12 OC module detects illegal target file element offset 13 oD module detects illegal target file length 14 OE module detects illegal time out value 16 10 Target node cannot respond because of incorrect command parameters or unsupported command 55 37 Message timed out time out value exceeded 80 50 Target node is out of memory 96 60 Target node cannot respond because file is protected 231 E7 Target node cannot respond because length requested is too large 235 EB Target node cannot respond because target node denies access 236 EC Target node cannot respond because requested function is currently unavailable 241 F1 module detects illegal target file type 250 FA Target node cannot respond because another node is file owner has sole file access 251 FB Target node cannot respond because another node is program owner has sole access to all files Syntax PUSH remote device node address PUSH starting element offset x2 of remote device file PUSH number of words to be
94. 3 IDLE BASIC command 4 70 quick reference guide B 8 IF THEN ELSE control function 7 8 quick reference guide 8 8 INPL input function 73 39 quick reference guide 8 8 INPL input function 13 39 quick reference guide B 8 INPL input function 13 39 quick reference guide 8 8 INPS input function 13 40 quick reference guide 8 8 INPS input function 13 40 quick reference guide B 8 INPS input function 73 40 quick reference guide B 8 INPUT input function 73 40 quick reference guide B 8 INPUT input function 73 40 quick reference guide B 8 INPUT input function 13 40 quick reference guide 8 8 Insert a String in a String 15 8 INT functional operator 3 10 quick reference guide B 8 integer numbers 2 3 Interrupt module 8 4 Interrupt processor See processor interrupt Index vii LD input function 13 43 quick reference guide 8 8 LED user control output function 12 25 LEN quick reference guide B 8 special function operator 3 75 LET assignment function 6 5 quick reference guide B 8 LIST BASIC command 4 77 quick reference guide 8 8 LIST BASIC command 4 72 LIST BASIC command 4 12 LIST quick reference guide B 8 LIST quick reference guide B 8 LOG logarithmic operator 3 77 quick reference guide B 8 logarithmic operators 3 11 EXP 3 11 LOG 3 11 logical operators 3 6 AND 3 6 OR 3 6 XOR 3 6 MO File Status 11 5 M1 File Status 17 6 manuals related P 3 memory mo
95. 3 Port DH485 not enabled DF1 enabled e 4 String is too small e 5 String is not dimensioned e 6 Data packet is too long To disable this CALL a zero must be PUSHed into the first input parameter All other parameters are ignored but must still be PUSHed Whenever an attempt is made to write to a remote node the module places the status of the write into the SLC input file word 1 bits 0 7 The status values have the same definition as the values POPped in CALL 93 Syntax Output Functions 12 11 PUSH type of WRITE command PUSH remote node address PUSH remote file number PUSH remote file type PUSH remote starting word offset PUSH number of words to be transferred PUSH message time out value PUSH selection of source file PUSH word offset within source file PUSH string number CALL 28 POP CALL 28 status Example gt 1 gt 10 gt 20 gt 30 gt 40 gt 50 gt 60 gt 70 gt 80 gt 90 gt 100 gt 110 REM EXAMPLE PROGRAM REM ENABLE INTERRUPTS FOR READ COMMANDS TO A REMOTE DH485 NODE PUSH 2 PUSH 1 PUSH 7 REM SLC TYPED WRITE REM REMOTE SLC NODE NUMBER REM REMOTE SLC FILE NUMBER PUSH ASC N REM REMOTE SLC FILE TYPE PUSH 0 PUSH 20 PUSH 10 PUSH 1 PUSH 0 PUSH 0 EXAMPLE gt 120 gt 130 gt 140 gt 150 gt 160 CALL 28 POP S IF S 1 IF S 2 IF S 3 REM ELEMENT OFFSET INTO DESTINATION FILE REM NUMBER OF ELEMENTS TO BE TRANSFERRED REM
96. 4 OA 33 33 33 33 33 33 34 34 30 93 38 38 38 20 38 20 32 33 33 34 32 33 38 34 number of characters in the buffer to the program port screen No PUSHes or POPs are needed Use this information as a troubleshooting aid It does not affect the contents of the buffer Syntax CALL 104 Command Line CALLs 5 7 Example gt CALL 104 PRT1 Input Queue 6COOH 33H ODH 43H 41H 4CH 4CH 20H 31H 30H 34H 7FH 7FH 7FH 7FH 7FH 7FH 6C10H 7FH 7FH 52H 45H 4DH 20H 45H 58H 41H 4DH 50H 4CH 45H 53H 7FH 7FH 6C20H 7FH 7FH 7FH 7FH 7FH 7FH 7FH 7FH 7FH 7FH ODH ODH ODH ODH ODH ODH 6C30H ODH ODH ODH 45H 58H 41H 4DH 7FH 7FH 7FH 7FH 52H 45H 4DH 20H 45H 6C40H 58H 41H 4DH 50H 4CH 45H 53H 20H 4FH 4EH 20H 50H 41H 47H 45H 20H 6C50H 36H 2DH 37H ODH 43H 41H 4CH 4CH 20H 31H 30H 34H ODH 52H 4DH 41H 6C60H 4EH 54H 20H 7FH 7FH 7FH 54H 20H 44H 41H 54H 41H ODH 52H 45H 4DH 6C70H 20H 54H 48H 45H 52H 45H 20H 49H 53H 20H 4EH 4FH 20H 52H 45H 41H 6C80H 4CH 20H 52H 45H 53H 50H 4FH 4EH 53H 45H 20H 57H 48H 49H 43H 48H 6C90H 20H 57H 49H 4CH 4CH 20H 53H 48H 4FH 57H 20H 55H 50H 20H 49H 4EH 6CAOH 20H 41H 4EH 20H 45H 58H 41H 4DH 50H 4CH 45H ODH ODH ODH ODH ODH 6CBOH 52H 45H 4DH 20H 45H 58H 41H 4DH 50H 4CH 45H 53H 20H 4FH 4EH 20H 6CCOH 50H 41H 47H 45H 20H 36H 2DH 36H ODH 50H 55H 53H 48H 20H 38H 30H 6CDOH 30H 30H 48H 3AH 50H 7FH 7FH 20H 70H 55H 53H 7FH 7FH 7FH 3AH 20H 6CEOH 50H 55H 53H 48H 20H 38H 30H 7FH 30H 34H 46H 48H 20H 3AH 43H 41
97. 4 6 quick reference guide 8 1 CALL 20 Enable Processor Interrupt execution control and interrupt support function 8 3 quick reference guide 8 1 CALL 21 Disable Processor Interrupt execution control and interrupt support function 8 4 quick reference guide 8 1 CALL 22 Transfer Data from Port 1 or 2 to the CPU Files input function 13 2 quick reference guide 8 1 CALL 23 Transfer Data from the CPU Files to Port 1 or 2 output function 12 2 quick reference guide 8 1 CALL 24 BASIC Floating Point to 16 Bit Signed Integer math and backplane conversion function 9 2 quick reference guide 8 2 CALL 25 BASIC Floating Point to 16 Bit Binary math and backplane conversion function 9 3 quick reference guide 8 2 CALL 26 BASIC Module Interrupt execution control and interrupt support function 8 4 quick reference guide 8 2 CALL 27 Read Remote DH485 SLC Data File input function 13 8 quick reference guide 8 2 CALL 28 Write to Remote DH485 SLC Data File output function 12 6 quick reference guide 8 2 CALL 29 Read Write to a PLC SLC from the BASIC Module Internal String input function 13 13 output function 12 13 quick reference guide 8 2 CALL 30 Set PRT2 Port Parameters quick reference guide 8 2 setup function 74 1 CALL 31 Display Current PRT2 Port Setup output function 12 14 quick reference guide B 2 CALL 35 Get Numeric Input Character from PRT2 input function 13 15 quick reference guide B 2 CALL 36 Get Number of Characters in PRT2
98. 5 Purpose Use the PRINT statement to direct the module to output a value to the console device You may print the value of expressions strings literal values variables or text strings You may combine the various forms in the print list by separating them with commas If the list is terminated with a comma the carriage return line feed is suppressed P is a shorthand notation for PRINT Values are printed next to one another with two intervening blanks A PRINT statement with no arguments sends a carriage return line feed sequence to the console device IMPORTANT The BASIC Interpreter terminates the printing of a string if it encounters a NULL 0 or CR 13 character If you want to print strings containing these values print the characters individually inside of a loop construct To suppress the CR LF in the PRINT instruction use a trailing comma Example print A Syntax PRINT Example gt PRINT 10 10 3 3 100 9 gt PRINT 1746 BAS 1746 BAS gt PRINT 5 1E3 5 1000 Tate You must ensure that buffer space is available anytime that you are printing data out of the serial port using hardware handshaking or software handshaking Xon Xoff Failure to do so causes the BASIC program to stop executing while awaiting buffer space When space is available in the buffer the module resumes execution from the point at where it left off The output buffer of each port is capable of holding 256 characters See description
99. 9 is set PORT PRT1 SLC Processor SLC Backplane BASIC or BASIC T Module 5 The module resets the input file word 0 bit 8 or bit 9 on the same end of scan cycle in which the output file word 0 bit 8 or bit 9 was set PORT PRT1 Reset Input File Word 0 Bit 8 or Bit 9 PORT PRT1 SLC Processor SLC Backplane _ BASIC or BASIC T Module Publication 1746 RIM001A US P 13 4 Input Functions Publication 1746 RM001A US P 6 The ladder logic program of the SLC resets output file word 0 bit 8 or bit 9 The module can begin loading the destination buffer with the next packet as data arrives from the port Reset Output File PORT PRT1 Word 0 Bit 8 or gt Bit 9 PORT PRT1 SLC Processor SLC Backplane BASIC or BASIC T Module Data transfers continue until the CALL for the port is re executed with different input parameters If this occurs the previous CALL 22 for the port is automatically disabled and the new CALL 22 takes effect Multiple CALL 22s for the same port are not executed in parallel However port 1 and port 2 can be activated simultaneously by issuing separate CALL 22s This CALL has seven input arguments and one output argument The first input argument is the source port number 1 or 2 of the module A zero disables all previously active CALL 22 commands e 0 Disable CALL 22 for all active ports enabled by earlier CALL 22s e 1 Port 1 is source e 2 Port 2 is source T
100. ALL 68 POP number of characters Example gt 1 REM EXAMPLE PROGRAM gt 10 REM SAMPLE OF STRING LENGTH gt 20 STRING 1 0 10 gt 30 1 1234567 gt 40 PUSH 1 REM BASE STRING gt 50 CALL 68 REM INVOKE STRING LENGTH ROUTINE gt 60 POP L REM GET LENGTH OF BASE STRING gt 70 PRINT THE LENGTH OF 1 IS L gt 80 END READY gt RUN THE LENGTH OF 1234567 IS 7 READY gt STRING String Functions 15 11 Purpose Use the STRING statement to allocate memory for strings Initially no memory is allocated for strings If you attempt to define a string with a statement such as LET 1 HELLO before memory is allocated for strings an ERROR MEMORY ALLOCATION message is generated The first expression expr in the STRING statement is the total number of bytes you want to allocate for string storage The second expression expr gives the maximum number of bytes in each string The second value should not be larger than 254 These two numbers determine the total number of defined string variables The module requires one additional byte for each string plus one additional byte overall The additional character for each string is allocated for the carriage return character that terminates the string This means that the statement STRING 100 10 allocates enough memory for 9 string variables ranging from 0 to 8 and all of the 100 allocated bytes are used Note that 0 is a valid string in the modu
101. ALL through either ports PRT2 or DH485 Both PRT2 and DH485 ports cannot be active at the same time Jumper JW4 is used to make this selection PORT PRT1 q PLC DF1 Network PORT PRT2 a mMM SLC DH485 Network BASIC or BASIC T Module SLC Backplane SLC Processor 2 The module transfers the data into the local SLC destination buffer DESTINATION BUFFER SLC Processor SLC Backplane BASIC or BASIC T Module Input Functions 13 27 The module places the byte count into the lower byte of the first available word of the destination buffer DESTINATION BUFFER SLC Processor SLC Backplane i BASIC or BASIC T Module The module sets the input file word 0 bit 12 to inform the SLC processor that valid data is available Input File Word 0 Bit 12 SLC Processor SLC Backplane _ BASIC or BASIC T Module The SLC processor retrieves the data from the buffer and sets the output file word 0 bit 12 to inform the module that data was received Output File gt Word 0 Bit 12 SLC Processor SLC Backplane BASIC or BASIC T Module The module resets the input file word 0 bit 12 on the same end of scan cycle in which the output file word 0 bit 12 was reset Input File Word 0 Bit 12 SLC Processor SLC Backplane _ BASIC or BASIC T Module The SLC resets output file word 0 bit 12 The module can begin loading the destination buffer
102. Buffers quick reference guide B 2 status function 77 2 CALL 37 Clear PRT2 Input Output Buffers output function 12 15 quick reference guide B 2 CALL 38 Expanded ONERR Restart execution control and interrupt support function 8 5 quick reference guide B 2 CALL 40 Set Clock Calendar Time clock calendar function 70 7 quick reference guide B 3 CALL 41 Set Clock Calendar Date clock calendar function 10 2 quick reference guide B 3 CALL 42 Set Day of Week clock calendar quick reference CALL 43 Retrieve D clock calendar f unction 10 3 guide B 3 ate Time String unction 10 4 quick reference guide 8 3 CALL 44 Retrieve Date Numeric clock calendar function 10 4 quick reference guide 8 3 CALL 45 Retrieve Time String clock calendar function 10 5 quick reference guide 8 3 CALL 46 Retrieve Time Numeric clock calendar function 10 6 quick reference guide 8 3 CALL 47 Retrieve Day of Week String clock calendar function 10 6 quick reference guide 8 3 CALL 48 Retrieve Day of Week Numeric clock calendar function 10 7 quick reference guide 8 3 CALL 51 Check CPU Output Image Buffer quick reference guide 8 3 status function 11 3 CALL 52 Retrieve Date String clock calendar function 10 7 quick reference guide 8 3 CALL 53 Transfer CPU Output Image to BASIC Input Buffer input function 13 17 quick reference guide 8 3 CALL 54 Transfer BASIC Output Buffer to CPU Input Image output function 12 15
103. 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 Chapter 12 CALL 23 Transfer Data from the CPU Files to Port lor2 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 Strine s tui aton vee banaue teecetus cG8s 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 soy 4g goa ek dig Be BS 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 jes i08 eye ance abreast a eae ae 12 22 CALL 94 Display Current PRT1 Port Setup 12 24 CALL 96 Clear PRT1 Input Output Buffers 12 24 CALL 112 User LED Controlovc icv ota toon eee 12 25 CALL 114 Transmit DF1 Packets sc satus Gasket a ais heen 12 26 CALL 115 Check DF1 XMIT Status 2c33e2n42 Ge0e548 12 27 CALL 123 Write to Remote DF1 PLC Data File 12 28 BRUI
104. Day of Week 2 22 26 cSc eee Ge tee beets 10 3 CALL 43 Retrieve Date Time String eckes ota iar ee es 10 4 CALL 44 Retrieve Date Numeticnss avevecd hau aeed eee ews 10 4 CALL 45 Retrieve Time String gin tb daetrahea tee cetatastiar tra wares 10 5 CALL 46 Retrieve Time Numeric 0 2 00 00 0 000000005 10 6 CALL 47 Retrieve Day of Week String 00 10 6 CALL 48 Retrieve Day of Week Numeric 2 05 10 7 CALL 52 Retrieve Date String 2 ig 3 6 Gae evn snes Se Hes Da eee 10 7 Publication 1746 RIM001A US P Table of Contents iv Status Functions Output Functions Publication 1746 RM001A US P 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 Checks M0 Piles ie Ger hk te aig ah ae alk a Meas 11 5 CALL 59 Check M1 Pile iigs a Se aay ie ae Sa a ee SUG 11 6 CALL 75 Check SLC 500 Controller CPU Status 11 7 CALL 80 Check Battery Condition 0000s eee 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 CALE 97 Enable Port PRT2 DTR Signal v2 4 2 sien dee cae 11 11 CALL 98 Disable Port PRT2 DTR Signal 11 11
105. E SECONDS gt 110 ONTIME TIME 2 100 RETI gt RUN TIMER INTERRUPT AT 2 045 SECONDS TIMER INTERRUPT AT 4 045 SECONDS TIMER INTERRUPT AT 6 045 SECONDS TIMER INTERRUPT AT 8 045 SECONDS TIMER INTERRUPT AT 10 045 SECONDS Purpose Use the RETURN statement to return control to the statement following the most recently executed GOSUB STATEMENT Use one return for each GOSUB to avoid overflowing the control stack This means that a subroutine called by the GOSUB statement can call another subroutine with another GOSUB statement Syntax RETURN Execution Control and Interrupt Support Functions 8 19 Examples Simple Subroutine gt 1 REM EXAMPLE PROGRAM gt 10 FOR I 1 TO 5 gt 20 GOSUB 100 gt 30 NEXT I gt 40 END gt 100 PRINT I gt 110 RETURN READY gt RUN Ook WNEe Nested Subroutine gt 1 REM EXAMPLE PROGRAM gt 10 FOR I 1 TO5 gt 20 GOSUB 100 gt 30 NEXT I gt 40 END gt 100 PRINT I gt 110 GOSUB 200 gt 120 RETURN gt 200 PRINT I I gt 210 GOSUB 300 gt 220 RETURN gt 300 PRINT I I I gt 310 RETURN READY gt RUN 1 1 1 2 4 8 3 9 27 4 16 64 5 25 125 READY Publication 1746 RM001A US P 8 20 Execution Control and Interrupt Support Functions STOP Publication 1746 RM001A US P Purpose Use the STOP statement to break program execution at specific points in a program After a program is STOPped you can display or modify variables You can resume program exe
106. EN PRINT UNSUCCESSFUL CALL 118 SETUP gt 100 GOTO 100 running REM CALL 118 stays active while BASIC program is Below is a sample ladder logic program for CALL 118 The module is located in slot 1 of the SLC rack Rung 0000 copies data from the M1 file when the handshake bit 1 1 0 12 is set by the module Rung 2 0 sets the handshake bit O 1 0 12 once the data has been copied out of the M1 file This informs the module to turn off 1 1 0 12 The first word is the byte count A maximum of 20 words of data is expected COP Copy File Source M1 1 0 Dest N7 0 Length 21 Handshake Bit from SLC Processor to Module CALL 122 Read Remote DF1 PLC Data File Publication 1746 RM001A US P Purpose Use CALL 122 to read up to 64 words of data from a remote DF1 node PLC 2 3 or 5 to the CPU input image file the CPU M1 file and or a string within the module The following table lists specific notes when using CALL 122 with the PLC 3 and PLC 5 Table 13 9 PLC Application Notes PLC Notes 3 For timers and counters the file number PUSHed third parameter is the structure number limited to a maximum of 255 words 5 For timer data an element is three 16 bit words stored in the destination file in the following order Control Preset and Accumulator Input Functions 13 31 If an internal string is chosen the first character transaction number is incremented upon a successful r
107. Fe Wane nav ah Oa S 13 45 Chapter 14 CALL 30 Set PRT2 Port Parameters oc seis pos ae DE 14 1 CALL 78 Set Program Port Baud Rate ecn 5 beeen ee ee 14 2 CALL 99 Reset Print Head Pointer 44a s sors ot sees ee 14 3 CALL 105 Reset PRT1 to Default Settings 14 4 CALL 119 Reset PRT2 to Default Settings 14 4 MOD Ed hie ad io teats aaa Canta dene aa elit ea een Sean 14 5 Chapter 15 CALE 60 String Repeat deca te xo deen Co desa ee ae debe 15 1 CALL 61 String Append o2 2o lt nie ni astind e 15 2 CALL 62 Number to String Conversion 004 15 3 CALL 63 String to Number Conversion 2 00 15 4 CALL 64 Find a String in a String vconh Gina eUdace ok es 15 6 CALL 65 Replace a String in a String cag eateteades eo uees 15 7 CALL 66 Insert a String in a String 649 saed ses Ge oid es 15 8 CALL 67 Delete a String in a String o uu ee6 uce 15 9 CALL 68 Find the Length of a String 004 15 10 STRING a Toat tee nate sala Sain aa Regn ee AEA 8 eg ee 15 11 Publication 1746 RM001A US v P Table of Contents vi Decimal Hexadecimal Octal ASCII Conversion Table BASIC Command Statement and CALL Quick Reference Guide Publication 1746 RM001A US P Appendix A Mathematical Conversion Overview Appendix B Mnemonic List Overview Index Who Should Use This Manual Preface Read this preface t
108. Group Technical Communication Dept A602V PO Box 2086 Milwaukee WI 53201 2086 Publication 1746 RIM001A US P Publication 1746 RM001A US P Character Set The BASIC Program Line Chapter 1 Language Elements This chapter introduces you to the elements of a BASIC program These elements include BASIC e line numbers statements commands and operators e line length 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 In 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
109. H 6CFOH 4CH 4CH 20H 31H 30H 31H ODH ODH ODH 43H 41H 4CH 4CH 20H 31H 30H Input queue front pointer is 6C5DH CALL 109 Print Purpose Argument Stack Use CALL 109 to print the top 9 values on the argument stack to the console No PUSHes or POPs are needed Use this information as a troubleshooting aid It does not affect the contents of the argument stack or pointer to the stack Syntax CALL 109 Example gt CALL 109 1C9H OOH OOH OOH OOH OOH OOH 1CFH 00H OOH OOH OOH OOH OOH 1D5H OOH OOH OOH OOH OOH OOH 1DBH 41H 67H 50H OOH OOH 7EH 1E1H 83H 75H OOH OOH OOH 7CH 1E7H 13H 04H OOH OOH OOH 7CH 1EDH 32H 84H 70H OOH OOH 85H 1F3H 32H 76H 80H OOH OOH 85H 1F9H OOH OOH OOH OOH OOH OOH Argument stack pointer is 01FEH Publication 1746 RIM001A US P 5 8 Command Line CALLs CALL 110 Print PRT2 Output Buffer Pointer CALL 111 Print PRT2 Input Buffer Pointer Publication 1746 RM001A US P Purpose Use CALL 110 to print the complete output buffer with addresses front pointer and the number of characters in the buffer to the console device No PUSHes or POPs are needed Use this information as a troubleshooting aid It does not affect the contents of the buffer Syntax CALL 110 Example gt CALL 110 PRT2 Output Queue 6FOOH OOH OOH OOH OOH OOH OOH OOH 00 6F10H OOH OOH OOH OOH OOH OOH OOH 00 6F20H
110. Input Output Buffers CALL 54 Transfer BASIC Output Buffer to CPU Input Image Output Functions 12 15 Purpose Use CALL 37 to clear the peripheral port input and or output buffers Use the following PUSHes to clear the corresponding buffer e PUSH 0 to clear the output buffer e PUSH 1 to clear the input buffer e PUSH 2 to clear both buffers Syntax PUSH buffer selection CALL 37 Example gt 1 REM EXAMPLE PROGRAM gt 10 PUSH 0 REM CLEARS THE OUTPUT BUFFER gt 20 CALL 37 gt 30 END READY gt RUN READY gt Purpose Use CALL 54 to transfer words 200 to 207 of the module output buffer to words 0 to 7 of the CPU input image table This routine has no input arguments and one output argument The output argument is the status of the Logic Processor Word 200 in the BASIC output buffer is reserved and can not be modified This word provides module status information to the SLC 500 processor Bit 15 is the module mode bit It can have one of the following values e 0 BASIC or BASIC T module is in the Run mode e 1 BASIC or BASIC T module is not in the Run mode Bit 14 of word 200 is the EEPROM checksum bit It can have one of the following values e 0 EEPROM checksum is correct e 1 EEPROM checksum is incorrect Publication 1746 RM001A US P 12 16 Output Functions Bit 13 of word 200 is the battery status bit It can have one of the following values e 0 Battery is good e 1 Battery is low Word
111. L 108 1 12 Disable DF1 driver communications CALL 113 1 18 Clear the module input and output buffers CALL 120 1 18 Get the SLC processor program ID number CALL 121 1 19 Publication 1746 RIM001A US P 11 2 Status Functions CALL 36 Get Number of Purpose Characters in PRT2 Buffers Publication 1746 RM001A US P Use CALL 36 to retrieve the number of characters in the chosen buffer of port PRT2 You must PUSH the buffer that you want examined PUSH 1 for the input buffer PUSH 0 for the output buffer One POP is required to get the number of characters Syntax PUSH buffer selection CALL 36 POP number of characters Example gt 1 REM EXAMPLE PROGRAM gt 10 PUSH O REM EXAMINES THE OUTPUT BUFFER gt 20 CALL 36 gt 30 POP X REM GET THE NUMBER OF CHARACTERS gt 40 PRINT NUMBER OF CHARACTERS IN OUTPUT BUFFER IS X gt 50 END READY gt RUN NUMBER OF CHARACTERS IN OUTPUT BUFFER IS 0 READY gt Status Functions 11 3 CALL 51 Check CPU Output Image Buffer Purpose Use CALL 51 to determine if the SLC 500 controller output image buffer located in the module has been updated since the last time it was checked In this case update means that the data was written to these buffers from the CPU even if the data is the same value This routine has no input arguments and one output argument The output argument is equal to e 0 ifthe Logic Processor has not written to
112. LEAR Publication 1746 RM001A US P 6 2 Assignment Functions Publication 1746 RM001A US P Example gt CLEAR gt LIST 1 REM EXAMPLE PROGRAM 10 DIM A 4 20 DATA 10 20 30 40 30 FOR I 0 TO 3 40 READ A I 50 NEXT I 60 FOR J 0 TO 3 70 PRINT A J 80 NEXT J READY gt PRINT A 1 I J 0 0 0 gt RUN 10 20 30 40 READY gt PRINT A 1 I J 20 4 4 gt CLEAR gt PRINT A 1 I J 0 0 0 CLEARI CLEARS Assignment Functions 6 3 Purpose Use the CLEARI statement to clear all of the BASIC evoked interrupts The ONTIME interrupt is disabled after the CLEARI statement is executed CLEARI does not affect the free running clock enabled by the CLOCK1 statement CLOCK0 is the only module statement that can disable the free running clock You can use this statement to selectively DISABLE ONTIME interrupts during specific sections of your BASIC program You must execute the ONTIME statement again before the specific interrupts are enabled Tata Vhen the CLEARI statement is LISTed it appears as CLEARI Syntax CLEARI Example READY gt CLEARI Purpose Use the CLEARS statement to reset all of the stacks The control argument and internal stacks all reset to their initialization values You can use this command to reset the stacks if an error occurs in a subroutine Tata Vhen the CLEARS statement is LISTed it appears as CLEARS Syntax CLEARS Example READY gt CLEARS Publication 1746 RIM0
113. M GET 100 DATUM POINTS gt 30 FOR I 1 TO 100 gt 40 REM GET ANOTHER DATUM gt 50 GOSUB 140 gt 60 REM SUM THE DATA gt 70 GOSUB 170 gt 80 NEXT I gt 90 REM AVERAGE THE DATA gt 100 GOSUB 200 gt 110 REM PRINT RESULT gt 120 PRINT THE AVERAGE VALUE IS AV gt 130 END gt 140 REM THIS SUBROUTINE GENERATES RANDOM DATA gt 150 D RND gt 160 RETURN gt 170 REM THIS SUBROUTINE SUMS THE DATA gt 180 SU SU D gt 190 RETURN gt 200 REM THIS SUBROUTINE AVERAGES THE DATA gt 210 AV SU I gt 220 RETURN READY gt BRKPNT 160 Breakpoint enabled READY gt RUN Publication 1746 RM001A US P BASIC Commands 4 3 STOP IN LINE 160 READY gt PRINT D SU AV 86042573 0 0 gt D 5 gt PRINT D SU AV 5 00 gt CONT THE AVERAGE VALUE IS 48060383 READY gt CONT Purpose Use the CONT command to resume execution of a program stopped by a CTRL C BRKPNT command or a STOP statement If you stop a program by pressing CTRL C on the console device or by execution of a STOP statement you can resume execution of the program by typing CONT If you press CTRL C while CTRL C is enabled it stops the program Use CONT to continue Between the stopping and the re starting of the program you may display the values of variables or change the values of variables However you cannot CONTinue if the program is modified during the STOP or after an error MPR CCTRE C clears all input and output buffers Syntax
114. N gt 30 PRINT TAB 79 gt 40 CALL 99 gt 50 PRINT TAB 41 TIME gt 60 PRINT H M S gt 70 END Publication 1746 RIM001A US P 14 4 Setup Functions CALL105 ResetPRT1to Purpose Default Settings CALL 119 Reset PRT2 to Default Settings Publication 1746 RM001A US P Use CALL 105 to reset the port parameters of port PRT1 to their default settings Table 14 3 lists the default parameters for port PRT1 Table 14 3 PRT1 Port Parameter Default Settings PRT1 Port Parameters Default Setting Baud rate 1200 baud Number of data bits 8 bits Number of stop bits 1 bit Parity No parity Handshaking Software handshaking Syntax CALL 105 Example gt 1 REM EXAMPLE PROGRAM gt 10 CALL 105 Purpose Use CALL 119 to reset port parameters of PRT2 to their default settings Table 14 4 lists the default port parameter settings for port PRT2 Table 14 4 PRT2 Port Parameter Default Settings PRT2 Port Parameters Default Setting Baud rate 1200 baud Number of data bits 8 bits Number of stop bits 1 bit Parity No parity Handshaking Software handshaking Syntax CALL 119 Example gt 1 REM EXAMPLE PROGRAM gt 10 CALL 119 MODE Setup Functions 14 5 Purpose Use the MODE command to set the port parameters of ports PRT1 PRT2 and DH485 Taare You must ensure that buffer space is available anytime that you are printing data out of the serial port usi
115. NERR In num Execution Control and Interrupt Support Functions 8 13 Example gt 1 REM EXAMPLE PROGRAM gt 10 ONERR 500 gt 20 FOR I 5 TO 0 STEP 1 gt 30 PRINT 1 I gt 40 NEXT I gt 50 END gt 500 PRINT ERROR CODE WAS XBY 257 gt 510 END READY gt RUN 2 25 33333333 5 1 ERROR CODE WAS 10 READY gt A GOTO statement can replace the END statement in this example to provide a method of user programmed error recovery Publication 1746 RIM001A US P 8 14 Execution Control and Interrupt Support Functions ON GOSUB ONTIME Publication 1746 RM001A US P Purpose Use the ON GOSUB statement to transfer control to the line s specified by the GOSUB statement when the value of the expression following the ON statement is encountered in the BASIC program Syntax ON expr GOSUB In num In num In num Example gt 1 REM EXAMPLE PROGRAM gt 10 ON Q GOSUB 100 200 300 If Q is equal to 0 control is transferred to line number 100 If Q is equal to 1 control is transferred to line number 200 If Q is equal to 2 control is transferred to line number 300 and so on All comments that apply to GOSUB apply to the ON statement If Q is less than zero an ERROR BAD ARGUMENT message is generated If Q is greater than the line number list following the GOSUB statement an ERROR BAD SYNTAX message is generated The ON GOSUB statement provides conditional branching options within the module pro
116. NS oe co a a ee si Ma gate het a eed oie a A A 12 35 PHO PH Li 03 on vest eA aes 8 acto Banat Gu Wash Sheth ee heal 12 37 Aol E cE Ss Ss PE OL PC EE OS 12 38 Input Functions Setup Functions String Functions Table of Contents 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 Serine tia oo Aico Sik ae Ot ohh tls me atl Uk 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 MO 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 B ffer das ness Ginko eb ee rae tua es Seeds 13 23 CALL 117 Get DF1 Packet Length 42 9 2c e404 doen eee ide 13 25 CALL 118 PLC SLC Unsolicited Writes 0 04 13 26 CALL 122 Read Remote DF1 PLC Data Pile 2 3 sce os004 13 30 GE laces eta tee wde shee eben peek e a e ont coe 13 38 INPE es S428 rh ot RR RG A EEN EEN ea Ra SBE EGR 13 39 INPS raia a dt heaven ab boiueee eee eee ees 13 40 INPUT iieiea L a Beh EA Was Nee at eal Deena chars ck 13 40 Us eee knw eae ee heehee Hawn EEEE ai 8 ie eee ag 13 43 READ a3 rae etd dare tat aS eee eRe
117. OOH OOH OOH OOH OOH OOH OOH 00 6F30H OOH OOH OOH OOH OOH OOH OOH 00 6F40H OOH OOH OOH OOH OOH OOH OOH 00 6F50H OOH OOH OOH OOH OOH OOH OOH 00 6F60H OOH OOH OOH OOH OOH OOH OOH 00 6F70H OOH OOH OOH OOH OOH OOH OOH 00 6F80H OOH OOH OOH OOH OOH OOH OOH 00 6F90H OOH OOH OOH OOH OOH OOH OOH 00 6FAOH OOH OOH OOH OOH OOH OOH OOH 00 6FBOH OOH OOH OOH OOH OOH OOH OOH 00 6FCOH OOH OOH OOH OOH OOH OOH OOH 00 6FDOH OOH OOH OOH OOH OOH OOH OOH 00 6FEOH OOH OOH OOH OOH OOH OOH OOH 00 6FFOH OOH OOH OOH OOH OOH OOH OOH 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 Output queue front pointer is 6F00H Purpose Use CALL 111 to print the complete input buffer with addresses front pointer and the number of characters in the buffer to the console device No PUSHes or POPs are needed Use this information as a troubleshooting aid It does not affect the contents of the buffer Syntax CALL 111 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
118. P 13 26 Input Functions CALL 118 PLC SLC Unsolicited Writes Publication 1746 RM001A US P Purpose Use CALL 118 to allow the module to receive data packets sent by PLC 2 PLC 3 or PLC 5 message instructions on the DF1 network This CALL also sets up the module to receive data packets from an SLC node on the DH485 network Both the DF1 port PRT2 and the DH485 port cannot be active at the same time Jumper JW4 on the module is used to select your port configuration Any write message instruction sent to the module from these PLC SLCs cause the data to be placed in an internal string within the CPU M1 file the CPU input image file and or the module string starting at the designated word offset The low byte of the first word of the destination file contains the character count byte count of the transferred data The high byte of this word is unused If an internal string is chosen the first character contains the byte count The second character transaction number of the internal string is incremented upon successful receipt of a packet to inform the module that new data is in the string The value of this transaction number wraps around from 255 to 0 Execute CALL 118 once After the CALL is executed the module checks the port at the end of each line of BASIC code The module gets new data from the PLC or SLC and transfers it as described below 1 The module receives packets initiated from the PLC SLC configured in the C
119. P Table of Contents ii Command Line CALLs Assignment Functions Control Functions Publication 1746 RM001A US P NUEL eacee sa Eea EAE On EEA CG S a OR Raa 4 14 PROG apeiro rana aE ae ana a y E a a a a E S 4 15 PROGI mesecini ides anie ee A haa AAA a S 4 16 PROG eree riaa E EAER EE AE A AA aed ATE wR 4 17 RAM tad ands ae ace tle a a act a E e aa eaa 4 19 REM ssa teare aa ed aie R ad a a alos Hee O a E AAC eg 4 19 REN senet beer eb eu eee ea ne eed bE eh eae ee AS 4 20 ROM lied ceeds ed Cree hea eae See Shee Shad 4 20 RROM 2 icbceecbcigdobgucieieket thule PaE E E Eas 4 21 RUN derana e pN a ETA e NA E A AAE TAES 4 22 SINGS EP gearra ai ar E EAE EA deleted ied ENA 4 23 MER Seca duoc ke Ow reta cae eases dood ees Brake ae te eae ee Ran geen ee 4 25 SRR ori a tess ecard Seats An atin Abe athe sda Gat te aah uta te gh Sa Ge es 4 26 Chapter 5 CALL 73 Battery Backed RAM Disable 0 00005 5 1 CALL 74 Battery Backed RAM Enable 0000 5 2 CALL 77 Protected Variable Storage 2 2220 ebecuneseee etna 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 PRT 1 Output Buffer and Pointer 5 5 CALL 104 Print PRT1 Input Buffer and Pointer 5 6 CALL 109 Print Argument Statice 222 urea aawle ie ovle aortas 5 7 CALL 11
120. PRINT TAN PI 4 1 gt PRINT TAN 0 0 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 gt PRINT ATN PI 1 2626272 gt PRINT ATN 1 78539804 Functional Operators Expressions and Operators 3 9 Comments on Trigonometric Functions The SIN COS and TAN operators use a Taylor series to calculate the function These operators first reduce the argument to a value between 0 and PI 2 This reduction is accomplished by the following equation reduced argument user arg PI INT user arg PI PI The reduced argument from the above equation is between 0 and PI The reduced argument is then tested to see if is greater than PI 2 If it is then it is subtracted from PI to yield the final value If it is not then the reduced argument is the final value Although this method of angle reduction provides a simple and economical means of generating the appropriate arguments for a Taylor series there is an accuracy problem associated with this technique The accuracy problem is noticed when the user argument is large example greater than 1000 This is because significant digits in the decimal fraction portion of the reduced argument are lost in the user arg PI INT user arg PI expression As a general rule keep the argument
121. Publication 1746 RIM001A US P 13 16 Input Functions Publication 1746 RM001A US P Example 2 gt 1 REM EXAMPLE PROGRAM gt 10 REM PERIPHERAL PORT INPUT USING CALL 35 gt 20 STRING 200 20 gt 30 DIM D 254 gt 40 CALL 35 POP X gt 50 IF X lt gt 2 GOTO 40 gt 55 REM WAIT FOR DEVICE TO SEND START OF TEXT gt 60 REM gt 70 DO gt 80 I I 1 gt 90 CALL 35 POP D I REM STORE DATA IN ARRAY gt 100 UNTIL D I 3 REM WAIT FOR DEVICE TO SEND END OF TEXT gt 120 REM gt 130 REM FORMAT AND PRINT DATA TYPES gt 140 PRINT RAW DATA gt 150 FOR J 1 TO I PRINT D J NEXT J gt 155 REM PRINT RAW DECIMAL DATA gt 160 PRINT PRINT PRINT gt 170 PRINT ASCII DATA gt 180 FOR J 1 TO I PRINT CHR D J NEXT J gt 185 REM PRINT ASCII DATA gt 190 PRINT PRINT PRINT gt 200 PRINT 1 gt 210 FOR J 1 TO I ASC 1 J D J NEXT J gt 215 REM STORE DATA IN STRING gt 220 PRINT 1 gt 230 PRINT PRINT PRINT gt 240 I 0 gt 250 REM gt 260 GOTO 40 READY gt RUN RAW DATA 65 66 67 68 69 70 71 49 50 51 52 53 54 55 56 57 3 ASCII DATA ABCDEFG123456789 1 ABCDEFG123456789 CALL 53 Transfer CPU Output Image to BASIC Input Buffer Input Functions 13 17 Purpose Use CALL 53 to transfer words 0 to 7 of the CPU output image table to words 200 to 207 of the module input buffer This routine has no input arguments and one output argument The output argument is the status of
122. RL C break function 4 6 CALL 20 PUSH BASIC line number Enable the SLC processor interrupt capability 8 3 CALL 21 None Disable the SLC processor interrupt capability 8 4 CALL 22 PUSH source port number Transfer data from PRT1 or PRTZ to the SLC 1 0 13 2 PUSH maximum number of characters to be or M files transferred PUSH decimal value of character delimiter PUSH selection of destination file and or string PUSH word offset within the destination file PUSH string number PUSH byte swap selection POP CALL 22 status CALL 23 PUSH destination port number and or internal Transfer data from the SLC 1 0 or M files to 12 2 string PRT1 or PRT2 U USH selection of source file USH word offset within source file USH string number USH byte swap selection POP CALL 23 status UU U Publication 1746 RM001A US P B 2 BASIC Command Statement and CALL Quick Reference Guide Mnemonic Required PUSHes or POPs Description Active In Command Mode Only Page CALL 24 USH value to be converted USH word number of module output uffer BASIC floating point to 16 bit signed integer 9 2 CALL 25 USH value to be converted USH word number of module output uffer BASIC floating point to 16 bit binary 9 3 CALL 26 OP SLC processor status Generate an interrupt to the SLC processor 8 4 CALL 27 USH type of READ command USH
123. SED HERE gt 60 PUSH 1 REM ENABLE BYTE SWAPPING gt 70 CALL 23 gt 80 POP S REM STATUS OF CALL SETUP gt 90 IF S lt gt 0 THEN PRINT UNSUCCESSFUL CALL 23 SETUP Below is a sample ladder logic program for CALL 23 The module is located in slot 1 of the SLC chassis At rung 0000 copy data to the MO file and set the handshake bit O 1 0 6 to inform the module that new data is available for port PRT 1 Do not send more data until the previous data has been acknowledged by the module The data file for the module begins with the byte count 40 in this example at N7 0 The data follows in N7 1 N7 20 The data byte count word is not included in the data byte count The copy instruction word length is 21 The byte count maximum is 40 bytes 20 words for this example B3 Byte Count is located at N7 0 1 2 0 1 B3 0 COP 0000 E zA OSR Copy File 0 6 0 Source N7 0 Input Switch Handshake Bit from SLC Dest M0 1 0 Processor to Module Length 21 0001 6 Handshake Bit from Module to SLC Processor 0002 CALL 28 Write to Handshake Bit from SLC Processor to Module At rung 2 1 unlatch the handshake bit from the SLC O 1 0 6 for port PRT 1 when the handshake bit from the module is set indicating the module has received the data 0 1 U Handshake BitfromSLC 6 Processor to Module Purpose Remote DH485 SLC Data File Publication 1746 RM001A US P Use CALL 28 to write up to 40 words of d
124. SH 122 gt 40 CALL 29 gt 50 POP S gt 60 IF S 1 THEN PRINT CALL 122 NOT ACTIVE gt 70 IF S 255 THEN PRINT SLC FILE CHOSEN FOR CALL 122 gt 80 IF S 0 THEN PRINT SUCCESSFUL TRANSFER gt 90 IF S lt gt 0 THEN PRINT UNSUCCESSFUL TRANSFER gt 100 END CALL 29 replaces the handshaking bit function in CALLs 27 28 122 and 123 when using an SLC file or module string CALL 35 Get Numeric Input Character from PRT2 Input Functions 13 15 Purpose Use CALL 35 to retrieve the current character in the 256 character input buffer of port PRT72 It returns the decimal representation of the characters received as its output argument Port PRT2 receives data transmitted by your device and stores it in this buffer If there is no character the output argument is a 0 null If there is a character the output argument is the ASCII value of that character There is no input argument for this routine Syntax CALL 35 POP ASCII value of character Examples Example 1 gt 1 REM EXAMPLE PROGRAM gt 10 CALL 35 gt 20 POP X gt 30 IF X 0 THEN GOTO 10 gt 40 PRINT CHR X READY gt RUN A READY gt The above example assumes the PRT2 input buffer contains the ASCII character A IMPORTANT A 0 null is a valid character in some communication protocols Use CALL 36 to determine the actual number of characters in the buffer Tate ruge the buffer before storing data to ensure data validity
125. SLC Unsolicited Writes input function 13 26 PLC SLC Unsolicited Writes CALL 118 13 26 POP 2 1 execution control and interrupt support function 8 17 quick reference guide B 9 PRINT output function 12 35 quick reference guide B 9 print argument stack 5 7 PRT1 Input Buffer and Pointer 5 6 PRT1 Output Buffer and Pointer 5 5 PRT2 Input Buffer Pointer 5 8 PRT2 Output Buffer Pointer 5 8 PRINT CR output function 12 36 quick reference guide B 9 PRINT SPC output function 12 36 quick reference guide B 9 PRINT TAB output function 12 36 quick reference guide B 9 PRINT USING output function 12 36 quick reference guide B 9 PRINT USING Fx output function 12 36 quick reference guide B 9 PRINT output function 12 35 quick reference guide B 9 PRINT output function 12 35 quick reference guide B 9 Processor Interrupt disable 8 4 enable 8 3 PROG BASIC command 4 15 quick reference guide B 9 PROG 1 BASIC command 4 76 quick reference guide B 9 PROG 2 BASIC command 4 17 quick reference guide B 9 Program ID Number 77 79 Protected Variable Storage 5 2 PRT1 clear input output buffers 12 24 display current setup 12 24 get number of characters in buffers 77 70 print input buffer and pointer 5 6 print output buffer and pointer 5 5 reset to default settings 14 4 PRT2 clear input output buffers 12 15 disable DTR signal 77 17 display current setup 12 14 enable DTR signal 77 77 get numeric input character 13 15 print input buffer a
126. STR 5FFFH I 6 gt 60 NEXT I gt 70 REM GET ARRAY gt 80 FOR I 0 TO 9 gt 90 LDR 5FFFH I 6 gt 100 POP B I REM GET NUMBER FROM STACK gt 110 PRINT B I gt 120 NEXT I READY gt RUN 20 21 22 23 24 25 26 27 28 29 READY gt PUSH 5FFFH CALL 77 gt P MTOP 24575 Output Functions 12 39 Publication 1746 RM001A US P 12 40 Output Functions Publication 1746 RM001A US P Input Functions Chapter 13 This chapter describes and illustrates commands that allow the BASIC or BASIC T module to read input data from its external ports within the BASIC program or from the command line Table 13 1 lists the corresponding mnemonics Table 13 1 Chapter Reference Guide If you need to Use this Page mnemonic Transfer data from PRT1 or PRT2 to the SLC 1 0 or M files CALL 22 13 2 Transfer data from a remote DH485 data file to the SLC CALL 27 13 8 processor Handle all errors that are not handled by the ONERR statement CALL 29 3 13 Get a numeric input character from port PRT2 CALL 35 3 15 Transfer the CPU output image buffer to the module input buffer CALL 53 3 17 Transfer the CPU MO file to the module input buffer CALL 56 3 18 Transfer the DH485 interface file to the module input buffer CALL 84 13 19 Read remote DH485 data file to the BASIC input buffer CALL 90 13 20 Read remote DH485 interface file to the module inp
127. Status is sent to code value 5 if the packet in the progress of being transmitted was a data packet RTS is not deactivated when this occurs If DTR is not already active when the DF1 Driver is enabled it is immediately activated It becomes active only if DCD is lost as described in the next paragraph Even after the DF1 Driver is disabled DTR remains active the user may deactivate it via a BASIC CALL For packet receptions the DCD signal is monitored via the DSR input line If DCD is not already active when the DF1 Driver is enabled then it is immediately detected when it does go active At this point DCD is checked every 5 ms to make sure it remains active If it goes inactive the driver waits 10 seconds for DCD to go active again If DCD does not go active again in this amount of time then the DTR output line is deactivated for a period of time ranging from 5 to 10 ms in length Also characters that are received are only accepted if the DCD line is active A packet reception is aborted if DCD goes inactive during the byte to byte reception of that packet Publication 1746 RM001A US P Status Functions 11 17 The second input argument specifies the Poll Time out period when in half duplex mode or the ACKnowledge Time out period when in full duplex mode Poll Timeout specifies in 5 ms increments how long to wait before being polled by the DF1 master before a transmission request is ignored PUSHing 0 indicates no Poll Time out pe
128. TO 110 gt 160 CALL 59 REM START WAITING NOW gt 170 POP S gt 180 IF S 2 THEN PRINT SLC DOES NOT SUPPORT THIS FUNCTION gt 190 IF S 2 THE STOP gt 200 IF S 0 THEN GOTO 170 gt 210 PRINT CALL 59 OUTPUT IS S READY gt RUN CALL 59 OUTPUT IS 1 Status Functions 11 7 CALL75 Check SLC 500 Purpose Controller CPU Status Use CALL 75 to check the mode Run Program Test of the SLC processor No PUSHes are required One POP is required In SLC 5 01 mode of operation the POPped values are e 0 SLC processor in Run mode e 1 SLC processor not in Run mode In SLC 5 02 mode of operation the POPped values are e 0 SLC processor in Run mode e 1 SLC processor in Program mode e 2 SLC processor in Test mode Syntax CALL 75 POP processor mode Example gt 1 REM EXAMPLE PROGRAM gt 100 CALL 75 gt 110 POP S gt 120 IF S 0 THEN PRINT SLC IS IN RUN MODE gt 130 IF S 1 THEN PRINT SLC IS NOT IN RUN MODE gt 140 IS S 2 THEN PRINT SLC IS IN TEST MODE READY gt RUN SLC IS IN RUN MODE READY gt Publication 1746 RIM001A US P 11 8 Status Functions CALL 80 Check Battery Purpose Condition CALL 86 Check DH485 Interface File Remote Write Status Publication 1746 RM001A US P Use CALL 80 to check the module battery condition If a 0 is POPped after a CALL 80 the battery is okay Ifa 1 is POPped a low battery condition exists Syntax CALL 80 POP battery
129. UMBER TO CONVERT TO A STRING N gt 30 PUSH N REM NUMBER TO CONVERT TO STRING gt 40 PUSH 1 REM CONVERT NUMBER TO STRING 1 gt 50 CALL 62 REM DO THE CONVERSION gt 60 PRINT 1 gt 70 END READY gt RUN ENTER A NUMBER TO CONVERT TO A STRING 2E3 2000 READY gt RUN ENTER A NUMBER TO CONVERT TO A STRING 1 233 1 233 READY gt Purpose Use CALL 63 to convert the first decimal number found in the specified string to a number on the argument stack Valid numbers and associated characters are 0 1 2 3 4 5 6 7 8 9 E The comma is not a valid number character and terminates the conversion If the string does not contain a legal value a zero is returned A valid value is between 1 and 255 PUSH the number of the string to convert Two POPs are required First POP the validity of the value then POP the actual value If a string contains a number followed by an E and a letter or non numeric character it is assumed that no number was found since the letter is not a valid exponent CALL 63 returns a zero in the first argument popped indicating that no valid number was in the string Syntax PUSH string number to convert CALL 63 POP validity of the value POP actual value Example gt 1 REM EXAMPLE PROGRAM gt 20 INPUT INPUT A STRING TO CONVERT 1 gt 30 PUSH 1 REM CONVERT STRING 1 gt 40 CALL 63 gt 50 POP V N gt 60 IF V lt gt 0 THEN PRINT 1 N GOTO 80 gt
130. WHILE and DO UNTIL loops and GOSUB commands use 3 bytes of the control stack FOR NEXT loops use 17 bytes Tata Excessive nesting exceeds the limits of the control stack generating an error and causing the module to enter Command mode Syntax DO WHILE rel expr Examples Simple DO WHILE gt NEW gt 1 REM EXAMPLE PROGRAM gt 10 DO gt 20 A A 1 gt 30 PRINT A gt 40 WHILE A lt 4 gt 50 PRINT DONE gt 60 END READY gt RUN wW Ne DONE READY gt Nested DO WHILE gt NEW Publication 1746 RIM001A US P 7 4 Control Functions DO UNTIL Publication 1746 RM001A US P gt 1 REM EXAMPLE PROGRAM gt 10 A 0 C 0 gt 20 DO gt 30 A A 1 gt 40 DO gt 45 C C 1 gt 50 PRINT A C A C gt 60 WHILE C lt gt 3 gt 70 c 0 gt 80 WHILE A lt 4 gt 90 END READY gt RUN 1 1 1 1 2 2 1 3 3 2 1 2 2 2 4 2 3 6 3 1 3 3 2 6 3 3 9 READY gt Purpose Use the DO UNTIL statement to set up loop control within a module program All statements between the DO and the UNTIL rel expr are executed until the relational expression following the UNTIL statement is TRUE You can nest DO UNTIL loops The control stack C stack stores all information associated with loop control example DO WHILE DO UNTIL FOR NEXT and BASIC subroutines The control stack is 157 bytes long DO WHILE and DO UNTIL loops and GOSUB commands use 3 bytes of the control stack FOR NEXT loops use 17 bytes TTD Phe Excessive
131. WORD OF BASIC INPUT BUFFER gt 60 CALL 15 REM DO 16 BIT UNSIGNED INTEGER TO F P CONVERSION gt 70 POP W REM GET CONVERTED VALUE gt 80 PRINT W gt RUN 0 READY Purpose Use CALL 24 to convert a module floating point number to a signed 16 bit integer and place the result in the module output buffer The first value PUSHed is the data variable The second value PUSHed is the address number 0 to 207 of the word in the module output buffer TDP ha am attempt is made to write to word 200 of the BASIC output buffer an error message is displayed and the module returns to Command mode The bits of word 200 are defined The fractional part of the module floating point value is truncated If the module floating point value is less than 32768 the value placed in the module output buffer is 32768 If the module floating point value is greater than 32767 the value placed in the module output buffer is 32767 The programmer is responsible for checking the range of the number before conversion CALL 25 BASIC Floating Point to 16 Bit Binary Math and Backplane Conversion Functions 9 3 Syntax PUSH value to be converted PUSH word number of module output buffer CALL 24 Example gt 1 REM EXAMPLE PROGRAM gt 10 W 17 gt 40 PUSH W REM THE VALUE TO BE CONVERTED gt 50 PUSH 0 REM 1ST WORD OF BASIC OUTPUT BUFFER gt 60 CALL 24 REM DO THE F P TO 16 BIT SIGNED CONVERSION READY gt Purpose Use CALL 25
132. able the previously executed CALL 27 e 1 Common Interface File Read e 2 SLC Typed Read The second input argument is the node address of the SLC remote device 0 through 31 If the number is not within this range the status equals 2 and the read message does not occur The third input argument is the file number on the SLC remote device 0 through 255 If the number is not within this range the status equals 2 and the read message does not occur The parameter is ignored if the Common Interface File CIF is chosen in the first parameter The CIF is always file 9 The fourth input argument is the file type to be read from the remote device This number is ignored if the CIF is chosen in the first parameter assumes integer file If the file type is not one of these listed below the status equals 2 and the read message does not take place Enter the file type code as shown below when you PUSH the fourth input parameter Table 13 2 FileType to be Read from Remote Device File Type File Type Code Words Element Integer File ASC N Mword elemet s C S Counter File ASC C 3 words element Timer File ASC T 3 words element Bit File ASC B 1 word element Control File ASC R 3 words element The fifth input argument is the starting word offset within the file on the remote device 0 through 32766 If the number is not within this range the status equals 2 and the transfer does not occur The SLC 500 pr
133. acter that replaces the character at position the current cursor position Insert Use the Insert operation to insert text Ctr1 A at the current cursor position Important You must press a second Important When you use the Insert Ctr1 a to terminate the Insert operation all text to the right of the command cursor disappears until you press the second Ctr1 A Total line length is 79 characters Delete Use the Delete operation to delete the Ctr1 D character at the cursor position Exit Use the Exit operation s to exit the Ctr1 Q exits the editor and editor with or without saving the replaces the old line with the edited line changes Ctr1 c exits the editor without saving any changes made to the line Retype Use the Retype operation to copy the RETURN current line of text and insert it at the line following the current line The cursor is moved to the first character on the new line Syntax EDIT Example gt EDIT 150 Displays program line number 150 for editing Purpose Use the ERASE command to delete the last BASIC program stored in EEPROM through a PROG command Syntax ERASE Publication 1746 RIM001A US P 4 10 BASIC Commands IDLE Publication 1746 RM001A US P Example gt ERASE gt ROM 13 ERASED The last program stored in EEPROM ROM 13 in this example is erased Purpose Use the IDLE command to force the module to enter wait until Interrupt mode Program execu
134. adetdgeded ne 8 4 CALL 38 Expanded ONERR Restart ca vcene dau estat eared s 8 5 CALL 70 ROM to RAM Program Transfer 00005 8 8 CALL 71 ROM RAM to ROM Program Transfer 8 9 CALL 72 RAM ROM Return ei 0 chad teen aoe eae ees 8 9 GOSUB 2 03 te wich Wrest La Ge ce me aa e ch a GG ts at Derren od ev 8 11 ONERR hte Sa ali Da OE OE T E Ns 2 GAN 8 eg IRN es 8 12 ON GOS UB iid 2 ok e354 nae Ms ene ok ees SER Gee eaes aS 8 14 ONFIME S fiot mie cata a E meatless aig NE E ara dee 8 14 PUSH icre Mii cluas TE EAS okies eee ee clad 8 15 POP oani e Scrau herded San E AMO Od Sa ade tele selene 8 17 RET oss ert gre aide ia Sadar Se see aided eh Shed ea same lode eas 8 18 RE DUR Nieves on te ache eae dee Weis en ae We ad he eth ee 8 18 OR ata eter ne UN ahi ares ON Tie aah Gee ec dhl Bae aiken 8 20 Chapter 9 Math and Backplane CALL 14 16 Bit Signed Integer to BASIC Floating Point 9 1 Conversion Functions 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 Clock Calendar Functions CALL 40 Set Clock Calendar Time n unnur nunnana 10 1 CALL 41 Set Clock Calendar Date 0 0 00 0 aee 10 2 CALL 42 Set
135. any fields specified C4 Illegal address format symbol not found Publication 1746 RIM001A US P 13 36 Input Functions Publication 1746 RM001A US P Table 13 12 Transaction Status Codes Code Indicates C5 Illegal address format symbol is 0 or greater than the maximum number of characters supported by this device C6 Illegal address address does not exist or does not point to something usable in this command C7 Illegal size file is wrong size address is past end of file C8 Cannot complete request Cg Data or file is too large CA Request is too large transaction size plus word address is too large CB Access denied privilege violation CC Resource is not available condition cannot be generated CD Resource is already available condition already exists CE Command cannot be executed CF Overflow histogram overflow DO No access D1 Illegal data type information D2 Invalid parameter invalid data in search or command block D3 Address reference exists to deleted area D4 Command execution failure for unknown reason PLC 3 histogram overflow D5 Data conversion error D6 The scanner is not able to communicate with a 1771 chassis adapter D7 The adapter is not able to communicate with the module D8 The 1771 module response was not valid D9 Duplicated label DA File is open another station owns it DB Another station
136. are accepted if the DCD line is active A packet reception is aborted if DCD goes inactive during the byte to byte reception of a packet Publication 1746 RIM001A US P 11 16 Status Functions Full Duplex With No Handshaking Full duplex with no handshaking selected by operation codes 16 through 23 has the following characteristics The RTS output line is activated when the DF1 Driver is enabled and remains so until the DF1 Driver is disabled e The DTR output line is not manipulated by the DF1 Driver It is recommended that the user activate DTR in his her BASIC program while the DF1 communications is taking place e The CTS and DSR input lines are not monitored or have any effect on transmissions e A transmission monitor guarantees that transmitter interrupts are being generated in a timely manner If a timeout occurs then the DF1_Status is sent to code value 5 if the packet in the process of being transmitted was a data packet RTS is not deactivated when this timeout occurs Full Duplex Modem FDM Full Duplex Modem FDM selected by operation codes 24 through 31 has the following characteristics The RTS output line is activated when the DF1 Driver is enabled and remains so until the DF1 Driver is disabled e An actual transmission does not start until the CTS input is active A transmission monitor guarantees that transmitter interrupts are being generated in a timely manner If a timeout occurs then the DF1_
137. at this time 3 03 Target node cannot respond because message is too large 4 04 Target node cannot respond because it does not understand the command parameters 5 05 module is off line not on link 6 06 Target node cannot respond because requested function is not available 7 07 Target node does not respond 10 0A module detects illegal target node address 11 0B module detects illegal file number 12 OC module detects illegal target file element offset 13 oD module detects illegal target file length 14 OE module detects illegal time out value 16 10 Target node cannot respond because of incorrect command parameters or unsupported command 55 37 Message timed out time out value exceeded 80 50 Target node is out of memory 96 60 Target node cannot respond because file is protected Publication 1746 RIM001A US P 13 22 Input Functions Table 13 7 Output Argument Decimal Hexadecimal Description Output Output 231 E7 Target node cannot respond because length requested is too large 235 EB Target node cannot respond because target node denies access 236 EC Target node cannot respond because requested function is currently unavailable 241 F1 module detects illegal target file type 250 FA Target node cannot respond because another node is file owner has sole file access 251 FB Target node cannot respond because another node is program owner has sole access to all files
138. ata from the CPU output image file CPU M0 file and or a string within the module to the remote DH4835 file at the designated node address Output Functions 12 7 If an internal string is chosen the first character transaction number is incremented on successful completion of the write to inform the module that data was sent The value of the transaction number wraps around from 255 to 0 Execute CALL 28 once to set up the data transfer parameters Input and output image bits word 0 bit 11 for the slot containing the module are used to initiate and notify completion of the transfer The operation is described below 1 The local SLC processor builds the data buffer DATA BUFFER SLC Processor 2 The SLC processor sets output file word 0 bit 11 to inform the module that data can be transferred Output File Word 0 Bit 11 SLC Processor SLC Backplane BASIC or BASIC T Module 3 The module transfers the data into the remote data buffer DESTINATION PORTDH485 gt DATA BUFFER BUFFER SLC Processor SLC Backplane BASIC or BASIC T Module DH485 Network Remote Device 4 The module places the transfer status into the input file word 1 bits 0 7 Input File Word 1 Bits 0 through 7 SLC Processor SLC Backplane _ BASIC or BASIC T Module 5 The module sets the input file word 0 bit 11 to inform the local SLC processor that valid data is transferred and the status of the tra
139. ate CALL 78 14 2 Reset the print head pointer CALL 99 14 3 Reset port PRT1 to the default settings CALL 105 14 4 Reset port PRT2 to the default settings CALL 119 14 4 Set port parameters of ports PRT1 PRT2 and DH485 MODE 14 5 Purpose Use CALL 30 to set the port parameters for port PRT2 Table 14 2 lists the PRT2 port parameters and their selections in the order they are PUSHed on the stack before executing the CALL Table 14 2 PRT2 Port Parameters PRT2 Port Parameters Selections Parity enable 0 Nore 1 Odd 2 Even Number of stop bits 1 1 Stop bit 2 2 Stop bits 3 1 5 Stop bits Software handshaking 0 None 1 XON XOF Hardware handshaking 0 Disabled DCD 1 Enabled DCD Syntax PUSH bits per word PUSH parity enable PUSH number of stop bits PUSH software handshaking enable disable PUSH hardware handshaking enable disable CALL 30 Publication 1746 RIM001A US P 14 2 Setup Functions CALL 78 Set Program Port Baud Rate Publication 1746 RM001A US P Example gt 1 REM EXAMPLE PROGRAM gt 10 REM CALL 30 INPUT PARAMETERS gt 20 REM FIRST PUSH 5 6 7 OR 8 BITS CHARACTER gt 30 REM SECOND PUSH 0 1 OR 2 NO PARITY ODD OR EVEN gt 40 REM THIRD PUSH 1 2 OR 3 1 2 OR 1 5 STOP BITS gt 50 REM FOURTH PUSH 0 OR 1 SOFTWARE HANDSHAKING DISABLE ENABLED gt 60 REM FIFTH PUSH 0 OR 1 HARDWARE HANDSHAKING DISABLED ENABLED gt 70 REM PRT2 DEFAULT
140. ates when a carriage return is seen Use the INPS statement to read an entire string of characters from the PRT2 port buffer Use the INPS statement to read an entire string of characters from the PRT1 port buffer Both these statements function like the INPS statement Syntax INPS string_variable number_of_characters Example gt 1 REM EXAMPLE PROGRAM gt 100 PRINT TYPE P TO PROCEED OR S TO STOP gt 110 REM READ SINGLE CHARACTER FROM PROGRAM PORT gt 120 INPS 0 1 gt 130 IF ASC 0 1 ASC P GOTO 500 gt 140 IF asc 0 1 ASC S GOTO 700 gt 150 GOTO 100 Purpose Use the INPUT statement to enter data from the console device during program execution You may assign data to one or more variables with a single input statement You must separate the variables with a comma Use the INPUT statement to input data from port PRT2 Use the INPUT statement to input data from port PRT 1 Both these statements function like the INPUT statement Input Functions 13 41 Syntax INPUT Examples gt INPUT A C gt INPUT A C causes a question mark to print on the console device This prompts you to input two numbers separated by a comma If you do not enter enough data the module prints TRY AGAIN on the console device gt 1 REM EXAMPLE PROGRAM gt 10 INPUT A C gt 20 PRINT A C gt RUN 1 TRY AGAIN You can write the INPUT statement so that a descriptive prompt tells you what to enter The message p
141. ation from a power up condition using PROGI and PROG or battery backed RAM Syntax PROG2 Example READY gt PROG2 Programming sequence successful Publication 1746 RIM001A US P 4 18 BASIC Commands Figure 4 1 Operation of PROG1 or PROG2 enabled program Y Erase MTOP and port information in battery backed RAM Copy EEPROM MTOP and port information to battery backed RAM Has PROG1 or PROG2 been executed battery backed RAM MTOP and Port information valid Initialize ports using battery backed RAM Store default MTOP and port information in battery backed RAM Print sign on message Print checksum error message Enter command mode checksum correct Has PROG2 been executed Execute ROM1 Is RAM program present Execute RAM program Print sign on message Enter Command Mode Publication 1746 RM001A US P BASIC Commands 4 19 RAM REM Purpose Use the RAM command to tell the module interpreter to select the current program out of RAM The current program is displayed during a LIST command and executed when RUN is typed Tata RAM space is limited to 24K bytes Use the following formula to calculate the available user RAM space Available user RAM MTOP H H LEN S 6 A 8 V 512 Where LEN system control value that contains current RAM program length S number of bytes allocated fo
142. bit signed integer CALL 24 9 2 Convert BASIC floating point to 16 bit binary CALL 25 9 3 Convert BASIC floating point to SLC floating point CALL 88 9 4 Convert SLC floating point to BASIC floating point CALL 89 9 5 Purpose Use CALL 14 to convert an SLC 500 controller 16 bit signed integer number to a BASIC floating point number The input argument is the address number 0 to 207 of the word in the module input buffer to be converted The output argument is the converted value Syntax PUSH word number of module input buffer CALL 14 POP converted value Example gt 1 REM EXAMPLE PROGRAM gt 20 PUSH O REM CONVERT 1ST WORD OF BASIC INPUT BUFFER gt 30 CALL 14 REM DO 16 BIT SIGNED TO F P CONVERSION gt 40 POP W REM GET CONVERTED VALUE gt 50 PRINT W gt RUN 0 READY Publication 1746 RM001A US P 9 2 Math and Backplane Conversion Functions CALL 15 16 Bit Unsigned Integer to BASIC Floating Point CALL 24 BASIC Floating Point to 16 Bit Signed Integer Publication 1746 RM001A US P Purpose Use CALL 15 to convert an SLC 500 controller 16 bit unsigned integer number to a module floating point number The input argument is the address number 0 to 207 of the word in the module input buffer to be converted The output argument is the converted value Syntax PUSH word number of module input buffer CALL 15 POP converted value Example gt 1 REM EXAMPLE PROGRAM gt 50 PUSH 9 REM CONVERT 10TH
143. cannot respond because file is protected 231 E7 Target node cannot respond because length requested is too large 235 EB Target node cannot respond because target node denies access 236 EC Target node cannot respond because requested function is currently unavailable 241 F1 module detects illegal target file type 250 FA Target node cannot respond because another node is file owner has sole file access 251 FB Target node cannot respond because another node is program owner has sole access to all files Syntax PUSH remote device node address PUSH starting element offset x2 of remote device file PUSH number of words to be transferred PUSH message time out value CALL 93 POP status of message instruction Publication 1746 RM001A US P 12 24 Output Functions CALL 94 Display Current PRT1 Port Setup CALL 96 Clear PRT1 Input Output Buffers Publication 1746 RM001A US P Example gt 1 REM EXAMPLE PROGRAM gt 30 PUSH 1 REM REMOTE NODE ADDRESS 1 gt 40 PUSH 0 REM OFFSET 0 gt 50 PUSH 10 REM WORDLENGTH 10 gt 60 PUSH 5 REM THE TIME OUT VALUE 0 5 SECONDS gt 70 CALL 93 REM WRITE DATA FROM BASIC OUTPUT BUFFER gt 80 POP R REM GET THE OUTPUT ARGUMENT gt 90 IF R lt gt 0 THEN PRINT READ ERROR CODE R READY gt RUN READ ERROR CODE 5 READY gt Purpose Use CALL 94 to display the current PRT1 port configuration on the program port terminal screen No arguments are
144. cation 1746 RM001A US P BASIC Command Statement and CALL Quick Reference Guide B 7 Command Mode Only CALL 123 PUSH type of PLC WRITE command Write to a PLC data file 12 28 PUSH remote PLC node address PUSH file number of remote PLC PUSH file type on remote PLC PUSH starting word offset on remote PLC PUSH number of elements to be transferred PUSH message time out value PUSH selection of source file PUSH word offset within source file PUSH string number POP CALL 123 status CBY Retrieve data from specified memory address 3 16 CHR Count value converted ASCII character 3 14 CLEAR Clear variables interrupts amp strings 6 1 CLEARI Clear interrupts 6 3 CLEARS Clear all stacks 6 3 CLOCKO Disable real time clock 7 2 CLOCK1 Enable real time clock 7 1 CONT Continue after a Stop or CTRL C 4 3 CONTROL C Stop execution amp return to Command mode 4 4 CONTROL O Restart a list after CTRL S 4 8 CONTROL S Interrupt a list command 4 7 COS Return the cosine of argument 3 8 DATA Data read by Read statement 6 4 DBY Retrieve or assign data to or from the internal 3 16 data memory of the module DIM Allocate memory for array variables 6 4 DO UNTIL Set up conditional do loop 7 4 DO WHILE Set up a conditional do loop 7 3 EDIT Edit a line of the BASIC program i 4 8 END Terminate program execution
145. ccurs 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 ERROR ARITH OVERFLOW message 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 ERROR ARITH UNDERFLOW 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 gt 10 PRINT 9 0 gt 20 PRINT PROGRAM SHOULD NOT GET HERE READY gt RUN ERROR DIVIDE BY ZERO IN LINE 10 10 PRINT 9 0 gt 10 PRINT 9 9E126 2 gt READY gt RUN ERROR ARITH OVERFLOW IN LINE 10 10 PRINT 9 9E126 2 Publication 1746 RIM001A US P 3 6 Expressions and Operators Logical Operators Publication 1746 RM001A US P 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 OFFFFH inclusive If the argument is outside this range then the mo
146. cking 26 FDM ER Disable DPD CRC Error Checking 27 FDM ER Enable DPD CRC Error Checking 28 FDM ADER Disable DPD BCC Error Checking 29 FDM ADER Enable DPD BCC Error Checking 30 FDM ADER Disable DPD CRC Error Checking 31 FDM ADER Enable DPD CRC Error Checking Publication 1746 RM001A US P 11 14 Status Functions Publication 1746 RM001A US P Half Duplex No Handshaking Modem Control Half duplex no handshaking modem control selected by operational codes 0 through 3 has the following characteristics The RTS output line is activated during transmission but no RTS On Delay or RTS Off Delay is performed e The DTR output line is not manipulated by the DF1 driver It is recommended that you activate DTR in your BASIC program while DF1 communications are taking place e The CTS and DSR input lines are not monitored nor do they have any affect on transmissions or receptions e A transmission monitor guarantees that transmitter interrupts are being generated in a timely manner If a timeout occurs the DF1_Status is set to code value 5 if a data packet was being transmitted Also RTS is immediately dropped when this timeout occurs Half duplex without continuous carrier modem control selected by operational codes 4 through 7 has the following characteristics For proper operation the Data Carrier Detect DCD line from Te Propet oP IMPORTANT the modem must be connected to the DSR input of port PRT2 e Th
147. cle power and press CTRL C before the line that disables CTRL C is executed Publication 1746 RIM001A US P 4 6 BASIC Commands CALL 19 Disable the Control C Break Function Publication 1746 RM001A US P Syntax CALL 18 Example gt 1 REM EXAMPLE PROGRAM gt 10 CALL 19 gt 90 CALL 18 Purpose Disable the cTRL c break function by executing CALL 19 in a module program or from the Command mode When CALL 19 is executed the CTRL C break function for both LIST and RUN operations is disabled Cycling power returns the cTRL C function to normal operation if it is disabled from the Command mode IMPORTANT aga is enabled by default Syntax CALL 19 Example gt 1 REM EXAMPLE PROGRAM gt 10 CALL 19 Control S BASIC Commands 4 7 Purpose Use the CTRL S command to interrupt the scrolling of a BASIC program during the execution of a LIST command CTRL S stops output from the transmitting port if you are running a program In this case XOFF CTRL S operates as follows e XOFF only operates on PRINT statements e When received during a PRINT data output is suspended immediately but program execution continues e When received at any other time the program continues until encountering a PRINT statement At this time data output is suspended The program continues to fill the output buffer until the buffer is full e XON cTRL Q is required to resume data output operation Tee CCZRE S
148. ction The ninth input argument is the word offset within the destination CPU file This offset points to the first word transferred The offset for the internal string is always 1 the transaction number at location 0 followed by the data The transaction number is incremented upon every data transfer and wraps around from 255 to 0 If the CPU input image file is chosen this offset must not be 0 or 1 Zero is reserved for data transfer handshaking bits and word 1 is reserved for the transaction status A 0 or 1 causes an error to be POPped 2 bad input parameter and the CALL is not executed The tenth input argument is the string number If the eighth input argument does not select internal string usage the value of this input argument is ignored but must still be PUSHed The output argument is the status of the CALL It has the following values 0 Successful e 1 Disabled e 2 Bad input parameter e 3 Port DH485 not enabled DF1 enabled e 4 String is too small e 5 String is not dimensioned To disable this CALL a 0 must be PUSHed into the first input parameter All other parameters are ignored but must still be PUSHed Publication 1746 RIM001A US P 13 12 Input Functions Publication 1746 RM001A US P Whenever an attempt is made to read a remote packet the status of the read is placed into input word 1 bits 0 through 7 These values have the same definition as the values POPped in CALL 92 The status become
149. cution with a CONTinue command The purpose of the STOP statement is to allow for easy program debugging Syntax STOP Example 1 STOP IN LINE 40 gt 1 REM EXAMPLE PROGRAM gt 10 FOR I 1 TO 100 gt 20 PRINT I gt 30 STOP gt 40 NEXT I READY gt RUN 1 STOP IN LINE 40 READY gt CONT 2 STOP IN LINE 40 READY gt CONT 3 STOP IN LINE 40 READY gt CONT 4 STOP IN LINE 40 READY gt NOTE The line number printed out after execution of the STOP statement is the line number following the STOP statement not the line number that contains the STOP statement CALL 14 16 Bit Signed Integer to BASIC Floating Point Chapter 9 Math and Backplane Conversion Functions This chapter describes and illustrates commands that convert numbers between integer and BASIC floating point This chapter also describes and illustrates commands that transfer data from the BASIC or BASIC T module output buffer to the processor input image or transfers data from the output image to the module input buffer These commands can be used within the BASIC program or from the command line Table 9 1 lists the corresponding mnemonics Table 9 1 Chapter Reference Guide If you need to Use this mnemonic Page Convert 16 bit signed integer to BASIC floating point ICALI st it iC Convert 16 bit unsigned integer to BASIC floating point CALL 15 9 2 Convert BASIC floating point to 16
150. d We recommend that you make it a remark Syntax PUSH ROM program number CALL 71 Example gt 1 REM EXAMPLE PROGRAM gt 10 REM THIS ROUTINE WILL CALL AND EXECUTE A ROM ROUTINE gt 20 INPUT ENTER ROM ROUTINE TO EXECUTE N gt 30 PUSH N gt 40 CALL 71 gt 50 END gt RUN ENTER ROM ROUTINE TO EXECUTE 4 You are now executing ROM 4 if it exists If the ROM routine requested does not exist the result is PROGRAM NOT FOUND READY gt Purpose Use CALL 72 to return to the ROM or RAM routine that called this ROM or RAM routine Execution begins on the line following the line that CALLed the routine No arguments are PUSHed or POPped This routine works one layer deep Program control reverts to the line following the CALL in the previous program IMPORTANT There must be a next line in the ROM or RAM routine otherwise unpredictable events could occur that may destroy the contents of RAM For this reason always be sure that at least one END statement exists following a CALL 70 or 71 Publication 1746 RM001A US P 8 10 Execution Control and Interrupt Support Functions Publication 1746 RM001A US P Syntax CALL 72 Example Program in ROM 1 gt 1 gt 10 gt 20 gt 30 gt 40 gt 50 gt 60 REM EXAMPLE PROGRAM REM SAMPLE PROG FOR CALL 72 PRINT NOW EXECUTING ROM 1 PUSH 3 CALL 71 REM EXECUTE ROM 3 THEN RETURN PRINT EXECUTING ROM 1 AGAIN END Program in ROM 3 gt 1
151. dley terminology refer to the Allen Bradley Industrial Automation Glossary publication number ICCG 7 1 e Module SLC 500 BASIC and BASIC T Modules catalog numbers 1746 BAS and 1746 BAS T e BASIC development software BASIC Development Software catalog number 1747 PBASE e BASIC the BASIC 52 programming language e 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 e DH485 network communication protocol e EPROM Erasable Programmable Read Only Memory e EEPROM Electrically Erasable Programmable Read Only Memory e memory module BASIC or BASIC T modules EEPROM or UVPROM e 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 e RAM Random Access Memory e ROM Read Only Memory refers to the optional memory module memory space EEPROM or UVPROM e RS 232 423 serial communication interface e RS 422 differential communication interface e RS 485 network communication interface e SCADA Supervisory Control and Data Acquisition e scalar variable a variable with a single value e SLC 500 SLC 500 fixed and modular controller e UVPROM Ultra Violet Erasable Programmable Read Only Memory Conventions Used inthis The following conventions are used thr
152. dule check and description 5 3 map 5 4 MODE BASIC command 4 12 quick reference guide 8 8 setup function 14 5 module interrupt 8 4 Publication 1746 RM001A US P viii Index MTOP quick reference guide 8 8 special function operator 3 16 Multiply arithmetic operator 3 4 quick reference guide B 10 N Negation arithmetic operator 3 4 NEW BASIC command 4 74 quick reference guide B 8 NEXT control function 7 9 quick reference guide B 8 NOT functional operator 3 9 quick reference guide B 8 NULL BASIC command 4 74 quick reference guide B 8 Number to String Conversion 15 3 0 ONERR execution control and interrupt support function 8 12 quick reference guide B 9 ON GOSUB execution control and interrupt support function 8 14 quick reference guide B 9 ON GOTO control function 7 77 quick reference guide B 9 ONTIME execution control and interrupt support function 8 14 quick reference guide B 9 operators 3 2 arithmetic 3 3 functional 3 9 logarithmic 3 17 logical 3 6 special function 3 15 string 3 12 trigonometric 3 8 Overflow and Division by Zero arithmetic operator 3 5 Publication 1746 RM001A US P P PHO quick re erence guide B 9 PH1 quick ref PH1 quick re PH1 quick re PHO quick re PHO PH1 output function 12 37 erence guide B 9 erence guide B 9 E erence guide 8 9 E erence guide 8 9 PI functional operator 3 10 quick reference guide 8 9 PLC
153. dule 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 ORY X XORY 0 0 0 0 0 0 1 0 1 1 10 0 1 1 E 1 1 0 AND Use the logical AND operator to logically AND expressions together Example Result gt PRINT 3 AND 2 2 Use the logical OR operator to logically OR expressions together Example Result gt PRINT 1 0R 4 5 XOR Use the logical exclusive XOR operator to logically XOR expressions together Example Result gt PRINT 7 XOR 6 1 Expressions and Operators 3 7 Relational Operators Relational expressions involve the operators lt gt gt gt lt and lt In the module relational operations are typically used to test a condition The module relational operators return a result of 65535 OFFFFH 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 gt PRINT 1 0 0 gt PRINT 1 gt 0 65535 gt PRINT A lt gt A 0 gt PRINT A A 65535 You can chain relational expressions with the logical operators AND OR and XOR This makes it possib
154. e RTS output line is activated only during transmissions The actual packet transmission starts after the delay specified by the RTS On Delay parameter assuming the CTS input is active by then When the transmission is complete and the delay time period specified by the RTS Off Delay parameter has timed out RTS is deactivated e An actual transmission does not start until the CTS input is active A transmission guarantees that transmitter interrupts are being generated in a timely manner If a timeout occurs then the DF1_Status is set to code value 5 if the data packet was being transmitted RTS is dropped immediately when this occurs e If not already active the DTR line is raised when the DF1 Driver is enabled Even after the DF1 Driver is disabled it wi remain active the user may deactivate it via a BASIC Call e Characters that are received only are accepted if the DCD line is active A packet reception is aborted if DCD goes inactive during the byte to byte reception of that packet There is no constant monitoring of DCD even between packets as there is with the constant carrier selection Therefore the DTR line is never deactivated Status Functions 11 15 Half Duplex With Continuous Carrier Modem Control Half duplex with continuous carrier modem control selected by operational codes 8 through 11 has the following characteristics Tete Fo Proper operation the Data Carrier Detect DCD line from the modem must be connect
155. e a CALL 73 or until the battery fails Syntax CALL 74 Example gt CALL 74 Battery Backup Enabled Tae ia Change CALL 77 from Command mode only to ensure proper operation Purpose Use CALL 77 to reserve the top of RAM memory for protected variable storage Values are saved if BATTERY BACKUP is invoked You store values with the ST command and retrieve them with the LD command Each variable stored requires 6 bytes of storage space You must subtract 6 times the number of variables stored from MTOP reducing available RAM memory This value is PUSHed onto the stack as the new MTOP address All appropriate variable pointers are reconsidered Do this only in Command mode IMPORTANT Do not let the ST address write over the MTOP address This could alter the value of a variable or string The lowest setting MTOP may be set to is 4096 1000H METAAN C2 77 de allocates all the string memory along with the string contents Therefore make sure that you perform this CALL before the execution of the string statement Syntax PUSH new MTOP address CALL 77 Command Line CALLs 5 3 CALL 81 User Memory Module Check and Description Example For saving 2 variables gt PRINT MTOP 24575 gt PRINT MTOP 12 24563 gt PUSH 24563 REM NEW MTOP ADDRESS gt CALL 77 gt 1 REM EXAMPLE PROGRAM gt 10 K 678 PI gt 20 L 520 gt 30 PUSH K gt 40 STR 24575 REM STORE K IN PROTECTED AREA gt 50 PUSH L
156. e accurate time intervals For example if you want to create an accurate 12 hour clock there are 43200 seconds in a 12 hour period so an ONTIME 43200 In num statement is used When the TIME interrupt occurs the statement TIME 0 is executed but the millisecond counter is not re assigned a value If interrupt latency exceeds 5 milliseconds the clock remains accurate BASIC Commands Chapter 4 This chapter describes and illustrates words and expressions that cause a function to occur within the BASIC program or the command line Table 4 1 lists the corresponding mnemonics Table 4 1 Chapter Reference Guide If you need to Use this mnemonic Page Set the program break point BRKPNT 4 2 Re enable the CTRL C break function CALL 18 4 5 Disable the CTRL C break function CALL 19 4 6 Continue after a Stop or CTRL C CONT 4 3 Stop execution amp return to Command mode CONTROL C 4 4 Restart a list after CTRL S CONTROL O 4 8 Interrupt a list command CONTROL S 4 7 Edit a line of the BASIC program EDIT 4 8 Delete the last BASIC program stored in ROM by a PROG ERASE 4 9 command Force the module to enter wait until interrupt mode IDLE 4 10 List the program to the console devise LIST 4 11 List the program to the serial printer LIST 4 12 List the program to the device connected to port PRT1 LIST 4 12 Set port parameters of ports PRT1
157. e console device and the module enters Command mode Syntax PUSH string number to be appended PUSH base string number CALL 61 String Functions 15 3 CALL 62 Number to String Conversion Example gt 1 REM EXAMPLE PROGRAM gt 10 STRING 200 20 gt 20 1 How are gt 30 2 you gt 40 PRINT BEFORE gt 50 PRINT 1 1 gt 60 PRINT 2 2 gt 70 PUSH 2 REM STRING NUMBER TO BE APPENDED gt 80 PUSH 1 REM BASE STRING NUMBER gt 90 CALL 61 REM INVOKE STRING APPEND ROUTINE gt 100 PRINT AFTER gt 110 PRINT 1 1 gt 120 PRINT 2 2 gt 130 END READY gt RUN BEFORE 1 How are 2 you AFTER 1 How are you 2 you READY gt Purpose Use CALL 62 to convert a number or numeric variable into a string You must allocate a minimum of 14 characters for the string If the exponent of the value to be converted is anticipated to be 100 or greater you must allocate 15 characters Error checking traps string allocation of less than 14 characters only There are no output arguments Syntax PUSH number to convert to string PUSH string number to receive the value CALL 62 Publication 1746 RM001A US P 15 4 String Functions CALL 63 String to Number Conversion Publication 1746 RM001A US P Example gt 1 REM EXAMPLE PROGRAM gt 10 STRING 100 14 gt 20 INPUT ENTER A N
158. e module transfers the data into the destination PLC data file PORT PRT2 DATA FILE BASIC or BASIC T Module DF1 Network PLC Publication 1746 RM001A US P Output Functions 12 29 3 The module places the status of the transaction in input file word 1 bits 0 7 Input File Word 1 Bits 0 through 7 SLC Processor SLC Backplane BASIC or BASIC T Module 4 The module sets the input file word 0 bit 11 to inform the SLC processor that the data was transmitted and that the status of the transfer is valid Input File q Word 0 Bit 11 SLC Processor SLC Backplane BASIC or BASIC T Module 5 The SLC retrieves the status and resets output file word 0 bit 11 The data buffer can be reused by the SLC processor Output File Word 0 Bit 11 SLC Processor SLC Backplane BASIC or BASIC T Module 6 The module resets the input file word 0 bit 11 on the same end of scan cycle in which the output file word 0 bit 11 was reset Reset Input File Word 0 Bit 11 SLC Processor SLC Backplane BASIC or BASIC T Module This CALL is active until it is re executed with different input parameters This CALL has ten input arguments and one output argument The first input argument is the type of PLC WRITE command issued e 0 Disable the previously executed CALL e 2 Common interface file PLC 2 unprotected WRITE command e 3 PLC 3 file word range WRITE command e 5 PLC 5 file typed WRITE command Publication
159. e time is POPped in hour minute and second order Syntax CALL 46 POP hour POP minute POP second Example gt 1 REM EXAMPLE PROGRAM gt 10 REM TIME IN VARIABLES EXAMPLE REM GET THE WALL CLOCK TIME gt 20 CALL 46 gt 30 POP H M S gt 40 PRINT CURRENT TIME IS H M S gt 50 END READY gt RUN CURRENT TIME IS 6 43 7 READY gt Purpose Use CALL 47 to return the current day of week as a 3 character string PUSH the number of the string to receive the day of week You must allocate a minimum of 3 characters per string Strings returned are SUN MON TUE WED THU FRI and SAT Syntax PUSH string number CALL 47 Example gt 1 REM EXAMPLE PROGRAM gt 10 STRING 100 20 CALL 48 Retrieve Day of Week Numeric CALL 52 Retrieve Date String Clock Calendar Functions 10 7 gt 20 PUSH 0 CALL 47 gt 30 PRINT TODAY IS 0 READY gt RUN TODAY IS FRI READY gt Purpose Use CALL 48 to return the current day of week on the argument stack as a number example Sunday 1 Saturday 7 This number can be POPped into a variable Syntax CALL 48 POP day of week Example gt 1 REM EXAMPLE PROGRAM gt 10 REM DAY OF WEEK RETRIEVE NUMERIC EXAMPLE gt 20 CALL 48 REM INVOKE UTILITY TO GET D O W gt 30 POP D gt 40 PRINT D gt 50 END READY gt RUN 5 READY Purpose Use CALL 52 to return the current date in a string dd mmm yy PUSH the number of the st
160. ead transaction to inform the module that new data is in the string The value of the transaction number wraps around from 255 to 0 The DF1 port parameters must be set up with CALL 108 The DF1 port can operate with full duplex or half duplex slave protocol Execute CALL 122 once to set up the data transfer parameters Input and output image bits word 0 bit 10 for the slot containing the module are used to initiate and notify completion of the transfer The operation is described below 1 The SLC processor sets the output file word 0 bit 10 to inform the module that READ command configured in CALL 122 should be executed Output File Word 0 Bit 12 SLC Processor SLC Backplane BASIC or BASIC T Module 2 The module issues the appropriate READ command to the PLC The data and status are received from the PLC READ Command 5p _ PORT PRT2 Ene c Data and Status BASIC or BASIC T Module DF1 Network PLC 3 When data is available the module transfers the data into the destination buffer DESTINATION lt BUFFER SLC Processor SLC Backplane BASIC or BASIC T Module 4 The module places the transaction status in the input word 1 bits 0 7 Input File q Word 1 Bits 0 through 7 SLC Processor SLC Backplane BASIC or BASIC T Module Publication 1746 RIM001A US P 13 32 Input Functions 5 The module sets the input file word 0 bit 10 to inform the SLC processor that
161. ed to the DSR input of port PRT2 The RTS output line is activated only during transmissions The actual packet transmission starts after the delay specified by the RTS On Delay parameter assuming the CTS input is active by then When the transmission is complete and the delay time period specified by the RTS Off Delay parameter has timed out RTS is deactivated An actual transmission does not start until the CTS input is active A transmission guarantees that transmitter interrupts are being generated in a timely manner If a timeout occurs then the DF1_Status is set to code value 5 if the data packet was being transmitted RTS is dropped immediately when this occurs If not already active the DTR line is raised when the DF1 Driver is enabled It is dropped only when DCD is lost as described in the next paragraph Even after the DF1 Driver is disabled or remains active the user may deactivate it via a BASIC CALL For packet reception the DCD signal is monitored via the DSR input line If DCD is not already active when the DF1 Driver is enabled then it is immediately detected when it does go active At this point the DCD is checked every 5 ms to make sure it remains active If DCD goes inactive the driver waits 10 seconds for it to go active again If DCD does not go active again in this amount of time then the DTR output line is dropped for a period of time ranging from 5 to 10 ms in length Also characters that are received
162. election Clear port PRT2 input and output buffers CALL 38 PUSH 0 or 1 Initiate transactions defined by CALLs 27 28 122 and 123 Publication 1746 RM001A US P BASIC Command Statement and CALL Quick Reference Guide B 3 Mnemonic Required PUSHes or POPs Description Active In Page Command Mode Only CALL 40 PUSH hours Set clock calendar time hour minute second 10 1 PUSH minutes PUSH seconds CALL 41 PUSH date Set clock calendar date day month year 10 2 PUSH month PUSH year CALL 42 PUSH day of week Set clock calendar day of week 10 3 CALL 43 PUSH string number Retrieve date time string 10 4 CALL 44 POP day Retrieve date numeric day month year 10 4 POP month POP year CALL 45 PUSH string number Retrieve time string 10 5 CALL 46 POP hour Retrieve time numeric 10 6 POP minute POP second CALL 47 PUSH string number Retrieve day of week string 10 6 CALL 48 POP day of week Retrieve day of week numeric 10 7 CALL 51 POP output image buffer status Check CPU output image buffer 1 3 CALL 52 PUSH string number Retrieve date string 10 7 CALL 53 POP processor status Transfer CPU output image buffer to module 13 17 input buffer CALL 54 POP processor mode Transfer module output buffer to CPU input 12 15 image buffer CALL 55 POP input image buffer status Check
163. elements to be transferred PUSH message time out value PUSH selection of source file PUSH word offset within source file PUSH string number CALL 123 POP CALL 123 status Publication 1746 RIM001A US P 12 34 Output Functions Example gt 1 REM EXAMPLE PROGRAM gt 10 REM ENABLE DF1 PLC REMOTE WRITE COMMAND gt 20 PUSH 5 REM PLC 5 FILE gt 30 PUSH 0 REM PLC 5 NODE ADDRESS gt 40 PUSH 7 REM PLC 5 FILE NUMBER gt 50 PUSH ASC N REM PLC 5 FILE TYPE gt 60 PUSH O REM STARTING WORD OFFSET FOR PLC 5 gt 70 PUSH 20 REM NUMBER OF WORDS TO TRANSFER gt 80 PUSH 10 REM COMMAND TIME OUT VALUE X100MS gt 90 PUSH 1 REM USE MO FILE gt 100 PUSH O REM OFFSET WITHIN MO FILE gt 110 PUSH O REM STRING NUMBER NOT APPLICABLE FOR THIS EXAMPLE gt 120 CALL 123 gt 130 POP S REM STATUS OF THE CALL gt 140 IF S lt gt 0 THEN PRINT UNSUCCESSFUL CALL 123 SETUP Input switch to send data to the PLC 5 1 2 0 1 B3 0 CoP 0000 JE JE osR Copy File 0 11 0 Source N7 0 Dest M0 1 0 Length 20 CALL 123 Command Request Bit 0 1 lt gt 11 CALL 123 Command Sent Bit Buffer Status Byte if Non zero 0001 0002 NEQ MOV Not Equal Move Source A Source Source B Dest Command Failed Indication 0 3 CLD 0 CALL 123 Command Request Bi 0 1 l gt 11 Publication 1746 RM001A US P CEND gt PRINT Output Functions 12 3
164. ent Functions This chapter describes and illustrates commands that assign storage reset data storage and values to variables within the BASIC program or from the command line Table 6 1 lists the corresponding mnemonics Table 6 1 Chapter Reference Guide If you need to Use this mnemonic Page Clear variables interrupts amp strings CLEAR o We Clear interrupts CLEARI 6 3 Clear all stacks CLEARS 6 3 Data read by Read statement DATA 6 4 Allocate memory for array variables DIM 6 4 Assign a variable or a string a value LET is optional LET 6 5 RESTORE read pointer RESTORE 6 7 Purpose Use the CLEAR statement to set all variables equal to 0 and reset all BASIC evoked interrupts and stacks This means that after the CLEAR statement is executed an ONTIME statement must be executed before the module acknowledges the internal timer interrupts ERROR trapping with the ONERR statement also does not occur until an ONERR In num statement is executed The CLEAR statement does not affect the free running clock that is enabled by the CLOCK statement CLOCKO is the only module statement that can disable the free running clock CLEAR also does not reset the memory that has been allocated for strings so it is not necessary to enter the STRING exp expr statement to re allocate memory for strings after the CLEAR statement is executed In general CLEAR is used to erase all variables Syntax C
165. equest Bit 0 1 0001 CL gt 10 Buffer Data if Sta 1 1 EQU COP 0002 J E Equal Copy File 10 Source A Source M1 1 0 Dest N10 20 Source B Length 20 Buffer Status Byte if Non zero NEQ MOV Not Equal Move Source A 11 1 Source 1 1 1 0 0 Source B 0 Dest N10 20 0 Command Failed Indication 0 3 e CL 0 CALL 122 Request Bit 0 1 Uy 10 Reset alarm P B Command Failed Indication 1 2 B3 0 0 3 0003 J E OSR CU gt 0 0 0 0004 END gt 4 GET Publication 1746 RM001A US P Purpose Use the GET operator in the Run mode It returns a result of zero in the Command mode The GET operator reads the console input device If a character is available from the console device the value of the character is assigned to GET After GET is read in the program it is assigned the value of zero until another character is sent from the console device Use the GET operator to read port PRT2 and the GET operator to read port PRT1 The following example prints the decimal representation of any character sent from the console device INPL Input Functions 13 39 Syntax GET Example gt 1 REM EXAMPLE PROGRAM gt 10 A GET gt 20 IF A lt gt 0 THEN PRINT A REM ZERO MEANS NO ENTRY gt 30 GOTO 10 gt RUN 65 A 49 1 24 X 50 2 STOP IN LINE 30 READY gt The GET operator is read only once before it is assigned a value
166. erator 3 11 quick reference guide 8 10 Rockwell Automation contacting for assistance P 5 ROM BASIC command 4 20 quick reference guide 8 10 ROM to RAM Program Transfer 8 8 Publication 1746 RM001A US P x Index ROM RAM to ROM Program Transfer 8 9 RROM BASIC command 4 27 quick reference guide B 10 RS 232 network 13 2 RS 422 network 13 2 RS 485 network 13 2 RUN BASIC command 4 22 quick reference guide B 10 S set clock calendar date 10 2 Clock Calendar Time 10 1 Day of Week 10 3 Program Port Baud Rate 14 2 PRT2 Port Parameters 14 1 SGN functional operator 3 10 quick reference guide B 10 SIN quick reference guide B 10 SLC 500 Controller CPU Status 11 7 SLC Processor Program ID Number 11 19 SNGLSTP BASIC command 4 23 quick reference guide B 10 special function operators 3 15 and 3 15 CBY 3 16 DBY 3 16 EOF 3 15 FREE 3 15 LEN 3 15 MTOP 3 16 TIME 3 17 XBY 3 17 SQR functional operator 3 10 quick reference guide B 10 ST output function 12 38 quick reference guide B 10 STOP execution control and interrupt support function 8 20 quick reference guide B 10 Publication 1746 RM001A US P STRING quick reference guide 8 10 string function 15 11 string append 15 2 repeat 15 1 string and numeric elementary data types 2 1 string function delete a string in a string 15 9 find a string in a string 15 6 find the length of a string 15 10 insert a string in a string 15 8 replace a string in a s
167. ere are eight significant digits Numbers are internally rounded to fit this precision Publication 1746 RIM001A US P 2 4 Data Types Variables Publication 1746 RM001A US P 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 e 16 bit signed integer 32768 to 32767 e 16 bit binary 0000000000000000 to 1111111111111111 Tae ia Ay integer larger than 32767 is interpreted as a negative number by the SLC 500 processor 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 gt 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
168. esignation Purpose Use the LD statement to retrieve floating point numbers that were stored with a ST statement The expression expr following the LD statement specifies the address where the number is stored after executing the LD The LD statement places the number on the ARGUMENT STACK at the address location specified by expr This statement can be used with CALL 77 to retrieve variables from a protected area of memory This protected area is not zeroed on powerup or when the RUN command is issued Tate L2 is not used with any port designation Syntax LD expr Example gt P MTOP 24515 P MTOP 10 6 24455 gt PUSH 24455 CALL 77 gt 1 REM EXAMPLE PROGRAM gt 5 DIM A 10 B 10 gt 10 REM ARRAY SAVE gt 20 FOR I 0 TO 9 gt 30 A I I 20 gt 40 PUSH A I REM PUT NUMBER ON STACK gt 50 STR 5FFFH I 6 gt 60 NEXT I gt 70 REM GET ARRAY gt 80 FOR I 0 TO 9 gt 90 LDR 5FFFH I 6 gt 100 POP B I REM GET NUMBER FROM STACK gt 110 PRINT B I gt 120 NEXT I0 Publication 1746 RIM001A US P 13 44 Input Functions gt RUN 20 21 22 23 24 25 26 27 28 29 READY gt PUSH 5FFFH CALL 77 gt P MTOP 24575 Publication 1746 RM001A US P Input Functions 13 45 READ Purpose Use the READ statement to retrieve the expressions that are specified in the DATA statement and assign the value of the expression to the variable in the READ statemen
169. essor to Module Publication 1746 RIM001A US P 13 8 Input Functions CALL 27 Read Remote Purpose DH485 SLC Data File Use CALL 27 to read up to 64 words of data from a remote DH485 node data file to the local CPU input image file the CPU M1 file and or a string within the module If an internal string is chosen the first character is incremented to inform the module that new data is in the string The value of this character wraps around from 255 to 0 Execute CALL 27 once to set up the data transfer parameters Input and output image bits word 0 bit 10 for the slot containing the module are used to initiate and notify completion of the transfer The module sends the READ command configured in CALL 27 to the designated remote DH485 device on the network The operation is described below 1 The local SLC processor sets the output file word 0 bit 10 to inform the module that the READ command configured in CALL 27 should be executed Output File Word 0 Bit 10 SLC Processor SLC Backplane BASIC or BASIC T Module 2 The module automatically issues the appropriate READ command to the remote device on the DH485 network The data and status are sent back to the local SLC processor READ Command PORT DH485 Data and Status SLC Processor SLC Backplane BASIC or BASIC T Module DH485 Network Remote Device 3 When data is available the module transfers the data into the local SLC desti
170. g 15 8 PUSH string number of inserted character PUSH base string number CALL 67 PUSH base string number Delete string from a string 15 9 PUSH deleted string number CALL 68 PUSH string number Determine length of a string 15 10 POP number of characters CALL 70 None ROM to RAM program transfer 8 8 CALL 71 PUSH ROM program number ROM RAM to ROM program transfer 8 9 CALL 72 None RAM ROM return 8 9 CALL 73 None Battery backed RAM disable 5 1 CALL 74 None Battery backed RAM enable 5 2 CALL 75 POP processor mode Check SLC 500 controller CPU status 11 7 CALL 77 PUSH new MTOP address Protected variable storage 5 2 CALL 78 PUSH baud rate Set program port baud rate 14 2 CALL 80 POP battery status Check battery condition 11 8 CALL 81 None User memory module check and description 5 3 CALL 82 None Check user memory module map i 5 4 CALL 84 PUSH starting word offset in DH485 interface Transfer DH485 interface file to module input 13 19 file buffer PUSH number of words to be transferred POP transfer status CALL 85 PUSH starting word offset in DH485 interface Transfer module output buffer to DH485 12 17 file interface file PUSH number of words to be transferred POP transfer status CALL 86 POP DH485 interface file remote write status Check DH485 interface file remote Write 11 8 status CALL 87 POP DH485 interface file remote read status Check DH485 interface file remote Read status 11 9 CALL 88 PUSH number
171. ger File ASC N 1 word element Status File ASC S 1 word element Counter File ASC C 3 words element Timer File ASC T 3 words element Bit File ASC B 1 word element Control File ASC R 3 words element The fourth input argument is the starting element offset within the file on the remote device 0 to 32767 If the number is not within the range 0 to 32767 then the output argument equals 12 and the transfer does not take place Output Functions 12 19 TTP GAL be offset will be twice of what is expected For example if an offset of 3 was PUSHed the data will be written to the remote DH485 data file beginning at element 6 The fifth input argument is the number of elements to be transferred If the number is not within the range specified below then the output argument equals 13 and the transfer does not take place Table 12 5 Valid Length Range File Type Valid Length Range ASC N 1 to 40 ASC S 1 to 40 ASC C 1 to 13 ASC T 1 to 13 ASC B 1 to 40 ASC R 1 to 13 The sixth input argument is the message time out value This value is the number of hundreds of milliseconds that are allowed to receive the write response 1 to 50 0 1 to 5 0 seconds If the write response is not received within this time the message aborts with the output argument equal to 55 If the number is not within the range 1 to 50 the output argument equals 14 and the transfer does not take place The write data from
172. get an error message if you attempt to edit a line of RAM program the previous RAM contents Since the ROM command does not transfer a program to RAM it is possible to have different programs in ROM and RAM simultaneously You can move back and forth between the two modes when in Command mode If you are in Run mode you can change back and forth using CALLS 70 71 and 72 You can also use all of the RAM for variable storage if the program is stored in EEPROM The system control value MTOP always refers to RAM The system control value LEN refers to the currently selected program in RAM or ROM Syntax ROM integer Example READY gt ROM1 Purpose Use the RROM command to tell the module interpreter to select the current program out of EEPROM or UVPROM and then execute the program This command is equivalent to typing ROM and then RUN Your module can execute and store up to 255 programs in IMPORTANT P prog IMPORTANT EEPROM depending on the size of the programs and the capacity of the EEPROM The programs are stored in a sequence string referred to as the EEPROM file in EEPROM for retrieval and execution Publication 1746 RM001A US P 4 22 BASIC Commands RUN Publication 1746 RM001A US P When you enter RROM integer the module selects that program out of EEPROM memory makes it the current program and starts program execution If no integer is typed after the RROM command example RRom the module defaults
173. gram Purpose Use the ONTIME expr In num statement to compensate for the incompatibility between the timer counters on the microprocessor and the module Your module can process a line in milliseconds while the timer counters on the microprocessor operate in microseconds The ONTIME statement generates an interrupt every time the special function operator TIME is equal to or greater than the expression following the ONTIME statement Only the integer portion of TIME is compared to the integer portion of the expression that gives you seconds This comparison is performed at the end CR or of each line of BASIC The interrupt forces a GOSUB to the line number In num following the expression expr in the ONTIME statement The ONTIME statement does not interrupt an input command or a CALL routine Since the ONTIME statement uses the special function operator TIME you must execute the CLOCK statement for ONTIME to operate If CLOCK1 is not executed the special function operator TIME does not increment Syntax ONTIME expr In num Execution Control and Interrupt Support Functions 8 15 PUSH Example gt 1 REM EXAMPLE PROGRAM gt 10 TIME 0 gt 15 DBY 71 0 gt 20 CLOCK1 gt 30 ONTIME 2 100 gt 40 DO gt 50 WHILE TIME lt 10 gt 60 CLOCKO gt 70 END gt 100 PRINT TIMER INTERRUPT AT TIME SECONDS gt 110 ONTIME TIME 2 100 gt 120 RETI READY gt RUN TIMER INTERRUPT AT 2 01
174. haking or software handshaking Xon Xoff Failure to do so causes the BASIC program to stop executing while awaiting buffer space When space is available in the buffer the module resumes execution from the point at where it left off The output buffer of each port is capable of holding 256 characters See descriptions of CALLs 36 37 95 and 96 for more information Publication 1746 RIM001A US P 12 38 ST Publication 1746 RM001A US P Output Functions Syntax PHO PH1 Example gt PH0 2 2 04H gt PH1 2 2 0004H gt PHO 100 64H gt PHO 1000 3E8H gt PH1 1000 03E8H gt PH1 3E8 3 0 E 8 gt PHO PI 03H Purpose Use the ST statement to store module floating point numbers to a specified address The expression expr following the ST statement specifies the address where the number is stored in RAM The ST statement takes the value on the top of the argument stack and stores it in RAM at the address location specified by expr This statement can be used with CALL 77 to store variables to a protected area of memory This protected area is not zeroed on powerup or when the RUN command is issued Syntax ST expr Example gt P MTOP 24515 P MTOP 10 6 24455 gt PUSH 24455 CALL 77 gt P MTOP 24455 gt 1 REM EXAMPLE PROGRAM gt 5 DIM A 10 B 10 gt 10 REM ARRAY SAVE gt 20 FOR I 0 TO 9 gt 30 A I 1 20 gt 40 PUSH A I REM PUT NUMBER ON STACK gt 50
175. he fourth input argument is the string number If the second input argument does not select internal string usage the value of this input argument is ignored but must still be PUSHed The fifth input argument is the maximum word length allowed for the data packet Any packets received by the module of greater size are rejected Entering 0 causes the module to accept packets of any size and all packets are received up to the maximum length of the destination file Excess data is truncated The output argument is the status of the CALL It has the following values e 0 Successful e 1 Disabled e 2 Bad input parameter e 3 Selected DH485 DF1 port not enabled e 4 String too small e 5 String is not dimensioned Syntax PUSH CALL enable disable PUSH selection of destination file and or string PUSH word offset in destination file PUSH string number PUSH maximum word length CALL 118 POP CALL 118 status Publication 1746 RIM001A US P 13 30 Input Functions 0000 12 Handshake Bit from Module to SLC Processor 0001 Example gt 1 REM EXAMPLE PROGRAM gt 10 REM ENABLE PLC SLC UNSOLICITED WRITE INTERRUPT gt 20 PUSH 1 REM ENABLE THE CALL gt 30 PUSH 1 REM DESTINATION SLC M1 FILE gt 40 PUSH 0 REM WORD OFFSET INTO M1 FILE gt 50 PUSH 0 REM STRING NUMBER NOT USED gt 60 PUSH 20 REM MAX ALLOWED WORD LENGTH OF DATA PACKET gt 70 CALL 118 gt 80 POP S gt 90 IF S lt gt 0 TH
176. he internal string 2 is chosen the input output image data handshaking bits word 0 bit 12 are not used to indicate that data was received by the module In the BASIC program you must monitor the second character of the string transaction number which is incremented upon every successful data transfer Then you must remove the data from the string before the next data packet is received or data will be lost The third input argument is the word offset within the destination CPU file This offset points to the first word which contains the byte count of the valid data that is transferred The offset for the internal string is always 2 The byte count is placed at character location 0 and location 1 is a transaction number that is incremented upon every successful packet completion Input Functions 13 29 If the DH485 port is used for data transfer an offset of greater than 40 hex 64 decimal words should not be used Unsolicited write packets of greater than 64 causes a write to the DH485 program port buffer leading to improper operation The size of the data packet can be up to the maximum for the input file selected If the CPU input image file is chosen as the destination this offset must not be 0 or 1 Zero is a reserved word for the handshaking bits Word 1 is reserved for the PLC transaction number used with CALLs 27 28 122 and 123 A 0 or 1 causes an error to be POPped 2 bad input parameter and the CALL is not executed T
177. he ladder logic program of the SLC processor builds the data buffer The SLC then determines the byte count of the file to be transferred and places it into the lower byte of the first available word to be transferred This word plus the data comprise the data file to be transferred BYTE COUNT DATA BUFFER Output Functions 12 3 2 The ladder logic program of the SLC processor must set the output file word 0 bit 6 or bit 7 to inform the module that valid data is available Bit 6 indicates that data is available for port 1 and bit 7 indicates that data is available for port 2 Output File PORT PRT1 Word 0 Bit 6 or Bit 7 PORT PRT2 SLC Processor SLC Backplane BASIC or BASIC T Module 3 The module automatically transfers the data to the destination serial port PRT1 or PRT2 from the SLC processor PORT PRT1 DATA BUFFER PORT PRT2 SLC Processor SLC Backplane a BASIC or BASIC T Module 4 The module sets the input file word 0 bit 6 or bit 7 to inform the SLC processor that the transfer was successful Input File Word 0 Bit 6 or Bit 7 SLC Processor SLC Backplane BASIC or BASIC T Module 5 The ladder logic program of the SLC processor resets output file word 0 bit 6 or bit 7 Reset Output File Word 0 Bit 6 J or Bit 7 SLC Processor SLC Backplane BASIC or BASIC T Module 6 The module resets the input file word 0 bit 6 or bit 7 on the same end of scan c
178. he new console Re program by changing the appropriate port or MTOP information then execute PROG again Syntax PROGI Example READY gt PROG1 Programming sequence successful PROG2 BASIC Commands 4 17 Tata Before you attempt to program an EEPROM read the PROG PROGI and PROG2 sections of this chapter Note the PROG2 command does not transfer the RAM program to EEPROM The PROG2 command enables the first program in EEPROM to be loaded at each powerup Purpose Use the PROG2 command the same as you would the PROG1 command except for the following instead of signing on and entering the Command mode the module immediately begins executing the first program stored in the resident EEPROM Otherwise it executes the program stored in RAM You can use the PROG2 command to RUN a program on powerup without connecting to a console Saving PROG2 information is the same as typing a ROM 1 RUN command sequence This feature also allows you to write a special initialization sequence in BASIC and generate a custom sign on message for specific applications The PROG2 command does not alter the first program in the memory module IMPORTANT The PROG2 command does not cause the module to RUN at powerup if PRT1 default communications are selected via JW4 Refer to Chapter 3 of the SLC 500 BASIC and BASIC T Modules User Manual publication number 1746 UM004A US P for more information The following figure shows the module oper
179. he second input argument is the maximum number of 8 bit characters to be copied from the BASIC serial port to the destination file The maximum number of characters is selected by the fourth input argument e CPU input image file maximum characters 10 5 words e CPU M1 file maximum characters 126 63 words e Internal string maximum characters string size 3 The first character is the byte count value the second character is the incremented transaction number and the last character is the terminating character The maximum number of characters for an internal string is 254 If less than the maximum is acquired when a delimiter character is received the packet including the delimiter is sent to the CPU file The SLC processor determines the amount of valid data transferred into the destination file from the byte count placed into the lower byte of the first word of the file If the data received exceeds the string length or CPU file size the remaining data is truncated Input Functions 13 5 The third input argument is the decimal value of the ASCII character delimiter Any valid ASCII character can be chosen If no delimiter is desired enter a NULL value 0 decimal The data will be transferred to the destination buffer when the delimiter is received from the selected port regardless of the number of characters received The fourth input argument is the selection of the destination CPU input image file with or without the in
180. he transfer occurs when the specified number of characters are detected in the input buffer of the port or the user defined delimiter is received in the port The data is stored either low byte first then high byte or high byte first then low byte within the 16 bit word of the destination Data is transferred on word boundaries If an odd number of bytes are to be transferred the unused byte contains a zero The byte swap selection low byte first then high byte or high byte first then low byte of the last CALL 22 or CALL 23 executed determines the data packing method for all ports enabled by CALL 22 The low byte of the first word of the destination file contains the character count byte count of the data being transferred If a delimiter is found the byte count is expanded to include the first occurrence of the delimiter The second word of the destination file contains the first two characters of data If an internal string is chosen the first character of the string contains the byte count The second character of the internal string is a transaction number and is incremented to inform the module that new data is in the string The value of this character wraps around from 255 to 0 The third character of the string contains the first data character Execute CALL 22 to set up the data transfer parameters After the CALL is executed the module gets data from the port and transfers it to the destination file Input and output image f
181. hmic Operators Expressions and Operators 3 11 RND Use the RND operator to return a pseudo random number in the range between 0 and 1 inclusive The RND operator uses a 16 bit binary seed and generates 65536 pseudo random numbers before repeating the sequence The numbers generated are specifically between 0 65535 and 65535 65535 inclusive Tata Unlike most BASIC languages the RND operator in the module does not require an argument or a dummy argument If an argument is placed after the RND operator a bad syntax error occurs Example Result gt PRINT RND 26771954 The module contains a complete set of logarithmic operators These operators are single operand operators LOG expr Use the LOG operator to return the natural logarithm of the argument The argument must be greater than 0 This calculation is carried out to 7 significant digits Example Result gt PRINT LOG 12 2 484906 gt PRINT LOG EXP 1 1 If base 10 logs are needed the following expression may be used logjo x log x log 10 The log is natural EXP expr Use the EXP operator to raise the number e 2 7182818 to the power of the argument Example Result gt PRINT EXP 1 2 7182818 gt PRINT EXP LOG 2 2 Publication 1746 RM001A US P 3 12 Expressions and Operators String Operators oe in the module can manipulate STRINGS These operators are ASC an ASC expr Use the ASC operator to return the integer
182. ile bits word 0 bits 8 and 9 for the slot containing the module are used to initiate and notify completion of the transfer The operation is described below 1 When data is available from the port the module automatically transfers the data into the destination buffer This same port is checked for data at the end of each line of BASIC code PORT PRT1 RS 232 RS 422 or RS 485 Network External Device PORT PRT2 SLC Processor SLC Backplane Publication 1746 RM001A US P BASIC or BASIC T Module Input Functions 13 3 2 The module places the byte count of the valid data into the lower byte of the first available word of the destination buffer The upper byte of the first available word is not used BYTE COUNT lt DATA SLC Processor Input SLC Backplane BASIC or BASIC T Module Data file or M1 File 3 The module sets the input file word 0 bit 8 or bit 9 to inform the SLC processor that valid data is available Bit 8 indicates that data is available from port 1 and bit 9 indicates that data is available from port 2 PORT PRT1 DATA PORT PRT1 SLC Processor Input SLC Backplane E BASIC or BASIC T Module Data file or M1 File 4 The ladder logic program of the SLC processor gets the data from the file The ladder logic program sets the output file word 0 bit 8 or bit 9 to inform the module that data was received Output File PORT PRTI Word 0 Bit8 or M Bit
183. ince the last time this CALL was executed or since the module was powered up whichever occurred last e 2 ifa Logic Processor does not support this capability as with the SLC 5 01 processor Syntax CALL 55 POP input image buffer status Example gt 1 REM EXAMPLE PROGRAM gt 120 CALL 55 REM WAIT ON SLC gt 130 POP S gt 140 IF S 2 THEN PRINT THE SLC DOES NOT SUPPORT THIS FUNCTION gt 150 IF S 2 THEN STOP gt 160 IF S 0 THEN GOTO 120 gt 170 PRINT INPUT IMAGE HAS BEEN READ READY gt RUN INPUT IMAGE HAS BEEN READ READY gt Status Functions 11 5 CALL 58 Check MO File Purpose Use CALL 58 to determine if the Module File MO located in the module has been updated since the last time it was checked In this case update means that the data was written to these buffers from the CPU even if the data is the same value This routine has no input argument and one output argument The output argument is equal to e 0 if the Logic Processor has not written to the Module File MO since the last time this CALL was executed or since the module was powered up e 1 if the Logic Processor has written to the Module File MO since the last time this CALL was executed or since the module was powered up whichever occurred last e 2 if the Logic Processor does not support this capability as with the SLC 5 01 processor Syntax CALL 58 POP module file MO write status Example gt 1
184. ing point data type In addition the module must be configured for SLC 5 02 mode Class 4 so it cannot be used in a remote I O chassis with a 1747 ASB This CALL may be used in a remote ControlNet chassis with a 1747 ACN R 15 Use this CALL to convert BASIC floating point to SLC floating point in a two word format and place the converted value in the module s output buffer See also CALL 89 The module floating point number is an 8 digit BCD floating point number The range of the module floating point number is 1E 17 to 99999999E 27 The SLC floating point number is a 7 digit binary floating point number IEEE Float 32 bit value The range of the SLC floating point number 1 1754944E33 to 3 4028237E 38 The module has a floating point range larger than the floating point range of the SLC processor If CALL 88 attempts to convert a number larger than 3 4028237E the converted number is assigned a value of 3 4028237E If CALL 88 attempts to convert a number smaller than 1 1754944E8 the converted number is assigned a value of 1 1754944E SLC floating point numbers are stored in 2 16 bit words TTT ie Duc to the fact that the SLC floating point number is a 7 digit floating point number and the module is an 8 digit floating point number some round off error may be introduced during number conversions CALL 89 SLC Floating Point to BASIC Floating Point Math and Backplane Conversion Functions 9 5 Sy
185. ingle step program execution 4 23 SOR Square Root 3 10 ST Store variable 12 38 STOP Break program execution 8 20 STRING Allocate memory for strings 15 11 TAN Return the tangent of the argument 3 8 TIME Retrieve and or assign free running clock value 3 17 VER Verify module firmware version 4 25 XBY Retrieve or assign data to or from the external 3 17 data memory of the module XFER Transfer a program from ROM to RAM i 4 26 Addition 3 3 Division 3 4 tc Exponentiation 3 4 Multiplication 3 4 Subtraction 3 4 AND Logical AND 3 6 OR Logical OR 3 6 XOR Logical Exclusive OR 3 6 Direct communications to port PRT1 3 15 Direct communications to port PRT2 3 15 Publication 1746 RM001A US P Symbols and quick reference guide B 10 special function operator 3 75 AND logical operator 3 6 quick reference guide B 10 OR logical operator 3 6 quick reference guide 8 10 XOR logical operator 3 6 quick reference guide 8 10 Numerics 16 Bit Signed Integer to BASIC Floating Point 9 1 16 Bit Unsigned Integer to BASIC Floating Point 9 2 A abbreviations and terms P 4 ABS functional operator 3 9 quick reference guide 8 1 Add arithmetic operator 3 3 quick reference guide 8 10 argument stack 2 1 arithmetic operators 3 3 Add 3 3 Divide 3 4 Exponentiation 3 4 Multiply 3 4 Negation 3 4 Overflow and Division by Zero 3 5 Subtract 3 4 ASC quick reference guide B
186. integer between 0 and 65535 OFFFFH If it is not a valid integer a bad argument error occurs TTD ae he U proper use of this operator may cause a malfunction of the module Example A CBY 1000 The value in the program or code memory address location 1000 is assigned to variable A DBY expr Use the DBY operator to retrieve or assign data to or from the internal data memory of the module Both the value and the argument in the DBY operator must between 0 and 255 inclusive This is because there are only 256 internal memory locations in the module and one byte can only represent a quantity between 0 and 255 inclusive Tate ia proper use of this operator may cause a malfunction of the module Example Result A DBY B The value in internal memory location B is assigned to variable A B must be between 0 and 255 The value in program or code memory location 1000 is assigned to internal memory location 250 DBY 250 CBY 1000 Expressions and Operators 3 17 XBY expr Use the XBY operator to retrieve or assign data to or from the external data memory of the module The argument for the XBY operator must be a valid integer between 0 and 65535 OFFFFH The value assigned to the XBY operator must between 0 and 255 inclusive If it is not a bad argument error occurs Tae ta Umproper use of this operator may cause a malfunction of the module Example Result A XBY 0F000H The va
187. ion 1746 RM001A US P Table 14 6 DH485 Port Parameters Port Parameters Selections Default Settings Baud rate 300 600 1200 2400 4800 9600 19200 19200 baud arg host node address 0 to 31 0 arg2 module node address 1 to 31 1 arg3 maximum node address 1 to 31 31 arg4 not used arg5 storage type Store information in user ROM and RAM E R Store information in battery backed RAM R TTD GPT The E storage type option cannot be used if MODE is used as a statement Syntax MODE port name baud rate arg arg2 arg3 arg4 arg5 Example gt 1 REM EXAMPLE PROGRAM gt 10 MODE DH485 19200 0 1 2 R gt gt 25 MODE PRT1 1200 N 8 Chapter 15 CALL 60 String Repeat String Functions This chapter describes and illustrates commands used to manipulate string data structures within the BASIC program or from the command line Table 15 1 lists the corresponding mnemonics Table 15 1 Chapter Reference Guide If you need to Use this mnemonic Page Stringrepeat S ao String append concatenation CALL 61 15 2 Number to string conversion CALL 62 15 3 String to number conversion CALL 63 15 4 Find a string in a string CALL 64 15 6 Replace a string in a string CALL 65 15 7 Insert a string in a string CALL 66 15 8 Delete a string from a string CALL 67 15 9 Determine the length of a string CALL 68 15 10 Allocate memory for strings STRING 15 11
188. ion Control and Interrupt Support Functions CALL 21 Disable Processor Interrupt CALL 26 Module Interrupt Publication 1746 RM001A US P Example gt 1 REM EXAMPLE PROGRAM gt 10 REM ENABLE PROCESSOR INTERRUPTS gt 20 PUSH 1000 REM LINE NUMBER OF START OF PROCESSOR INTERRUPT ROUTINE gt 30 CALL 20 gt 1000 BEGINNING OF THE PROCESSOR INTERRUPT ROUTINE gt 1050 RETI Purpose Use CALL 21 to disable the processor interrupt capability enabled with CALL 20 This routine has no input or output arguments Syntax CALL 21 Example gt 1 REM EXAMPLE PROGRAM gt 10 REM DISABLE PROCESSOR INTERRUPTS ENABLED WITH CALL 20 gt 20 CALL 21 Purpose Use CALL 26 to generate an interrupt to the SLC 5 02 and above processors No arguments are PUSHed and one argument is POPped The POP shows the status of the SLC processor When this CALL is executed an I O event interrupt is issued by the module to interrupt the normal processor operating cycle in order to scan a specified subroutine This interrupt causes the SLC processor to execute the interrupt subroutine file configured in the module slot configuration ISR numbered file The module remains in this CALL routine until an interrupt acknowledge is received from the processor CALL 26 must be executed in the BASIC program each time the SLC processor is to be interrupted This CALL has no effect if the SLC processor is not in the Run mode After the module issues the CALL
189. is the CALL to be activated CALL 27 28 122 or 123 Publication 1746 RIM001A US P 13 14 Input Functions Publication 1746 RM001A US P When CALL 29 is executed the transfer is attempted If the selected CALL 27 28 122 or 123 is not executed before CALL 29 a 1 is returned in the status POPped When CALL 29 is executed successfully the value in the first character of the string transaction number is incremented to designate that the transfer occurred The range of this character is 0 through 255 After CALL 29 is executed one word is POPped This word is the status of the transaction e 0 Successful completion e 1 The chosen CALL 27 28 122 or 123 is not active e 255 SLC buffer is chosen for CALL 27 28 122 or 123 and CALL 29 is ignored e All other codes are identical to CALL 90 92 Syntax PUSH 27 28 122 or 123 for the CALL you want activated CALL 29 POP status of transaction Example CALL 122 must be enabled with internal string only prior to executing CALL 29 in this example Upon execution of CALL 29 an attempt is made to transfer one element from integer file 10 starting at element 0 of the PLC 5 at node 3 to the internal string 1 of the module gt 1 REM EXAMPLE PROGRAM gt 10 REM EXECUTE DF1 PLC REMOTE READ FROM INTERNAL gt 20 REM STRING WITH NO SLC INTERVENTION gt 21 REM SET UP CALL 122 gt 25 PUSH 5 3 10 ASC N 0 10 10 1 1 1 CALL 122 POP STATUS gt 30 PU
190. is not within the range 1 to 50 the output argument equals 14 and the transfer does not take place The data from the module output buffer starting at word 0 is written to the remote common interface file starting at the specified word and filling as many words as specified by the word length of the message Upon return from the CALL the output argument specifies the status of the message instruction Table 12 7 the output argument Table 12 7 Output Argument Output Functions 12 23 Decimal Hexadecimal Description Output Output 0 00 Successful Completion 2 02 Target node cannot accept the message at this time 3 03 Target node cannot respond because message is too large 4 04 Target node cannot respond because it does not understand the command parameters 5 05 module is off line not on link 6 06 Target node cannot respond because requested function is not available 7 07 Target node does not respond 10 0A module detects illegal target node address 11 0B module detects illegal file number 12 OC module detects illegal target file element offset 13 oD module detects illegal target file length 14 OE module detects illegal time out value 16 10 Target node cannot respond because of incorrect command parameters or unsupported command 55 37 Message timed out time out value exceeded 80 50 Target node is out of memory 96 60 Target node
191. it may take up to 5 milliseconds for the execution of interrupt to occur CALL 38 Expanded ONERR Restart Execution Control and Interrupt Support Functions 8 5 The POP shows the status of the SLC processor e 0 SLC processor acknowledges the interrupt but may not have executed the interrupt routine yet e 1 SLC processor aborted the interrupt e 2 SLC processor is not in Run mode e 3 SLC 500 fixed and SLC 5 01 processor cannot support interrupts Syntax CALL 26 POP SLC processor status Example gt 1 REM EXAMPLE PROGRAM gt 10 REM ENABLE MODULE INTERRUPT TO THE SLC PROCESSOR TO EXECUTE THE ISR FILE gt 20 CALL 26 gt 30 POP S REM SLC PROCESSOR STATUS Purpose Use CALL 38 to expand the type of errors trapped and handled by the ONERR function One argument is PUSHed and no arguments are POPped The ONERR restart allows the module to jump to an error handling routine when the arithmetic overflow divide by zero and bad argument errors are encountered All other errors cause the module to enter the Command mode and stop the execution of the program When CALL 38 is enabled all errors other than hardware specific failures watchdog RAM failure etc cause the program to enter the routine defined in the ONERR function instead of returning to the Command mode This routine may be used to reset the error and resume normal program operation If any error occurs that causes a restart stacks are cleared and variable
192. ithmetic Operators 4252 24cd shed eed tae aia oe be eed ees 3 3 Logical OQperat rsS sou Log cna tear soa a ha aa E aeS 3 6 Relational Operators chanced sbeeeetiddvnsee leaeeuerekees 3 7 Trigonometric Operators 4 4 dees ee ees eek he Gee Kee et 3 8 Functional Operatars po eeu ce ioe ea we ide vad mene R 3 9 Logarithmic Operators tun cn eee re Gna hehe cose eeig ae Gees 3 11 String Operator ase 2 eee e eG ees bg ead ENa 3 12 Special Function Operators 64 4 cg det exanle ewig gad eee 3 15 Chapter 4 BRR BINGE urha theo tc athena wpe e bid dete a a a dy arabes amet don ERE 4 2 CONT ee i sg elie Aces eR AIM NEM ED atte in SAC URAC A 4 3 ControbC ee asa esr Wt ie ts ees SS Oe 4 4 CALL 18 Re enable the Control C Break Function 4 5 CALL 19 Disable the Control C Break Function 4 6 ONTO Stetina ean Matt aaeekes takes AA wan ences 4 7 Conto Oaea a eat aa ier yest A Bacal hie tie Ue tick ACANA 4 8 PDE 222 8 isc 8 Ges ian SRS oe eed Seco asin Ae BA Gi ead Sabu sind aed OM 4 8 PRO el tele ct A AL elie cis Ae He hk A Wa sec lt solos ee A 4 9 IDLE ie a ess hare he ee BG as RE EE RE 4 10 MED SAP ica oS an a nara ee a na a heat dota amp Set a iaaea Ge Nene 4 11 LNTO 2 obricho need nth ea tie beer a a A 4 12 LERTA ae ENA a SO Vents Saban tear wed Sune nr tess asate went 4 12 NOE ee iB ore a PO Bite x RN lad bapa ea any Ph alas tay Pee Bas 4 12 NEW Ai na 5 ee SSS Ra Beek ES OO A eel nh aE 4 14 Publication 1746 RM001A US
193. ithmic 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 CLOCKO DO WHILE DO UNTIL END FOR TO STEP NEXT GOTO IF THEN ELSE NEXT and ON GOTO functions 8 Execution Control and Interrupt Describes and illustrates CALLs 16 17 20 21 26 38 70 71 72 and GOSUB Support Functions ONERR ON GOSUB ONTIME PUSH POP RETI RETURN and STOP 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 113 120 and 121 12 Output Functions Describes and illustrates CALLs 23 28 29 31 37 54 57 85 91 93 94 96 112 114 115 123 and PRINT PHO PH1 and ST functions 13 Input Functions Describes and illustrates CALLs 22 27 29 35 53 56 84 90 92 117 118 122 and GET INPL INPS INPUT LD
194. ity Publication 1746 RM001A US P CALL 85 Transfer BASIC Output Buffer to DH485 Common Interface File Output Functions 12 17 Syntax PUSH number of words to be transferred CALL 57 POP processor mode Example gt 1 REM EXAMPLE PROGRAM gt 50 PUSH 64 REM TRANSFER LENGTH IS 64 WORDS gt 60 CALL 57 REM TRANSFER BASIC OUTPUT BUFFER TO M1 gt 70 POP X REM LOGIC PROCESSOR STATUS IS IN X gt 80 PRINT X READY gt RUN 0 READY gt Purpose Use CALL 85 to transfer up to 40 words to the DH485 Common Interface File This routine has two input arguments and one output argument The first input argument is the starting word offset of the DH485 Common Interface File If the word offset value is not within the range 0 to 127 the output argument equals 1 The second input argument is the number of words to be transferred from the module output buffer to the DH485 Common Interface File If the second input argument number is not within the range 1 to 40 the output argument equals 2 The output argument specifies the transfer status It can have one of the following values e 0 Successful transfer e 1 Illegal starting offset e 2 Illegal length Word integrity is guaranteed during this transfer File integrity is not Syntax PUSH starting word offset in DH485 interface file PUSH number of words to be transferred CALL 85 POP transfer status Publication 1746 RIM001A US P 12 18 Output Functions
195. l SLC processor interaction CALLs 27 28 122 or 123 must be executed within the BASIC program before CALL 29 CALL 29 is active when the internal string is the only choice in CALLs 27 28 122 or 123 In this situation it is not practical to use the SLC input and output image files to begin the transfer and to pass the status The SLC processor does not need to be involved If an SLC file is chosen instead the local SLC processor controls the transfer with the input and output image bits In this instance a status of 255 is returned when CALL 29 is attempted One argument is PUSHed and one argument is POPped The input argument is the CALL to be activated CALL 27 28 122 or 123 When CALL 29 is executed the transfer is attempted If the selected CALL 27 28 122 or 123 is not executed before CALL 29 a 1 is returned in the status POPped When CALL 29 is executed successfully the value in the first character of the string transaction number is incremented to designate that the transfer occurred The range of this character is 0 255 After CALL 29 is executed one word is POPped This word is the status of the transaction 0 Successful completion e 1 The chosen CALL 27 28 122 or 123 is not active e 255 SLC buffer is chosen for CALL 27 28 122 or 123 and CALL 29 is ignored e All other codes are identical to CALL 90 92 Syntax PUSH 27 28 122 or 123 for the CALL you want activated CALL 29 POP status
196. l 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 OFFFFH 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 ETSA 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 Th
197. le Tarte lE 22 ASCII null character is used within the string it acts as a marker denoting the end of a string Taare After memory is allocated for string storage commands example NEW and statements example CLEAR cannot de allocate this memory Cycling power also cannot de allocate this memory unless battery backup is disabled You can de allocate memory by executing a STRING 0 0 statement STRING 0 0 allocates no memory to string variables IMPORTANT The module executes the equivalent of a CLEAR statement every time the STRING expr expr statement executes This is necessary because string variables and numeric variables occupy the same external memory space After the STRING statement executes all variables are wiped out Because of this you should perform string memory allocation early in a program during the first statement if possible If you re allocate string memory you destroy all defined variables Syntax STRING expr expr Publication 1746 RIM001A US P 15 12 String Functions Publication 1746 RM001A US P Examples gt 1 REM EXAMPLE PROGRAM gt 10 STRING 100 30 gt 20 0 MONTHLY REPORT gt 30 PRINT 0 READY gt RUN Appendix A Mathematical Conversion Overview Decimal Hexadecimal Octal ASCII Conversion Table The table below lists the decimal hexadecimal octal and ASCII conversions
198. le above is a missing POP for CALL 53 The missing POP will cause an A Stack error and would normally put the processor in Command mode When this occurs print the error code and resume running the program Publication 1746 RIM001A US P 8 8 Execution Control and Interrupt Support Functions CALL 70 ROM to RAM Program Transfer Publication 1746 RM001A US P Purpose Use CALL 70 to shift program execution from a running ROM program to the beginning of the RAM program No arguments are PUSHed or POPped IMPORTANT The first line of the RAM program is not executed We recommend that you make it a remark Syntax CALL 70 Example READY gt LIST 1 REM EXAMPLE PROGRAM 10 REM SAMPLE ROM PROGRAM FOR CALL 70 20 PRINT NOW EXECUTING ROM 5 30 CALL 70 REM GO EXECUTE RAM 40 END READY gt RUN NOW EXECUTING ROM 5 NOW EXECUTING RAM READY gt LIST 1 REM EXAMPLE PROGRAM 10 REM SAMPLE RAM PROGRAM FOR CALL 70 20 PRINT NOW EXECUTING RAM 30 END READY CALL 71 ROM RAM to ROM Program Transfer CALL 72 RAM ROM Return Execution Control and Interrupt Support Functions 8 9 Purpose Use CALL 71 to transfer from a running ROM or RAM program to the beginning of any available ROM program One argument is PUSHed which ROM program None are POPped An invalid program error displays and you enter the Command mode if the ROM number does not exist MEA THe first line of the ROM program is not execute
199. le to test a complex condition with ONE statement gt 10 IF A gt E AND A gt C OR A gt D THEN Additionally you can use the NOT expr operator gt 10 IF NOT A gt E AND A gt C THEN By chaining relational expressions with logical operators you can test particular conditions with one statement MEITSIT Vhen 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 RIM001A US P 3 8 Expressions and Operators Trigonometric Operators The module contains a complete set of trigonometric operators These operators Publication 1746 RM001A US P 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 200000 Example Result gt PRINT SIN PI 4 7071067 gt PRINT SIN 0 0 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 200000 Example Result gt PRINT COS PI 4 7071067 gt PRINT COS 0 1 TAN expr Use the TAN operator to return the tangent of the argument The argument is expressed in radians The argument must be between 200000 Example Result gt
200. lue in external memory location OFOOH is assigned to variable A XBY 4000H DBY 100 The value in internal memory location 100 is assigned to external memory location 4000H TIME Use the TIME operator to retrieve or assign a value to the free running clock resident in the module After reset time is equal to 0 The CLOCK1 statement enables the free running clock When the free running clock is enabled the special function operator TIME increments once every 5 milliseconds The units of time are in seconds When TIME is assigned a value with a LET statement example TIME 100 only the integer portion of TIME is changed gt CLOCK1 enable FREE RUNNING CLOCK gt CLOCKO disable FREE RUNNING CLOCK gt PRINT TIME display TIME 3 315 gt TIME 0 set TIME 0 gt PRINT TIME display TIME 315 only the integer is changed Publication 1746 RM001A US P 3 18 Expressions and Operators Publication 1746 RM001A US P You can change the fraction portion of TIME by manipulating the contents of internal memory location 71 47H You can do this by using a DBY 71 statement Each count in internal memory location 71 47H represents 5 milliseconds of TIME Continuing with the example gt DBY 71 0 fraction of TIME 0 gt PRINT TIME 0 gt DBY 71 3 fraction of TIME 3 5ms 15 ms gt PRINT TIME 1 5 E 2 Only the integer portion of TIME changes when a value is assigned This allows you to generat
201. m Wherever you need us Rockwell Automation brings together leading brands in industrial automation including Allen Bradley controls Reliance Electric power transmission products Dodge mechanical power transmission components and Rockwell Software Rockwell Automation s unique flexible approach to helping customers achieve a competitive advantage is supported by thousands of authorized partners distributors and system integrators around the world Americas Headquarters 1201 South Second Street Milwaukee WI 53204 USA Tel 1 414 382 2000 Fax 1 414 382 4444 European Headquarters SA NV avenue Herrmann Debroux 46 1160 Brussels Belgium Tel 32 2 663 06 00 Fax 32 2 663 06 40 Asia Pacific Headquarters 27 F Citicorp Centre 18 Whitfield Road Causeway Bay Hong Kong Tel 852 2887 4788 Fax 852 2508 1846 Publication 1746 RM001A US P April 2000 Supercedes Publication 1746 6 3 November 1994 Allen Bradley AEEMEIE DOGE To Automation 2000 Rockwell International Corporation Printed in the U S A
202. m the base string This routine has no output arguments TTT Ga This routine deletes only the first occurrence of the string Syntax PUSH base string number PUSH deleted string number CALL 67 Example gt 1 REM EXAMPLE PROGRAM gt 10 REM ROUTINE TO DELETE A STRING IN A STRING gt 20 STRING 200 14 gt 30 1 123456789012 gt 40 2 12 gt 50 PRINT BEFORE gt 60 PRINT 1 1 gt 70 PUSH 1 REM BASE STRING NUMBER gt 80 PUSH 2 REM STRING NUMBER OF THE STRING DELETED gt 90 CALL 67 REM INVOKE STRING DELETE ROUTINE gt 100 PRINT AFTER gt 110 PRINT 1 1 gt 120 END READY gt RUN BEFORE 1 123456789012 AFTER 1 3456789012 READY v Publication 1746 RM001A US P 15 10 String Functions CALL 68 Find the Length of a String Publication 1746 RM001A US P Purpose Use CALL 68 to determine the length of a string One input argument is expected This is the string number on which the routine acts One output argument is required It is the actual number of non carriage return CR characters in this string This is similar to the BASIC command LEN str example L LEN 1 The length of the string can be properly determined only if the string is terminated with a CR character If a string is filled using the ASC instruction a CR must be added as the last character to terminate the string Syntax PUSH string number C
203. mber is not within the range shown the status equals 2 and the transfer does not occur Table 13 11 Valid Element Length Range File Type Code Valid Element Length Range ASC N 1 to 64 ASC S 1 to 64 ASC C 1 to 21 ASC T 1 to 21 ASC B 1 to 64 ASC R 1 to 21 ASC I 1 to 21 ASC O 1 to 21 Common Interface File 1 to 21 Publication 1746 RM001A US P 13 34 Input Functions Publication 1746 RM001A US P The seventh input argument is the message time out value This value 1 through 255 corresponds to the number of hundreds of milliseconds that are allowed to receive the read response 0 1 through 25 5 seconds If the read response is not received within this time the message aborts with the status equal to 55 in the input file word 1 bits 0 7 If the time out value is not within the range 1 through 255 the status POPped equals 2 and the transfer does not take place The eighth input argument is the selection of the destination CPU input image file with or without the internal string the CPU M1 file with or without the internal string or the internal string alone e 0 CPU input image file e 1 CPU MI file e 2 Internal string e 3 CPU input image file and internal string e 4 CPU M1 file and internal string If you chose internal string 2 CALL 29 can be executed to initiate each data transfer without requiring SLC processor interaction The output file word 0 bit 10 will als
204. mber of words to be transferred 0 to 64 If the number is not within the range 0 to 64 no transfer occurs and the output argument sets to 10 If the input argument is valid number the output argument is the status of the Logic Processor It can have one of the following values e 0 Successful Transfer Logic Processor in Run mode e 1 Successful Transfer Logic Processor in Program mode e 2 Successful Transfer Logic Processor in Test mode e 10 Illegal length specified e 11 Logic Processor does not support this capability Word integrity is guaranteed during this transfer File integrity is not Handshaking bits can be used in your application program to provide file integrity Syntax PUSH number of words to be transferred CALL 56 POP processor status Example gt 1 REM EXAMPLE PROGRAM gt 30 PUSH 64 REM TRANSFER 64 WORDS gt 40 CALL 56 REM TRANSFER MO TO BASIC INPUT BUFFER gt 50 POP X REM LOGIC PROCESSOR STATUS IS IN X gt 60 IF X 10 PRINT ILLEGAL INPUT ARGUMENT gt 70 IF X lt gt 0 AND X lt gt 10 THEN PRINT PROCESSOR NOT IN RUN MODE READY gt RUN CALL 84 Transfer DH485 Interface File to BASIC Input Buffer Input Functions 13 19 Purpose Use CALL 84 to transfer up to 40 words starting at the designated offset of the DH485 Common Interface File to the module input buffer starting at the same designated offset from word 0 This routine has two input arguments and
205. mple gt 1 REM EXAMPLE PROGRAM gt 5 E 0 C 10 D 2 gt 10 FOR A E TO C STEP D gt 20 PRINT A gt 30 NEXT A gt 40 END gt NEW gt 1 REM EXAMPLE PROGRAM gt 10 FOR I 0 TO 8 STEP 2 gt 20 PRINT I gt 30 NEXT I gt 40 END gt RUN on fh ND O Publication 1746 RM001A US P ON GOTO Control Functions 7 11 Purpose Use the ON GOTO statement to transfer control to the line s specified by the GOTO statement when the value of the expression following the ON statement is encountered in the BASIC program Syntax ON expr GOTO In num Example gt 1 REM EXAMPLE PROGRAM gt 10 ON Q GOTO 100 200 300 Control is transferred to line 100 if Q is equal to 0 and then to line 200 if Q is equal to 1 If Q is equal to 2 control is transferred to line number 300 and so on All comments that apply to GOTO apply to the ON statement If Q is less than zero an ERROR BAD ARGUMENT message is generated and the BASIC module enters Command mode If Q is greater than the line number list following the GOTO statement an ERROR BAD SYNTAX message is generated The ON GOTO statement provides conditional branching options within the module program Publication 1746 RIM001A US P 7 12 Control Functions Publication 1746 RM001A US P Chapter 8 Execution Control and Interrupt Support Functions This chapter describes and illustrates commands that control data flow and program transfer between ROM and RAM within the BASIC
206. n 1746 RIM001A US P 8 12 Execution Control and Interrupt Support Functions ONERR Publication 1746 RM001A US P gt 20 GOSUB 100 gt 30 NEXT I gt 40 END gt 100 REM USER SUBROUTINE HERE gt 105 PRINT I gt 110 GOSUB 200 gt 120 RETURN gt 200 REM START OF NESTED SUBROUTINE gt 210 PRINT I I 220 RETURN READY gt RUN 1 4 9 wW Ne READY Purpose Use the ONERR statement to handle arithmetic errors if they occur during program execution Only arithmetic overflow arithmetic underflow divide by zero and bad argument errors are trapped by the ONERR statement All other errors are not trapped and cause the module to enter the Command mode If an arithmetic error occurs after the ONERR statement is executed the module interpreter passes control to the line number In num following the ONERR statement You handle the error condition in a manner suitable to your application The ONERR command does not trap bad data entered during an input instruction This yields a TRY AGAIN message or EXTRA IGNORED message For expanded ONERR functionality refer to CALL 38 on page 8 5 After the ONERR statement is executed you can determine what type of error occurred by examining external memory location 257 101H The error codes are e ERROR CODE 10 DIVIDE BY ZERO e ERROR CODE 20 ARITH OVERFLOW or ARITH UNDERFLOW e ERROR CODE 40 BAD ARGUMENT You can examine this location by using an XBY 257 statement Syntax O
207. nation buffer DESTINATION BUFFER SLC Processor SLC Backplane BASIC or BASIC T Module Publication 1746 RM001A US P Input Functions 13 9 4 The module places the status in the input file word 1 bits 0 7 Status Input File Word 1 Bits 7 through 10 SLC Processor SLC Backplane _ BASIC or BASIC T Module 5 The module sets the input file word 0 bit 10 to inform the SLC processor that valid data is available Input File Word 0 Bit 10 SLC Processor SLC Backplane BASIC or BASIC T Module 6 The local SLC retrieves the data and status from the buffer and then resets output file word 0 bit 10 to inform the module that data was received Reset Output File 5 p Word 0 Bit 10 SLC Processor SLC Backplane BASIC or BASIC T Module 7 The module resets the input file word 0 bit 10 on the same end of scan cycle in which the output file word 0 bit 10 was reset Reset Input File n lt p Word 0 Bit 10 SLC Processor SLC Backplane BASIC or BASIC T Module The SLC processor must not set then reset the output file word 0 bit 10 on the same ladder logic scan cycle If this occurs the module may miss the bit being set This CALL is active until it is re executed with different input parameters This CALL has ten input arguments and one output argument Publication 1746 RIM001A US P 13 10 Input Functions The first input argument is the type of SLC READ command issued e 0 Dis
208. nd pointer 5 8 print output buffer and pointer 5 8 reset to default settings 14 4 set port parameters 74 7 publications related P 3 PUSH 2 7 execution control and interrupt support function 8 15 quick reference guide B 9 RAM BASIC command 4 79 quick reference guide B 9 RAM ROM Return 8 9 READ input function 13 45 quick reference guide B 9 Read Remote DF1 PLC Data File 13 30 Index ix Read Remote DF1 PLC Data File CALL 122 13 30 Read Remote DH 485 Data to BASIC Input Buffer 73 20 Read Remote DH485 Common Interface File to BASIC Input Buffer 13 23 Read Remote DH485 Data File to BASIC Input Buffer 73 20 Read Remote DH485 SLC Data File 13 8 input function 73 8 Read Write to a PLC SLC from the BASIC Module Internal String 12 13 13 13 input function 13 13 output function 12 73 relational operator 3 7 REM BASIC command 4 79 quick reference guide B 10 REN BASIC command 4 20 quick reference guide B 10 Replace a String in a String 15 7 Reset Print Head Pointer 14 3 PRT1 to Default Settings 14 4 PRT2 to Default Settings 14 4 RESTORE assignment function 6 7 quick reference guide B 10 RETI execution control and interrupt support function 8 18 quick reference guide B 10 Retrieve Date Numeric 10 4 Date String 10 7 Date Time String 10 4 Day of Week Numeric 10 7 Day of Week String 10 6 Time Numeric 10 6 Time String 10 5 RETURN execution control and interrupt support function 8 18 quick reference guide B 10 RND functional op
209. ng hardware handshaking or software handshaking Xon Xoff Failure to do so causes the BASIC program to stop executing while awaiting buffer space When space is available in the buffer the module resumes execution from the point where it left off The output buffer of each port is capable of holding 256 characters See descriptions of CALLs 36 37 95 and 96 for more information The module applies the following rules when hardware handshaking is enabled The module e does not transmit until CTS becomes active e examines DSR following the receipt of a character If the DSR is active the character is placed in the input queue If DSR is inactive the character is assumed to be noise and is discarded Table 14 5 PRT1 and PRT2 Port Parameters Port Parameters Selections Default Settings Baud rate 300 600 1200 2400 4800 9600 19200 1200 arg parity None N Even E Odd 0 N arg2 number of data bits 7or8 8 arg3 number of stop bits 1or2 1 arg4 handshaking No handshaking N S Software handshaking S Hardware handshaking H Hardware and software handshaking B arg5 storage type Store information in user ROM and RAM E R Store information in battery backed RAM R Tae ba ay argument other than port name and baud rate is left blank then that argument defaults to the previously specified value for that argument Publication 1746 RM001A US P 14 6 Setup Functions Publicat
210. nning of the interrupt routine that the program should jump to when a valid DF1 packet is received in the port PRT2 buffer You should process the packet within the interrupt routine A RETI executed within the routine returns you to the point in the program before the interrupt occurred This command has no effect if the DF1 protocol is not enabled CALL 108 Also jumper JW4 must be in a position enabling DF1 for port PRT2 Once this CALL is enabled port PRT2 is checked by the processor at the end of each line of BASIC code for a DF1 message received If the DF1 packet arrives due to CALL 122 or CALL 123 when CALL 16 is enabled you will receive the DF1 packet interrupt but the DF1 packet will have been removed from the input buffer Interrupts are disabled when the module is in Command mode CALL 16 disabled is the default of the module when entering Run mode CALL 16 must be re executed every time Run mode is entered Syntax PUSH BASIC line number CALL 16 Example gt 1 REM EXAMPLE PROGRAM gt 10 REM ENABLE DF1 PACKET INTERRUPT gt 20 PUSH 800 REM LINE NUMBER OF START OF DF1 INTERRUPT ROUTINE gt 30 CALL 16 gt 800 BEGINNING OF INTERRUPT ROUTINE PROCESS THE PACKET gt 850 RETI CALL 17 Disable DF1 Packet Interrupt CALL 20 Enable Processor Interrupt Execution Control and Interrupt Support Functions 8 3 Purpose Use CALL 17 to disable the DF1 packet interrupt capability enabled with CALL 16 This routine
211. not received within this time the message aborts with the status equal to 55 in the input file word 1 bits 0 7 If the time out value is not within the range 1 through 255 the status POPped equals 2 and the transfer does not take place The eighth input argument is the selection of the source CPU output image file CPU M0 file or the internal string e 0 CPU output image file e 1 CPU M0 file e 2 Internal string If you chose internal string 2 CALL 29 can be executed to initiate each data transfer without requiring SLC processor interaction The output file word 0 bit 11 will also initiate a string transaction The ninth input argument is the word offset within the source CPU file The word offset points to the first data location If you chose the CPU output image file the Publication 1746 RM001A US P 12 10 Output Functions Publication 1746 RM001A US P offset should not be 0 since this word is reserved for the data transfer handshaking bits The offset for the internal string is always 1 The string character transaction number at location 0 is incremented upon every data transfer The tenth input argument is the string number If the eighth input argument does not select internal string usage the value of this input argument is ignored but must still be PUSHed The output argument is the validation of the CALL parameters It has the following values e 0 Successful e 1 Disabled e 2 Bad input parameter e
212. nsfer is available Publication 1746 RIM001A US P 12 8 Output Functions Publication 1746 RM001A US P Input File Word 0 Bit 11 SLC Processor SLC Backplane BASIC or BASIC T Module 6 The SLC retrieves the status and resets output file word 0 bit 11 The data buffer can be reused by the SLC Reset Output File Word 0 Bit 11 SLC Processor SLC Backplane BASIC or BASIC T Module 7 The module resets the input file word 0 bit 11 on the same end of scan cycle in which the output file word 0 bit 11 was reset Reset Input File Word 0 Bit 11 SLC Processor SLC Backplane BASIC or BASIC T Module Once this CALL is active it will remain active and will send data to the remote node whenever the SLC processor sets output file word 0 bit 11 This CALL has ten input arguments and one output argument The first input argument is the type of SLC WRITE command issued e 0 Disable the previously executed CALL 28 e 1 Common Interface File Write e 2 SLC Typed Write The second input argument is the node address of the SLC remote device on the DH485 network 0 through 31 If the number is not within this range the status equals 2 and the write message does not occur The third input argument is the file number on the SLC remote device 0 through 255 If the number is not within this range the status equals 2 and the write message does not occur The parameter is ignored if the Common Interface File is cho
213. ntax This routine has two input arguments and no output arguments The first input argument is the floating point value you want to convert The second input argument is the first word in the module s output buffer The output buffer addresses are 100 163 for the M1 file and 200 207 for the Input Image PUSH number to convert PUSH output buffer to receive converted value CALL 88 Example gt 50 PUSH F REM Floating point value to convert gt 60 PUSH 100 REM Words 100 and 101 of the BASIC output buffer associated with the M1 file gt 70 CALL 88 gt 80 PUSH 2 REM Number of words to transfer from BASIC output buffer to M1 file gt 90 CALL 57 REM Transfer data from BASIC output buffer to M1 file gt 100 POP S REM status for CALL 57 Purpose This CALL may only be used with a SLC 5 03 5 04 or 5 05 processor These are the only SLC processors that support the floating point data type In addition the module must be configured for SLC 5 02 mode Class 4 so it cannot be used in a remote I O chassis with a 1747 ASB This CALL may be used in a remote ControlNet chassis with a 1747 ACN R 15 Use this call to convert SLC floating point to BASIC floating point See also CALL 88 The SLC floating point number is a 7 digit binary floating point number IEEE Float 32 bit value The range of the SLC floating point number 1 1754944E 8 to 3 4028237E 38 The module floating point number is an 8 digit BCD floating
214. o 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 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 Publication 1746 RM001A 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 logar
215. o initiate a string transaction The ninth input argument is the word offset within the destination CPU file This offset points to the first word transferred The offset for the internal string is always 1 The first character transaction number at location 0 is incremented on every successful transfer to inform the module that new data is in the string The value of the transaction number wraps around from 255 to 0 If the CPU input image file is chosen this offset must not be 0 or 1 because they are reserved words Zero is reserved for data transfer handshaking bits and word 1 is reserved for the transaction status A 0 or 1 causes an error to be POPped 2 bad input parameter and the CALL is not executed If the data received exceeds the string length or CPU file size the remaining data is truncated The tenth input argument is the string number If the eighth input argument does not select internal string usage the value of this input argument is ignored but must still be PUSHed Input Functions 13 35 The output argument is the status of the CALL It has the following values 0 Successful e 1 Disabled e 2 Bad input parameter e 3 DF1 not enabled e 4 String too small e 5 String is not dimensioned To disable this CALL a zero must be PUSHed into the first input parameter All other parameters are ignored but must still be PUSHed Whenever an attempt is made to read a remote node the status of the
216. ocessor only supports 0 through 255 words per file The sixth input argument is the number of words to be transferred If the number is not within the range shown the status equals 2 and the transfer does not occur SLC 5 01 and SLC 5 02 processors support transfers up to 41 words maximum Table 13 3 Valid Length Range File Type Code Valid Length Range ASIN ito o ASC C 1 to 21 ASC T 1 to 21 ASC B 1 to 64 ASC R 1 to 21 Common Interface File 1 to 64 Publication 1746 RM001A US P Input Functions 13 11 The seventh input argument is the message time out value This value 1 through 255 corresponds to the number of hundreds of milliseconds that are allowed to receive the read response 0 1 through 25 5 seconds If the read response is not received within this time the message aborts with the status equal to 55 in the input file word 1 bits 0 through 7 If the time out value is not within the range 1 through 255 the POPped status equals 2 and the transfer does not take place The eighth input argument is the selection of the destination file and or string e 0 CPU input image file e 1 CPU MI file e 2 Internal string e 3 CPU input image file and internal string e 4 CPU M1 file and internal string If you chose internal string 2 CALL 29 can be executed to initiate each data transfer without requiring SLC processor interaction The output file word 0 bit 10 will also initiate a string transa
217. of Rockwell Automation is prohibited Throughout this manual we use notes to make you aware of safety considerations ATTENTION Identifies information about practices or circumstances that can lead to personal injury or death property damage or economic loss Attention statements help you to e identify a hazard e avoid a hazard e recognize the consequences IMPORTANT Identifies information that is critical for successful application and understanding of the product PLC 5 is a registered trademark and MicroLogix SLC 500 RSLogix and RSLinx are trademarks of Rockwell Automation Language Elements Data Types Expressions and Operators BASIC Commands Table of Contents Preface Who Should Use This Manual 0 0 0 0 ccc eee eee P 1 Purpose of this Manual sic cst der ndat dries Aeedide ud wel ooae 3 P 2 How to Use this Mantial fic ticwsee ice aheoatia alee tee ees aes P 3 Terms and AbbreviatOns s i dceack daa da ea ar ak AeA dawn eae week P 4 Conventions Used in this Manual 0 2 0 0 0000 c ce eee eee P 4 Rockwell Automation Supports vn sssusa P 5 Chapter 1 Character Seti 4 donk ene a a BAT Mok RO E N a a 1 1 The BASIC Program Line uuuuuuuuunun ne 1 1 Chapter 2 Data Typessasi a noaua So dae e E oe Mata e e EAS 2 1 Wat ab ese oae a E a a TT AOA ese dda EE 2 4 Chapter 3 Expressions and Operators sssss sesuur ereere 3 2 Hierarchy of peratats oce set cse o e EE E EE RA 3 3 Ar
218. of the data source It can be the CPU output data file or CPU M0 file e 0 CPU output image file e 1 CPU M0 file The third input argument is the word offset within the CPU output image file or M0 file This offset points to the first word which contains the byte count of the valid data in the file The second word of the CPU file contains the first two characters of the data to be transferred If the CPU output image file is chosen this offset must not be word 0 since word 0 is reserved for the handshaking bits used in this CALL Therefore the first available word for the byte count when the output image is chosen is the second word word 1 The fourth input argument is the internal string number If the second input argument does not select internal string usage the value of this input argument is ignored but must still be PUSHed If the data exceeds the string length the remaining data is truncated Output Functions 12 5 The fifth input argument is the byte swap selection It has the following values e 0 Data bytes transferred from the CPU are not swapped when passed to the module port or string The data transfer order is low byte first then high byte per word The low byte of the first word in the source buffer contains the byte count e 1 Data bytes transferred from the CPU are swapped when passed to the module port or string The data transfer order is high byte first then low byte per word Swapping does not affec
219. of zero This guarantees that the first character entered is always read independent of where the GET operator is placed in the program There is no buffering of characters on the program port Purpose Use the INPL statement to read an entire line up to 254 characters from program port buffer The line must be stored in a string variable The INPL statement reads all characters from the program port until a carriage return or the 254 character limit is reached whichever comes first INPL does not echo characters read from the program port Use the INPL statement to read an entire line of characters from the PRT2 port buffer Use the INPL statement to read an entire line of characters from the PRT1 port buffer Both these statements function like the INPL statement Syntax INPL string_variable Publication 1746 RIM001A US P 13 40 Input Functions INPS INPUT Publication 1746 RM001A US P Example gt 1 REM EXAMPLE PROGRAM gt 10 STRING 270 254 REM ONE STRING OF lt 254 BYTES gt 20 INPL 0 REM READ LINE FROM PROGRAM PORT gt 30 PRINT 0 REM ECHO STRING TO PORT PRT2 Purpose Use the INPS statement to read an entire string of characters from the program port buffer No characters are echoed The INPS statement is preferred over INPUT or INPL for communications because all ASCII characters may be significant INPUT is least desirable because input stops when a comma or a carriage return is seen INPL termin
220. oughout this manual Manual e Bulleted lists such as this one provide information not procedural steps e Numbered lists provide sequential steps or hierarchical information e Jtalic type is used for emphasis e Textinthis font indicates words or phrases you should type e Key names match the names shown and appear in bold capital letters within brackets for example ENTER Publication 1746 RM001A US P Rockwell Automation Support P 5 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 e sales and order support e product technical training e 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
221. plane conversion 2 1 string 2 7 DBY quick reference guide B 7 special function operator 3 76 definitions P 4 delete a String in a String 75 9 DF1 driver communications disable 11 18 enable 11 12 DF1 Packet Interrupt disable 8 3 enable 8 2 DF1 Packet Length input function 13 25 DF1 XMIT Status output function 12 27 quick reference guide B 6 DH485 check interface file remote read status 71 9 check interface file remote write status 77 8 common interface file 11 8 11 9 network 12 8 read remote common interface file to BASIC input buffer 13 23 read remote data file 13 8 read remote data file to BASIC input buffer 73 20 serial communication link 11 8 11 9 transfer BASIC output buffer to common interface file 12 17 transfer data to BASIC input buffer 73 79 write BASIC output buffer to remote data file 12 78 write output buffer to remote common interface file 12 22 write to remote data file 12 6 DIM assignment function 6 4 quick reference guide B 7 Publication 1746 RM001A US P vi Index Disable Control C 4 6 DF1 Driver Communications 11 18 DF1 Packet Interrupt 8 3 Port PRT2 DTR Signal 11 11 Processor Interrupt 8 4 Display Current PRT1 Port Setup 12 24 Current PRT2 Port Setup 12 14 Divide arithmetic operator 3 4 quick reference guide B 10 DO UNTIL control function 7 4 quick reference guide B 7 DO WHILE control function 7 3 quick reference guide B 7 DTR signal disable 11 11 enable 11 11 E EDIT
222. pression expr encountered in the push statement Tae ia Tbe argument stack can hold up to 33 floating point numbers before overflowing Syntax PUSH expr expr expr Example gt 1 REM EXAMPLE PROGRAM gt 10 A 10 gt 20 C 20 gt 30 PRINT A A ANDC C gt 40 PUSH A C gt 50 POP A C gt 60 PRINT A A AND C C gt 70 END READY gt RUN A 10 AND C 20 A 20 AND C 10 READY gt gt NEW gt 1 REM EXAMPLE PROGRAM gt 10 PUSH 0 gt 20 CALL 14 gt 30 POP W gt 40 PRINT W gt 50 END POP Execution Control and Interrupt Support Functions 8 17 Purpose Use the POP statement to remove values from the module argument stack The value at the top of the argument stack is assigned to the variable following the POP statement and the argument stack is POPped example incremented by 6 You can place values in the stack using the PUSH statement Tae ta 2 POP statement executes and no number is in the argument stack an A Stack error occurs and the module enters Command mode You can pop more than one variable off the argument stack using a single POP statement with multiple variables var var var Each expression must be followed by a comma Syntax POP var var var Example See the PUSH statement You can use the PUSH and POP statements to minimize GLOBAL variable problems These are caused by the main program and all main program
223. program or from the command line Table 8 1 lists the corresponding mnemonics Table 8 1 Chapter Reference Guide If you need to Use this Page mnemonic Enable the interrupt capability when a DF1 packet is received CALL 16 8 2 Disable the DF1 packet interrupt capability CALL 17 8 3 Enable the SLC processor interrupt capability CALL 20 8 3 Disable the SLC processor interrupt capability CALL 21 8 4 Generate an interrupt to the SLC processor CALL 26 8 4 Initiate transactions defined by CALLs 27 28 122 and 123 CALL 38 8 5 ROM to RAM program transfer CALL 70 8 8 ROM RAM to ROM program transfer CALL 71 8 9 RAM ROM return CALL 72 8 9 Execute a subroutine GOSUB 8 11 Go to line number when an error is detected ONERR 8 12 Conditional GOSUB ON GOSUB 8 14 Generate an interrupt when TIME is equal to or greater than ONTIME 8 14 ONTIME argument line number POP argument stack to variables POP 8 17 PUSH expressions on argument stack PUSH 8 15 Return from interrupt RETI 8 18 RETURN from subroutine RETURN 8 18 Break program execution STOP 8 20 Publication 1746 RM001A US P 8 2 Execution Control and Interrupt Support Functions CALL 16 Enable DF1 Packet Interrupt Publication 1746 RM001A US P Purpose Use CALL 16 to enable the DF1 packet interrupt capability One argument is PUSHed and no arguments are POPped The input argument is the BASIC line number of the begi
224. qual to e 0 ifa device has not read from the DH485 Common Interface File since the last time this CALL was executed or since the module was powered up whichever occurred last e 1 ifa device on the DH485 Serial Communications Link has read the DH485 Common Interface File since this CALL was executed or since the module was powered up whichever occurred last Syntax CALL 87 POP DH485 interface file remote read status Example gt 1 REM EXAMPLE PROGRAM gt 100 CALL 87 REM CHECK FILE STATUS gt 110 POP X REM GET THE STATUS gt 120 IF X lt gt 1 GOTO 100 REM WAIT ON DATA TO BE READ READY gt Publication 1746 RIM001A US P 11 10 Status Functions CALL 95 Get Number of Purpose Characters in PRT1 Buffers Publication 1746 RM001A US P Use CALL 95 to retrieve the number of characters in the chosen buffer of port PRT1 You must PUSH which buffer you want examined e PUSH 1 for the input buffer e PUSH 0 for the output buffer One POP is required to get the number of characters Syntax PUSH buffer selection CALL 95 POP number of characters Example gt 1 REM EXAMPLE PROGRAM gt 10 PUSH 0 REM EXAMINES THE OUTPUT BUFFER gt 20 CALL 95 gt 30 POP X REM GET THE NUMBER OF CHARACTERS gt 40 PRINT NUMBER OF CHARACTERS IN PRT1 OUTPUT BUFFER IS X gt 50 END READY gt RUN NUMBER OF CHARACTERS IN PRT1 OUTPUT BUFFER IS 0 READY gt CALL 97 Enable Port PRT2 DTR Signal CALL
225. quick reference guide 8 3 CALL 55 Check CPU Input Image Buffer quick reference guide 8 3 status function 11 4 Index iii CALL 56 Transfer CPU MO File to BASIC Input Buffer input function 13 18 quick reference guide B 3 CALL 57 Transfer BASIC Output Buffer to CPU M1 File output function 12 76 quick reference guide B 3 CALL 58 Check MO File quick reference guide B 3 status function 11 5 CALL 59 Check M1 File quick reference guide B 3 status function 77 6 CALL 60 String Repeat quick reference guide B 3 string function 15 1 CALL 61 String Append quick reference guide B 3 string function 15 2 CALL 62 Number to String Conversion quick reference guide B 3 string function 15 3 CALL 63 String to Number Conversion quick reference guide B 3 string function 15 4 CALL 64 Find a String in a String quick reference guide B 4 string function 15 6 CALL 65 Replace a String in a String quick reference guide B 4 string function 15 7 CALL 66 Insert a String in a String quick reference guide B 4 string function 15 8 CALL 67 Delete a String in a String quick reference guide B 4 string function 15 9 CALL 68 Find the Length of a String quick reference guide B 4 string function 15 10 CALL 70 ROM to RAM Program Transfer execution control and interrupt support function 8 8 quick reference guide B 4 CALL 71 ROM RAM to ROM Program Transfer execution control and interrupt support function 8 9 quick reference guide B 4 CALL
226. r strings first value in the STRING instruction D u sum of all array sizes 1 lt 1 sum of all variable names used including each array name Syntax Example READY gt RAM Purpose Use the REM command to specify a comment line in a BASIC program Adding comment lines to a program makes the program easier to understand Program lines that start with a REM command cannot be terminated with a colon REM commands can be placed after a colon in a program line This allows you to place a comment on each line Tate REM commands add time to program execution Use them selectively or place them at the end of the program where they do not affect program execution speed Do not use REM commands in frequently called loops or subroutines Publication 1746 RIM001A US P 4 20 BASIC Commands REN ROM Publication 1746 RM001A US P Syntax REM Example gt 10 REM THIS IS A COMMENT LINE gt 20 NEW REM THIS IS ALSO A COMMENT LINE Purpose Use the REN command to renumber program lines Syntax REN new number old number increment Examples Example Result REN Renumbers the entire program The first new line number is 10 Line numbers increment by 10 REN 20 Renumbers the entire program The first new line number is 10 Line numbers increment by 20 REN 300 50 Renumbers the entire program The first new line number is 300 Line numbers increment by 50 REN 1000 900
227. real time clock CLOCKO 7 2 Enable the real time clock CLOCK1 7 1 Set up a conditional do loop DO UNTIL 7 4 Set up a conditional do loop DO WHILE 7 3 Terminate a program execution END 7 5 Set up a for next loop FOR TO STEP NEXT 7 6 Go to the program line number GOTO 7 7 Conditional test IF THEN ELSE 7 8 Test a for next loop condition NEXT 7 9 Conditional GOTO ON GOTO 7 11 Purpose Use the CLOCK statement to enable the free running clock resident on the BASIC or BASIC T module The special function operator TIME is incremented once every 5 milliseconds after the CLOCK1 statement is executed The CLOCK1 statement uses an internal TIMER to generate an interrupt once every 5 milliseconds Because of this the special function operator TIME has a resolution of 5 milliseconds The special function operator TIME counts from 0 to 65535 995 seconds After reaching a count of 65535 995 seconds TIME overflows back to a count of zero The interrupts associated with the CLOCK1 statement cause the module programs to run at about 99 6 of normal speed This means that the interrupt handling for the free running clock uses about 0 4 of the total CPU time IMPORTANT This does not include additional overhead for ON TIME user interrupt handling execution Syntax CLOCK1 Publication 1746 RIM001A US P 7 2 Control Functions CLOCKO Publication 1746 RM001A US P Example gt NEW gt 1 gt 10 gt 15 gt 20 gt 30 gt 4
228. ring to receive the date You must allocate a minimum of 9 characters for the string Publication 1746 RM001A US P 10 8 Clock Calendar Functions Syntax PUSH string number CALL 52 Example gt 1 REM EXAMPLE PROGRAM gt 10 STRING 100 20 gt 20 PUSH 1 CALL 52 REM PUT DATE IN STRING 1 gt 30 PRINT 1 gt 40 END Publication 1746 RM001A US P Status Functions Chapter 11 This chapter describes and illustrates commands that monitor the status of the BASIC or BASIC T module This chapter also describes and illustrates commands that allow the setup of the DF1 driver within the BASIC program or from the command line Table 11 1 lists the corresponding mnemonics Table 11 1 Chapter Reference Guide If you need to Use this mnemonic Page Get the number of characters in PRT2 buffers CALL 36 11 2 Check the CPU output image buffer CALL 51 11 3 Check the CPU input image buffer CALL 55 11 4 Check the MO file status CALL 58 11 5 Check the M1 file status CALL 59 11 6 Check the SLC 500 controller CPU status CALL 75 11 7 Check the battery condition CALL 80 11 8 Check the DH485 interface file remote Write status CALL 86 11 8 Check the DH485 interface file remote Read status CALL 87 11 9 Get the number of characters in the PRT1 buffers CALL 95 1 10 Enable port PRT2 DTR signal CALL 97 1 11 Disable port PRT2 DTR signal CALL 98 1 11 Enable DF1 driver communications CAL
229. rinted is placed in quotes after the INPUT statement If a comma appears before the first variable on the input list the question mark prompt character is not displayed gt 1 REM EXAMPLE PROGRAM gt 10 INPUT ENTER A NUMBER A gt 20 PRINT SOR A gt 30 END READY gt RUN ENTER A NUMBER 24 gt NEW gt 1 REM EXAMPLE PROGRAM gt 10 INPUT ENTER A NUMBER A gt 20 PRINT SQR A gt 30 END gt RUN Publication 1746 RIM001A US P 13 42 Input Functions Publication 1746 RM001A US P ENTER A NUMBER 25 You can also assign strings with an INPUT statement Strings are always terminated with a carriage return cr If more than one string input is requested with a single INPUT statement the module prompts you with a question mark gt 1 REM EXAMPLE PROGRAM gt 10 STRING 100 20 gt 20 INPUT NAME CR AGE 1 A gt 30 PRINT HELLO 1 YOU ARE A YEARS OLD gt 40 END READY gt RUN NAME CR AGE PAM 29 HELLO PAM YOU ARE 29 YEARS OLD READY gt You can assign strings and variables with a single INPUT statement gt 1 REM EXAMPLE PROGRAM gt 10 STRING 100 10 gt 20 INPUT NAME CR AGE 1 A gt 30 PRINT HELLO 1 YOU ARE A YEARS OLD gt 40 END gt RUN NAME CR AGE FRED 15 HELLO FRED YOU ARE 15 YEARS OLD READY gt Input Functions 13 43 LD TTT This instruction is not associated with any port d
230. riod ACKnowledge Timeout specifies in 5 ms increments how long to wait for an ACK NAK before transmitting an ENQuiry The valid range for the ACKnowledge Timeout is 2 to 65535 The third input argument specifies the number of message retries when in half duplex mode or the number of ENQuiry Retries to perform when in full duplex mode Message retries specifies the number of message transmission retry attempts made before giving up and flagging the transmission as failed PUSHing 0 indicates only the initial attempt is made and if not acknowledged by the master the attempt is flagged as failed ENQuiry Retries specifies the number of ENQ s to transmit before a packet transmission is flagged as failed The valid range for both is 0 to 254 The fourth input argument specifies the RTS On Delay time period when in half duplex mode or the number of NAK Received Retries to perform when in full duplex mode RTS On Delay specifies in 5 ms increments the delay between when a Request To Send RTS is activated and a transmission is initiated Only used if HDMwCC or HDMwoCC is selected through the first input argument The valid range for the RTS On Delay is 0 to 65535 NAK Received Retries specifies the number of packet retries to transmit due to receiving NAK responses The valid range for NAK Received Retries is 0 to 254 The fifth input argument specifies the RTS Off Delay time period RTS Off Delay specifies in 5 ms increments the delay between when
231. rocessor interaction The output file word 0 bit 11 will also initiate a string transaction The ninth input argument is the word offset within the CPU file This offset points to the first word of the data If you chose the CPU output image file 0 the offset cannot be 0 since this word is reserved for the data transfer handshaking bits The offset for the internal string is always one The first character of the string transaction number at location 0 is incremented on every successful transfer to inform the module that the data was transferred The value of the transaction number wraps around from 255 to 0 The tenth input argument is the string number If the eighth input argument does not select internal string usage the value of this input argument is ignored but must still be PUSHed The output argument is the validation of the CALL It has the following values 0 Successful e 1 Disabled e 2 Bad input parameter e 3 DFI not enabled e 4 String too small e 5 String is not dimensioned To disable this CALL a zero must be PUSHed into the first input parameter All other parameters are ignored but must still be PUSHed Whenever an attempt is made to write to a remote packet the module places the status of the write into the input word 0 bits 0 7 The possible status codes are shown below This status is valid when the module sets the input file word 0 bit 11 Publication 1746 RIM001A US P 12 32 Output Functions
232. rol value FREE to tell you how many bytes of RAM are available to the user When the current selected program is in RAM the following relationship is true FREE MTOP LEN 511 LEN Use the system control value LEN to tell you how many bytes of memory the currently selected program occupies This is the length of the program and does not include the size of string memory or the variables and array memory usage You cannot assign LEN a value it can only be read A NULL program example no program returns a LEN of 1 The 1 represents the end of program file character MATATA The module does not require any dummy arguments for the system control values Publication 1746 RIM001A US P 3 16 Expressions and Operators Publication 1746 RM001A US P MTOP Use the MTOP operator to retrieve the last valid memory address in RAM that is available to the module After reset the module sizes the external memory and assigns the last valid memory address to the system control value MTOP The module does not use any external RAM beyond the value assigned to MTOP If this value has not been changed by CALL 77 then the last valid BASIC address is 5FFFH 24575 Example Result gt PRINT MTOP 24575 PHO MTOP 5FFFH CBY expr Use the CBY operator to retrieve data from the program or code memory address location of the module You cannot assign CBY a value it can only be read The argument for the CBY operator must be a valid
233. s 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 Hierarchy of Operators Arithmetic Operators Expressions and Operators 3 3 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 44 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 Operators that use parentheses Exponentiation Negation Multiplication and division Addition and subtraction Relational expressions lt gt gt gt lt lt Logical AND AND Logical OR OR Logical XOR XOR Oo
234. s 0 9999 decimal For PLC 3 I O files the value is 0 4095 decimal For PLC 3 timer or counter files the value is 0 If the number is not within this range the status equals 2 and the transfer does not occur The sixth input argument is the number of elements to be transferred If the number is not within the range shown below the status equals 2 and the transfer does not occur Table 12 10 Valid Element Length Range File Type Code Valid Element Length Range _ ASIN lt64 SS ASC S 1 to 64 ASC C 1 to 21 ASC T 1 to 21 ASC B 1 to 64 ASC R 1 to 21 ASC I 1 to 64 ASC O 1 to 64 Common Interface File 1 to 64 Output Functions 12 31 The seventh input argument is the message time out value This value 1 through 255 corresponds to the number of hundreds of milliseconds that are allowed to receive the write response 0 1 through 25 5 seconds If the write response is not received within this time the message aborts with the status equal to 55 in the input file word 1 bits 0 7 If the time out value is not within the range 1 through 255 the POPped status equals 2 and the transfer does not take place The eighth input argument is the selection of the source CPU output image file CPU M0 file or the internal string e 0 CPU output image file e 1 CPU M0 file e 2 Internal string If you chose internal string 2 CALL 29 can be executed to initiate each data transfer without requiring SLC p
235. s 12 15 CLEARI assignment function 6 3 quick reference guide B 7 CLEARS assignment function 6 3 quick reference guide B 7 clock calendar function retrieve date numeric 10 4 retrieve date string 70 7 retrieve date time string 70 4 retrieve day of week numeric 10 7 retrieve day of week string 70 6 retrieve time numeric 70 6 retrieve time string 70 5 set clock calendar date 10 2 set clock calendar time 70 7 set day of week 70 3 CLOCKO control function 7 2 quick reference guide B 7 CLOCK1 control function 7 7 quick reference guide B 7 CONT BASIC command 4 3 quick reference guide B 7 contacting Rockwell Automation for assistance P 5 contents of manual P 2 control stack 7 3 Control C BASIC command 4 4 disable 4 6 enable 4 5 quick reference guide B 7 Control O BASIC command 4 8 quick reference guide B 7 Control S BASIC command 4 7 quick reference guide B 7 conversion 16 Bit Signed Integer to BASIC Floating Point 9 7 16 Bit Unsigned Integer to BASIC Floating Point 9 2 BASIC Floating Point to 16 Bit Binary 9 3 BASIC Floating Point to 16 Bit Signed Integer 9 2 BASIC Floating Point to SLC Floating Point 9 4 number to string 15 3 SLC Floating Point to BASIC Floating Poin 9 5 string to number 15 4 conversion table A 7 COS quick reference guide B 7 Index v CPU Input Image Buffer Status 11 4 CPU Output Image Buffer Status 11 3 D DATA assignment function 6 4 quick reference guide 8 7 data types argument stack 2 1 back
236. s and ports are not re initialized This CALL has no effect until the ONERR command is executed within the program The PUSH determines if this expanded ONERR function is enabled or disabled as shown below e 0 Disable the expanded ONERR restart e 1 or any other number Enable the expanded restart This CALL is reset when the module returns to the Command mode CALL 38 must be re executed every time Run mode is entered Publication 1746 RIM001A US P 8 6 Execution Control and Interrupt Support Functions Publication 1746 RM001A US P If you perform an XBY in the error routine this is a list of the status codes you might receive Table 8 2 Status Codes Status Code Description 01 module attempted to call an illegal call number 02 port has been assigned an invalid parameter 03 string has not been dimensioned 04 defined string length is too small for operation 05 memory has not been allocated for this string 06 attempted to transfer to a RAM or ROM program that did not exist 07 command or call can only be executed from Command mode 08 user PROM has invalid checksum 09 this statement or call requires a user PROM no user PROM is installed 10 divide by zero 11 DH485 call executed and DH485 port not enabled 12 argument stack problem 13 syntax error 14 control stack problem 15 array size problem 16 internal processor stack problem 17 no DATA a
237. s for the trigonometric functions as small as possible The module contains a complete set of functional operators These operators are single operand operators ABS expr Use the ABS operator to return the absolute value of the expression Example Result gt PRINT ABS 5 5 gt PRINT ABS 5 5 NOT expr Use the NOT operator to return a 16 bit one s complement of the expression The expression must be a valid integer example between 0 and 65535 OFFFFH inclusive Non integers are truncated not rounded Example Result gt PRINT NOT 65000 535 gt PRINT NOT 0 65535 Publication 1746 RIM001A US P 3 10 Expressions and Operators Publication 1746 RM001A US P INT expr Use the INT operator to return the integer portion of the expression Example gt PRINT INT 3 7 Result 3 gt PRINT INT 100 876 100 PI PI is a stored constant In the module PI is stored as 3 1415926 SGN expr Use the SGN operator to return a value of 1 if the argument is greater than zero zero if the argument is equal to zero and 1 if the argument is less than zero Example Result gt PRINT SGN 52 1 gt PRINT SGN 0 0 gt PRINT SGN 8 1 SQR expr Use the SQR operator to return the square root of the argument The argument may not be less than zero Example Result gt PRINT SOR 9 3 gt PRINT SQR 45 6 7082035 gt PRINT SQR 100 0 Logarit
238. s of CALLs 36 37 95 and 96 for more information The symbols and can be used to direct the print output to ports PRT1 and PRT2 respectively Publication 1746 RIM001A US P 12 36 Output Functions Publication 1746 RM001A US P Use the PRINT CR expression to output a carriage return without a line feed gt 1 REM EXAMPLE PROGRAM gt 10 PRINT A CR gt 20 PRINT B READY gt RUN The A was printed and then overwritten by the B Use the PRINT SPC expression to output a specified number of spaces gt 1 REM EXAMPLE PROGRAM gt 10 PRINT A SPC 10 B Use the PRINT TAB expression to output a specified number of tab characters gt 1 REM EXAMPLE PROGRAM gt 10 PRINT A TAB 1 B READY gt RUN A B Use the PRINT USING EFx expression to output all numeric values in scientific notation The x represents the total number of digits of the mantissa that are displayed One digit is displayed before the decimal point The value of x is a minimum of three and a maximum of eight The value displayed is adjusted according to these limits gt 1 REM EXAMPLE PROGRAM gt 10 PRINT USING F4 123 45678 READY gt RUN 1 234 E 2 Use the PRINT USING expression to output all numeric values in decimal notation according to the format specified by the instruction PHO PH1 Output Functions 12 37 gt 1 REM EXAMPLE PROGRAM gt 10 PRINT USING gt 20 PRINT 4 67890
239. s valid when the module sets the input file word 0 bit 10 Syntax PUSH type of READ command PUSH remote node address PUSH remote file number PUSH remote file type PUSH starting word offset of remote file PUSH number of words to be transferred PUSH message time out value PUSH selection of destination file PUSH word offset within destination file PUSH string number CALL 27 POP CALL 27 status Example gt 1 REM EXAMPLE PROGRAM gt 10 REM ENABLE REMOTE DH485 READ COMMAND INTERRUPT gt 20 PUSH 2 REM SLC TYPED READ COMMAND gt 30 PUSH 2 REM NODE ADDRESS OF REMOTE SLC gt 40 PUSH 7 REM FILE NUMBER OF REMOTE SLC gt 50 PUSH ASC N REM FILE TYPE OF REMOTE SLC gt 60 PUSH 100 REM REMOTE ELEMENT OFFSET INTO REMOTE SLC FILE gt 70 PUSH 20 REM NUMBER OF ELEMENTS TO BE TRANSFERRED gt 80 PUSH 5 REM MESSAGE TIMEOUT X100MS gt 90 PUSH 1 REM DESTINATION FILE TO PUT DATA M1 FILE gt 100 PUSH O REM WORD OFFSET INTO DESTINATION FILE gt 110 PUSH 0 REM STRING NUMBER NOT AVAILABLE FOR THIS EXAMPLE gt 120 CALL 27 gt 130 POP S gt 140 IF S lt gt 0 THEN PRINT UNSUCCESSFUL CALL 27 SETUP Input Functions 13 13 74 0 TON 0000 Timer On Delay EN gt at DN f Timer T4 0 Initiate CALL 27 in the Time Base 0 01 DN gt module every 10 seconds via Preset 1000 timer T4 0 Accum CALL 27 Request Bit T4 0 0 1 0
240. sen in the first parameter The CIF is always file 9 The fourth input argument is the file type to be written to the remote device This number is ignored if the CIF is chosen in the first parameter assumes integer file Output Functions 12 9 If the file type is not one of these listed below the status equals 2 and the write message does not take place Enter the file type code as shown Table 12 2 FileType File Type File Type Code Words Element Integer File ASC N 1 word element Counter File ASC C 3 words element Timer File ASC T 3 words element Bit File ASC B 1 word element Control File ASC R 3 words element The fifth input argument is the starting word offset within the file on the SLC remote device 0 through 32766 If the number is not within this range the status equals 2 and the transfer does not occur The sixth input argument is the number of words to be transferred If the number is not within the range shown the status equals 2 and the transfer does not occur Table 12 3 Valid Length Range File Type Code Valid Length Range ASC N 1 to 40 ASC C 1 to 13 ASC T 1 to 13 ASC B 1 to 40 ASC R 1 to 13 Common Interface File 1 to 40 The seventh input argument is the message time out value This value 1 through 255 corresponds to the number of hundreds of milliseconds that are allowed to receive the write response 0 1 through 25 5 seconds If the write response is
241. string within the module to a remote DF1 node PLC 2 3 or 5 The following table lists specific notes when using CALL 123 with the PLC 3 and PLC 5 Table 12 8 PLC Application Notes PLC Notes 3 For timers and counters the file number PUSHed third parameter is the structure number limited to a maximum of 255 words Input and output files cannot be accessed with this CALL Choosing these file types will cause a 2 bad input parameter to be POPped 5 For timer data an element is three 16 bit words stored in the source file in the following order Control Preset and Accumulator Ifan internal string is chosen the first character transaction number is incremented upon a successful write transaction to inform the module that string data was written to the PLC The value of the transaction number wraps around from 255 to 0 The DF1 port parameters are set up with CALL 108 The DF1 port can operate with either full duplex or half duplex slave protocol Execute CALL 123 once to set up the data transfer parameters Input and output image bits word 0 bit 11 for the slot containing the module are used to initiate and notify completion of the transfer The operation is described below 1 The SLC processor builds the data buffer and sets output file word 0 bit 11 to inform the module that valid data is available Output File Word 0 Bit 11 SLC Processor SLC Backplane _ BASIC or BASIC T Module 2 Th
242. t The READ statement is always followed by one or more variables If more than one variable follows a READ statement they are separated by a comma Syntax READ Example gt 1 REM EXAMPLE PROGRAM gt 10 FOR I 1 TO 3 gt 20 READ A C gt 30 PRINT A C gt 40 NEXT I gt 50 RESTORE gt 60 READ A C gt 70 PRINT A C gt 80 DATA 10 20 10 2 20 2 SIN PI COS PI READY gt RUN 10 20 5 10 0 1 10 20 Every time a READ statement is encountered the next consecutive expression in the DATA statement is evaluated and assigned to the variable in the READ statement You can place DATA statements anywhere within a program They are not executed and do not cause an error DATA statements are considered chained together and appear as one large DATA statement If at anytime all the data is read and another READ statement is executed the program terminates and the message ERROR NO DATA IN LINE xx prints to the console device Publication 1746 RIM001A US P 13 46 Input Functions Publication 1746 RM001A US P CALL 30 Set PRT2 Port Parameters Chapter 14 Setup Functions This chapter describes and illustrates commands used to set port parameters within the BASIC program or from the command line Table 14 1 lists the corresponding mnemonics Table 14 1 Chapter Reference Guide Ifyou need t Usethis mnemonic Page Setthe PRT2 port parameters CAL30 o o hm Set the program port baud r
243. t the first word The low byte of the first word still contains the byte count The last CALL 23 executed determines the byte swap option for all active CALL 23 and CALL 22 commands previously executed The output argument is the status of the CALL It has the following values 0 Successful e 1 Disabled e 2 Bad input parameter e 3 PRT2 is chosen but it is already enabled for DF1 protocol The CALL is not executed e 4 String is too small e 5 String is not dimensioned Data transfer does not begin until the SLC processor sets output image file word 0 bit 6 or bit 7 depending on the destination port The module sets the input file word 0 bit 6 or bit 7 to indicate a successful transfer to a port If the internal string is chosen as the destination output image file word 0 bit 6 is used to initiate the transfer Input file word 0 bit 6 is set by the module to indicate a successful transfer to the string Syntax PUSH destination port number and or internal string PUSH selection of source file PUSH word offset within the source file PUSH string number PUSH byte swap selection CALL 23 POP CALL 23 status Publication 1746 RIM001A US P 12 6 Output Functions Example gt 1 REM EXAMPLE PROGRAM gt 10 REM ENABLE CALL 23 INTERRUPTS gt 20 PUSH 2 REM SEND DATA TO PRT1 gt 30 PUSH 1 REM GET DATA FROM MO FILE gt 40 PUSH 0 REM WORD OFFSET INTO MO FILE gt 50 PUSH 0 REM STRING NUMBER NOT U
244. te device 0 through 255 If the number is not within this range the status equals 2 and the read message does not occur The parameter is ignored if the common interface file is chosen in the first parameter but must still be PUSHed The fourth input argument is the file type to be read from the PLC remote device Enter the file type code as shown below This argument is ignored if the common interface file is chosen in the first parameter but must still be PUSHed assumes integer type If the file type is not one of these the status equals 2 and the read message does not take place Table 13 10 FileType to be Read from Remote Device File Type File Type Code Words Element 1 word 16 bits Integer File ASC N 1 word element Status File ASC S 1 word element Counter File ASC C 3 words element Timer File ASC T 3 words element Bit File ASC B 1 word element Control File ASC R 3 words element Input File ASC I 1 word element Output File ASC 0 1 word element The fifth input argument is the starting word offset within the file on the PLC 2 remote device 0 through 32766 For PLC 3 integer binary or status files the value is 0 9999 For PLC 3 I O files the value is 0 4095 For PLC 3 timer or counter files the value must be 0 If the number is not within this range the status equals 2 and the transfer does not occur The sixth input argument is the number of elements to be transferred If the nu
245. ter PUSH selection of destination file and or string PUSH word offset within the destination file PUSH string number PUSH byte swap selection CALL 22 POP CALL 22 status 0000 0001 Example gt 1 gt 10 gt 20 PUSH 1 gt 30 PUSH 10 gt 40 PUSH 13 gt 50 PUSH 1 gt 60 PUSH 0 gt 70 PUSH 0 gt 80 PUSH 1 gt 90 CALL 22 gt 100 POP S Input Functions 13 7 REM EXAMPLE PROGRAM REM ENABLE CALL 22 INTERRUPTS REM PRT1 ACTIVE FOR CALL 22 REM RECEIVING 10 BYTES OF DATA MAXIMUM REM lt CR gt USED AS TERMINATION CHARACTER 13 DECIMAL REM SEND DATA TO M1 FILE REM OFFSET INTO M1 FILE REM STRING NUMBER NOT USED REM BYTE SWAPPING ENABLED REM STATUS OF CALL 22 SETUP gt 110 IF S lt gt 0 THEN PRINT UNSUCCESSFUL CALL 22 SETUP gt 120 END Below is a sample ladder logic program for CALL 22 The module is located in slot 1 of the SLC chassis At rung 0000 copy data from the M1 file when the handshake bit I 1 0 8 is set by the module The SLC sets handshake bit O 1 0 8 once the data has been copied out of the M1 file This informs the module to turn off I 1 0 8 The first word of the M1 file contains the byte count and this word is not included in the data byte count A maximum of 10 bytes of data is expected in this example OP Copy File 8 Handshake Bit from Module to SLC Processor Source M1 1 0 Dest N7 0 Length 6 Handshake Bit from SLC Proc
246. ternal string the CPU M1 file with or without the internal string or the internal string alone e 0 CPU input image file e 1 CPU MI file e 2 CPU input image file and internal string e 3 CPU M1 file and internal string e 4 Internal string only When transferring data to the internal string of the module check your transaction number for string updates because there is no indication that data has been placed in the internal string Your BASIC program must check the transaction number to verify that the data was updated The fifth input argument is the word offset within the destination CPU file If the CPU input data file is chosen this offset must not be 0 or 1 since word 0 and 1 are reserved Zero is reserved for data transfer handshaking bits and word 1 is reserved for the transaction status A 0 or 1 will cause a CALL status of 2 to be POPped This offset points to the buffer location of the byte count If the M1 file is chosen the offset can be zero If the internal string is chosen data placement always begins with the third character of the string The first character contains the byte count and the second character contains the transaction number Therefore the offset value has no effect on string data placement only on input image file and M1 file data placement The sixth input argument is the string number If the fourth input argument does not select internal string usage the value of this input argument is ignored but
247. that contains status file data SLC 500 and MicroLogix 1000 1747 6 15 and instruction set information for SLC 500 Instruction Set Reference Manual processors A description of how to install and use a module DH 485 RS 232C Interface Module User s 1747 6 12 that acts as a bridge between DH485 networks Manual and devices requiring DF1 protocol An application example demonstrating how to ASCII Data Transfer to the SLC 500 1746 2 41 transfer ASCII data to an SLC 5 02 or later BASIC Module Series B processor using a remote SLC 500 BASIC module In depth information on grounding and wiring Allen Bradley Programmable Controller 1770 4 1 Allen Bradley programmable controllers Grounding and Wiring Guidelines A glossary of industrial automation terms and Allen Bradley Industrial Automation AG 7 1 abbreviations Glossary An article on wire sizes and types for grounding electrical equipment National Electric Code Published by the National Fire Protection Association of Boston MA 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 Publication 1746 RIM001A US P P 4 Terms and Abbreviations The following terms and abbreviations are specific to this product For a complete listing of Allen Bra
248. the Logic Processor It can have one of the following values e 0 Logic processor is in the Run mode e 1 Logic processor is not in the Run mode Word integrity is guaranteed during this transfer File integrity is not Handshaking bits can be used in your application program to provide file integrity All data transferred to the module from the SLC 500 processor must be routed through the module input buffer Table 13 4 lists the definition of the addresses in the module input buffer Table 13 4 Module Input Buffer Addresses Address Definition 0 to 39 Data transferred from the DH485 common interface file 40 to 99 Reserved 100 to 163 Data transferred from the SLC 500 CPU module M0 file 164 to 199 Reserved 200 to 207 Data transferred from the SLC 500 CPU output image table Syntax CALL 53 POP processor status Example gt 1 REM EXAMPLE PROGRAM gt 30 CALL 53 REM XFER CPU OUTPUT IMAGE TO BASIC INPUT BUFFER gt 40 POP X REM LOGIC PROCESSOR STATUS gt 50 IF X lt gt 0 THEN PRINT PROCESSOR NOT IN RUN MODE READY gt RUN Publication 1746 RIM001A US P 13 18 Input Functions CALL 56 Transfer CPU M0 File to BASIC Input Buffer Publication 1746 RM001A US P Purpose Use CALL 56 to transfer up to 64 words starting at word 0 of the CPU M0 file to the module input buffer starting at word 100 This routine has one input argument and one output argument The input argument is the nu
249. tion halts until an ONTIME condition is met The ONTIME interrupt must be enabled before executing the IDLE command or else the module enters a wait forever mode CTRL C exits the IDLE command if cTRL C is enabled Syntax IDLE Example gt 1 REM EXAMPLE PROGRAM gt 10 TIME 0 gt 20 CLOCK1 gt 30 ONTIME 2 70 gt 40 IDLE gt 50 PRINT END OF TEST gt 60 END gt 70 PRINT TIMER INTERRUPT AT TIME SECONDS gt 80 RETI READY gt RUN TIMER INTERRUPT AT 2 005 SECONDS END OF TEST BASIC Commands 4 11 LIST Purpose Use the LIST command to print the program to the console device Spaces are inserted after the line number and before and after statements This helps in the debugging of module programs You can terminate the listing of a program at any time by pressing CTRL C on the console device You can interrupt and continue the listing using CTRL S and CTRL Q Te GA CTRE C terminates the listing if ctRL c checking is enabled CTRL S halts the listing until cTRL Q is pressed if software handshaking in enabled Syntax LIST In num LIST In num In num The first variation causes the program to print from the designated line number In num to the end of the program The second variation causes the program to print from the first designated line number In num to the second designated line number In num IMPORTANT You must separate the two line n
250. to RROM 1 Since the programs are stored in sequence in EEPROM the integer following the RROM command selects the program the user wants to run or list If you attempt to select a program that does not exist example you type RROM 8 and only 6 programs are stored in the EEPROM the message ERROR PROM MODE is displayed The module does not transfer the program from EEPROM to RAM when ROM mode is selected If you attempt to alter a program in ROM mode by typing in a line number the message ERROR PROM MODE is displayed The XFER command allows you to transfer a program from EEPROM to RAM for editing purposes You do not get an error message if you attempt to edit a line of RAM program the previous RAM contents Since the RROM command does not transfer a program to RAM it is possible to have different programs in ROM and RAM simultaneously You can move back and forth between the two modes when in Command mode If you are in Run mode you can change back and forth using CALLS 70 71 and 72 You can also use all of the RAM for variable storage if the program is stored in EEPROM The system control value MTOP always refers to RAM The system control value LEN refers to the currently selected program in RAM or ROM Syntax RROM integer Example READY gt RROM Purpose Use the RUN command to set all variables equal to zero clear all BASIC evoked interrupts and begin program execution with the first line number of the selected program
251. to convert Convert BASIC floating point to SLC 9 4 PUSH output buffer to receive converted floating point value CALL 89 PUSH input buffer of value to be converted Convert SLC floating point to BASIC 9 5 floating point Publication 1746 RM001A US P BASIC Command Statement and CALL Quick Reference Guide B 5 Mnemonic Required PUSHes or POPs Description Active In Page Command Mode Only CALL 90 PUSH remote device node address Read remote DH485 data file to BASIC input 13 20 PUSH remote device file number buffer PUSH remote device file type PUSH starting element offset x2 of remote device file PUSH number of elements to be transferred PUSH message time out value POP status of message instruction CALL 91 PUSH remote device node address Write module output buffer to remote DH485 12 18 PUSH remote device file number data file PUSH remote device file type PUSH starting element offset x2 of remote device file PUSH number of elements to be transferred PUSH message time out value POP status of message instruction CALL 92 PUSH remote device node address Read remote DH485 interface file to module 13 23 PUSH starting element offset x2 of remote input buffer device file PUSH number of words to be transferred PUSH message time out value POP status of message instruction CALL 93 PUSH remote device node address
252. to include a line IMPORTANT The first line of your program must be a comment Publication 1746 RIM001A US P 1 2 Language Elements Publication 1746 RM001A US P 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 9 20 7 30 10 40 1S 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 Data Types Chapter 2 Data Types This chapter provides you a method of defining or displaying data within the BASIC programming language through the use of e data types e variables Data types are broken down into three sections argument stack string and numeric
253. tored The programmer can determine by using this CALL where the empty space in the memory module is located and how much space is available No PUSHes or POPs are needed Syntax CALL 82 Example gt CALL 82 8010H 805CH gt ROM 1 805DH 80A9H gt ROM 2 80AAH 80F6H gt ROM 3 80F7H FFFFH gt UNUSED gt Purpose Use CALL 101 to upload the code in the user memory module to the host terminal This CALL requires two PUSHes and no POPs The first PUSH is the starting address The second PUSH is the ending address This CALL converts data within the address range to Intel Hex format then prints the information to the program port An error message is printed if the addresses are not consistent Command Line CALLs 5 5 Syntax PUSH starting address PUSH ending address CALL 101 Example gt PUSH 8000 PUSH 804FH CALL 101 108000003107021327CC3313276607005FFF473081 108010005509000A8B41E034290D1000149C3130C1 108020002C32302C33302C34300D0A001EA049EA9B 1080300030A6330D0900289B41E049290D06003286 1080400097490D0A003CA0 4AEA4FA6330D090046A5 00000001F CALL 103 Print PRT1 Purpose Output Buffer and Use CALL 103 to print the complete output buffer with address front pointer and Pointer k 3 r 3 number of characters in the buffer to the program port screen No PUSHes or POPs are needed Use this information as a troubleshooting aid It does not affect the contents of the buffer S
254. tring 15 7 string operators 3 12 ASC 3 12 CHR 3 14 Subtract arithmetic operator 3 4 quick reference guide 8 10 T TAN quick reference guide 8 10 terms and abbreviations P 4 TIME quick reference guide 8 10 special function operator 3 17 Transfer BASIC Output Buffer to CPU M1 File 12 16 Transfer BASIC Output Buffer to DH485 Common Interface File 12 17 Transfer CPU MO File to BASIC Input Buffer 13 18 Transfer CPU Output Image to BASIC Input Buffer 73 77 Transfer Data from Port 1 or 2 to the CPU Files 73 2 Transfer DH 485 Interface File to BASIC Input Buffer 73 79 Transmit DF1 Packet output function 12 26 trigonometric operators AIN 3 8 COS 3 8 SIN 3 8 TAN 3 8 troubleshooting contacting Rockwell Automation P 5 U Unsolicited Writes 13 26 Upload User Memory Module Code to Host 5 4 User LED Control 12 25 User Memory Module Check and Description 5 3 V variables in general 2 4 name of 2 5 type of 2 5 VER BASIC command 4 25 quick reference guide B 10 Index xi WwW Write BASIC Output Buffer to Remote DH485 Data File 12 18 Write Output Buffer to Remote DH485 Common Interface File 12 22 Write to Remote DF1 PLC Data File 12 28 Write to Remote DH485 SLC Data File 12 6 X XBY quick reference guide B 10 special function operator 3 17 XFER BASIC command 4 26 quick reference guide B 10 Publication 1746 RM001A US P xii Index Publication 1746 RM001A US P Reach us now at www rockwellautomation co
255. ts This CALL terminates DF1 communication immediately even if the serial transmission of a data packet is in progress You should write your user program so that it completes any transmission before performing CALL 113 This CALL clears the PRT2 transmission and receive buffers Syntax CALL 113 Example gt 1 REM EXAMPLE PROGRAM gt 10 CALL 113 gt 20 END Purpose Use CALL 120 to clear the module input and output buffers This routine has one input argument and no output arguments The input argument is an 8 bit word CALL 121 Get SLC Processor Program ID Number Status Functions 11 19 that corresponds to the module input and output buffers as shown in the table below Table 11 4 Information for Clearing Input and Output Buffer Bit Decimal Equivalent Module Input and Output Buffer Areas 0 1 SLC MO File 1 2 SLC M1 File 2 4 SLC Output Image Table 3 8 SLC Input Image Table 4 16 Common Interface Input File 5 32 Common Interface Output File 6 Not Used 7 Not Used You must PUSH the decimal equivalent of the areas of the input and output buffers that you want to clear For example to clear the SLC MO and SLC M1 files you would PUSH the value 3 The module sets bits 0 and 1 true and clears the SLC MO and M1 file areas of the input and output buffers These bits set TRUE Push3 0000001 1 SLC M1 File Bit SLC M0 File Bit Syntax PUSH decimal equivalent CALL 120 Example
256. tus function 11 18 CALL 114 Transmit DF1 Packet output function 12 26 quick reference guide 8 6 CALL 115 Check DF1 XMIT Status output function 12 27 quick reference guide 8 6 CALL 117 Get DF1 Packet Length input function 13 25 quick reference guide 8 6 CALL 118 PLC SLC Unsolicited Writes input function 13 26 quick reference guide 8 6 CALL 119 Reset PRT2 to Default Settings quick reference guide 8 6 setup function 14 4 CALL 120 Clear Module Input and Output Buffers quick reference guide 8 6 status function 11 18 CALL 121 Get SLC Processor Program ID Number quick reference guide 8 6 status function 11 19 CALL 122 Read Remote DF1 PLC Data File input function 13 30 quick reference guide 8 6 CALL 123 Write to Remote DF1 PLC Data File output function 12 28 quick reference guide 8 7 CALL 14 16 Bit Signed Integer to BASIC Floating Point math and backplane conversion function 9 1 quick reference guide 8 1 CALL 15 16 Bit Unsigned Integer to BASIC Floating Point math and backplane conversion function 9 2 quick reference guide 8 1 CALL 16 Enable DF1 Packet Interrupt execution control and interrupt support function 8 2 quick reference guide 8 1 CALL 17 Disable DF1 Packet Interrupt execution control and interrupt support function 8 3 quick reference guide 8 1 CALL 18 Enable Control C BASIC command 4 5 quick reference guide 8 1 Publication 1746 RM001A US P CALL 19 Disable Control C BASIC command
257. umbers with a dash 1 REM EXAMPLE PROGRAM 10 PRINT LOOP PROGRAM 20 FOR I 1 TO 3 30 PRINT I 40 NEXT I 50 END READY gt LIST 30 1 REM EXAMPLE PROGRAM 30 PRINT I 40 NEXT I 50 END READY gt LIST 20 40 1 REM EXAMPLE PROGRAM 20 FOR I 1 TO 3 30 PRINT I 40 NEXT I Publication 1746 RIM001A US P 4 12 BASIC Commands LIST LIST MODE Publication 1746 RM001A US P Purpose Use the LIST command to print the program to the device attached to port PRT1 All comments that apply to the LIST command apply to the LIST command You must configure PRT 1 port parameters to match your particular list device The PRT1 parameters baud rate parity stop bits and so on can be set using the MODE command Syntax LIST Examples LIST REM LISTS ALL LINES IN THE PROGRAM LIST 10 20 REM LISTS LINES 10 THROUGH 20 Purpose Use the LIST command to print the program to the device attached to port PRT72 All comments that apply to the LIST command apply to the LIST command You must configure the PRT 2 port parameters to match your particular list device The PRT2 parameters baud rate parity stop bits and so on can be set using the MODE command Syntax LIST Example Refer to LIST examples Purpose Use the MODE command to set the port parameters of ports PRT 1 PRT2 and DH485 Table 4 3 lists the port parameters and default settings for ports PRT1 and PRT 2 Table 4 4 lists the port
258. ut buffer CALL 92 13 23 Get the DF1 packet length CALL 117 13 25 Allow unsolicited writes from a remote SLC or PLC node CALL 118 13 26 Read a PLC data file CALL 122 13 30 Read the console input device GET 13 38 Read the console input device connected to PRT2 GET 13 38 Read the console input device connected to PRT1 GET 13 38 Read a line of characters from the program port buffer INPL 13 39 Read a line of characters from the port PRT2 buffer INPL 13 39 Read a line of characters from the port PRT1 buffer INPL 13 39 Read a string of characters from the program port buffer INPS 13 40 Read a string of characters from the port PRT2 buffer INPS 13 40 Read a string of characters from the port PRT1 buffer INPS 13 40 Input a string or variable INPUT 13 40 Input a string or variable from port PRT2 INPUT 13 40 Input a string or variable from port PRT1 INPUT 13 40 Load a variable LD 13 43 READ data in the data statement READ 13 45 Publication 1746 RM001A US P 13 2 Input Functions CALL 22 Transfer Data from Port 1 or 2 to the CPU Files DESTINATION BUFFER Purpose Use CALL 22 to transfer data from the module serial ports directly to the CPU input data file CPU M1 file and or an internal string within the module During data transfer data is automatically transferred in 8 bit blocks from the input buffer of the selected port to the selected SLC processor buffer and or BASIC internal string for storage T
259. vailable for READ 18 DF1 cannot be enabled JW4 in wrong position 19 e illegal user of PRT2 while DF1 is enabled e illegal use of PRT2 while background DF1 task is enabled e attempted to transmit DF1 packet before DF1 is enabled e attempted to transmit DF1 packet of incorrect length 20 arithmetic overflow value too large for range 21 bad line number 22 JW5 in 8 point position 30 arithmetic underflow value too small for range 40 bad argument Execution Control and Interrupt Support Functions 8 7 Syntax PUSH 0 or 1 CALL 38 Example gt 1 REM EXAMPLE PROGRAM gt 10 REM ENABLE EXPANDED ONERR FUNCTION gt 20 ONERR 160 gt 30 PUSH 1 gt 40 CALL 38 gt 50 CALL 53 REM GET DATA FROM OUTPUT IMAGE gt 60 PUSH 201 REM ADDRESS OF SECOND WORD IN BUFFER gt 70 CALL 14 REM GET DATA FROM INPUT BUFFER gt 80 POP X REM VALUE FROM INPUT BUFFER gt 90 A X 2 499733 8191 625 gt 100 PUSH A REM RESULT OF ABOVE CALCULATION gt 110 PUSH 201 REM WORD NUMBER OF BASIC OUTPUT BUFFER gt 120 CALL 24 REM BASIC FLOATING POINT TO 16 BIT SIGNED INTEGER gt 130 CALL 54 REM OUTPUT BUFFER TO SLC INPUT FILE gt 140 POP Y REM SLC PROCESSOR STATUS gt 150 IF Y lt gt 0 THEN PRINT PROCESSOR NOT IN RUN MODE gt 160 GOTO 50 gt 170 PRINT ERROR CODE WAS XBY 257 REM BEGINNING OF ONERR ROUTINE gt 175 PRINT AT LINE 256 XBY 69FDH XBY 69FEH gt 180 GOTO 50 gt 190 END The error in the examp
260. value of the ASCII character placed in the parentheses gt 1 REM EXAMPLE PROGRAM gt 10 PRINT ASC a gt 20 PRINT ASC A READY gt RUN 65 65 READY The decimal representation for the ASCII character A is 65 The decimal representation for the ASCII character a is 97 However the module capitalizes all ASCII characters not contained within quotation marks Similarly special ASCII characters whose decimal value is greater than 127 should not be used In addition you can evaluate individual characters in a defined ASCII string with the ASC operator gt 1 REM EXAMPLE PROGRAM gt 5 STRING 1000 40 gt 10 1 THIS IS A STRING gt 20 PRINT 1 gt 30 PRINT ASC 1 1 gt 40 END READY gt RUN THIS IS A STRING 84 READY gt Publication 1746 RM001A US P Expressions and Operators 3 13 When you use the ASC operator as shown above the expr denotes what string is accessed The expression after the comma selects an individual character in the string In the above example the first character in the string is selected The decimal representation for the ASCII character T is 84 String character position 0 is invalid gt NEW gt 1 REM EXAMPLE PROGRAM gt 5 STRING 1000 40 gt 10 1 ABCDEFGHIKJL gt 20 FOR X 1 TO 12 gt 30 PRINT ASC 1 X gt 40 NEXT X gt 50 END 65 66 67 68 69 70 71 72 73 75 74 76 The numbers printed in the previous example represent the ASCII characters
261. with the next packet when it is received Reset Output File Word 0 Bit 12 SLC Processor SLC Backplane BASIC or BASIC T Module Publication 1746 RIM001A US P 13 28 Input Functions Publication 1746 RM001A US P The SLC processor must not set then reset the output file word 0 bit 12 on the same ladder logic scan cycle If this occurs the module may miss the bit being set This CALL is active until it is re executed with different input parameters If this occurs the previous CALL 118 is automatically disabled and the new CALL 118 takes effect Multiple CALL 118s are not executed in parallel This CALL has five input arguments and one output argument The first input argument enables or disables the CALL e 0 Disable the previously executed CALL 118 e 1 Enable the CALL The following commands are acceptable PLC Unprotected writes PLC Word range writes PLC Typed writes SLC 5 02 Unprotected writes SLC 5 02 Typed writes If the data received exceeds the string length or CPU file size the remaining data is truncated The second input argument is the selection of the destination CPU input image file with or without the internal string the CPU M1 file with or without the internal string or the internal string alone e 0 CPU input image file e 1 CPU MI file e 2 Internal string e 3 CPU input image file and internal string e 4 CPU M1 file and internal string If t
262. x CALL 114 CALL 115 Check DF1 XMIT Status Output Functions 12 27 Example gt 1 REM EXAMPLE PROGRAM gt 10 CALL 114 gt 20 END Purpose Use CALL 115 to check the DF1 transmit status This routine has no input arguments and one output argument The output argument returns a value that represents the DF1 transmit status The possible DF1 transmit status values are shown below e 0 No transmit result pending e 1 Transmit result pending e 2 Transmission successful e 3 Transmission failed e 4 Enquiry timeout no transmission e 5 If modem handshaking is selected either a loss of CTS signal while transmitting or a fatal transmitter failure has occurred If no handshaking is selected a fatal transmitter failure has occurred e 6 If modem handshaking with constant carrier has been selected for either half duplex or full duplex modes this error indicates transmission failure due to modem disconnection DCD signal loss for more than 10 seconds e 7 DFI driver is not enabled MTAA Lcamsmic status value 4 should never be returned if full duplex mode is selected Syntax CALL 113 POP DF1 transmit status Example gt 1 REM EXAMPLE PROGRAM gt 10 CALL 113 gt 20 POP X gt 30 END Publication 1746 RM001A US P 12 28 Output Functions CALL 123 Write to Purpose Remote DF1 PLC Data Fil Use CALL 123 to write up to 64 words of data from the CPU output image file le the CPU M0 file and or a
263. ycle in which the output file word 0 bit 6 or bit 7 was reset Reset Input File Word 0 Bit 6 q or Bit 7 SLC Processor SLC Backplane BASIC or BASIC T Module Publication 1746 RIM001A US P 12 4 Output Functions Publication 1746 RM001A US P Transfers continue in this manner until the CALL for the port is re executed with different input parameters If this occurs the previous CALL 23 for the port is automatically disabled and the new CALL 23 takes effect Multiple CALL 23s for the same port are not executed in parallel However port 1 and port 2 can be activated simultaneously by issuing separate CALL 23s for these ports This CALL has five input arguments and one output argument The first input argument chooses the destination of the data It can be the port number 1 or 2 and or the internal string e 0 Disable CALL 23 for all active ports and strings enabled by earlier CALL 23s e 1 Internal string only e 2 Serial port 1 e 3 Internal string and serial port 1 e 4 Serial port 2 e 5 Internal string and serial port 2 If an internal string 1 3 or 5 is chosen the first character of the string contains the byte count The second character transaction number is incremented to inform the module that new data is in the string The value of this character wraps around from 255 to 0 The data from the source buffer begins with the third character of the string The second input argument is the selection
264. yntax CALL 103 Publication 1746 RIM001A US P 5 6 Command Line CALLs CALL 104 Print PRT1 Input Buffer and Pointer Publication 1746 RM001A US P Example gt CALL 103 PRT1 Output Queue 6DOOH 3AH 31H 30H 38H 30H 34H 30H 30H 30H 39 6D10H 41H 30H 30H 33H 43H 41H 30H 34H 41H 45 6D20H 33H 30H 33H 30H 48H 20H 33H 33H 48H 20 6D30H 48H 20H 32H 30H 48H 20H 33H 33H 48H 20 6D40H 48H 20H 32H 30H 48H 20H 33H 33H 48H 20 6D50H 48H 20H 32H 30H 48H 20H 33H 34H 48H 20 6D60H 36H 44H 33H 30H 48H 20H 34H 38H 48H 20 6D70H 48H 20H 32H 30H 48H 20H 33H 34H 48H 20 6D80H 36H 44H 37H 30H 48H 20H 34H 38H 48H 20 6D90H 48H 20H 33H 30H 48H 20H 34H 38H 48H 20 6DAOH 48H 20H 33H 34H 48H 20H 34H 38H 48H 20 6DBOH 48H 20H 33H 38H 48H 20H 34H 38H 48H 20 6DCOH 48H 20H 33H 38H 48H 20H 34H 38H 48H 20 6DDOH 48H 20H 33H 30H 48H 20H 34H 38H 48H 20 6DEOH 48H 20H 33H 34H 48H ODH OAH 20H 36H 44 6DFOH 48H 20H 32H 30H 48H 20H 33H 33H 48H 20 Output queue front pointer is 6D29H Purpose Use CALL 104 to print the complete input buffer with address front pointer and 37 41 33 33 33 33 32 33 32 32 32 32 32 32 43 33 34 34 30 33 30 38 30 38 30 30 30 30 30 30 30 38 KoA BD DB BRB BR RA BR BR OB OB OB OB OB o o oo ar 30 41 20 20 20 OD 20 OD 20 20 20 20 20 20 20 20 44 36 34 34 34 OA 3

Download Pdf Manuals

image

Related Search

Related Contents

LA MEDIATION FAMILIALE EN SAONE ET LOIRE :mode d`emploi  User Manual  notice montage convoyeurs  Mode d'emploi  GUIA DO UTILIZADOR  Nortel Ethernet Switch 425-24T + EU Power Cord  Visualizzazione  14.その他 (P94~P98)  Hampton Bay EC3470BA Use and Care Manual  SERIE BCR  

Copyright © All rights reserved.
Failed to retrieve file