Allen-Bradley 1747-PBASE Programming Manual
Allen-Bradley 1747-PBASE Programming Manual

Allen-Bradley 1747-PBASE Programming Manual

Basic development software
Table of Contents

Advertisement

BASIC Development
Software
(Catalog Numbers 1747-PBASE)
Programming Manual

Advertisement

Table of Contents
loading
Need help?

Need help?

Do you have a question about the 1747-PBASE and is the answer not in the manual?

Questions and answers

Summary of Contents for Allen-Bradley 1747-PBASE

  • Page 1 BASIC Development Software (Catalog Numbers 1747-PBASE) Programming Manual...
  • Page 2 Important User 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 Information 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.
  • Page 3: Table Of Contents

    Table of Contents Preface Who Should Use This Manual ......P-1 Purpose of this Manual .
  • Page 4 Table of Contents Chapter 3 Configuring Your Software Setup and Configuration Menu ......3-1 Command Line Switches .
  • Page 5 Table of Contents Chapter 6 Writing Programs Using the Overview of the Language ........6-1 Translator Directives .
  • Page 6 Table of Contents Chapter 9 Communicating with the Changing to Terminal Mode ....... 9-1 Downloading File .
  • Page 7 Table of Contents Appendix B The DOS Directory Shell Using the DOS Directory Shell......B-1 DOS Directory Shell Operation.
  • Page 8 Table of Contents Publication 1746-PM001A-US-P...
  • Page 9: Preface

    • Rockwell Automation support Who Should Use This Use this manual if you are responsible for designing, installing, programming, or troubleshooting control systems that use Allen-Bradley small logic controllers. Manual You should have a basic understanding of SLC 500™ products, PLC products, and 1771 and 1746 I/O products.
  • Page 10: Purpose Of This Manual

    Purpose of this Manual This manual is a programming guide when using the BASIC Development Software, 1747-PBASE. Chapter Title Contents Preface Describes the purpose, background, and scope of this manual. Also lists related publications. Installing the Software Described how to install the BASIC Development Software onto your personal computer.
  • Page 11 1747-6.12 that acts as a bridge between DH485 networks Manual and devices requiring DF1 protocol. 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...
  • Page 12: Terms And Abbreviations

    Terms and Abbreviations The following terms and abbreviations are specific to this product. For a complete listing of Allen-Bradley terminology, refer to the Allen-Bradley Industrial Automation Glossary, publication number ICCG-7.1. • A-Stack error — occurs when too many expressions are PUSHed onto the argument stack or when you attempt to POP data that does not exist •...
  • Page 13: Conventions Used In This Manual

    Conventions Used in this The following conventions are used throughout this manual: • Bulleted lists such as this one provide information, not procedural steps. Manual • Numbered lists provide sequential steps or hierarchical information. • Italic type is used for emphasis. •...
  • Page 14: Your Questions Or Comments On This Manual

    Your Questions or Comments on this Manual If you find a problem with this manual, please notify us of it on the enclosed Publication Problem Report. If you have any suggestions for how this manual could be made more useful to you, please contact us at the address below: Rockwell Automation Control and Information Group...
  • Page 15: Installing The Software

    Chapter Installing the Software This chapter begins with a general description of your BASIC Development Software and then steps you through installing the software on your personal computer. Major topics include: • a general description of the BASIC Development Software •...
  • Page 16: Hardware Requirements

    Installing the Software • linedraw facility that lets you program graphic screens that translate into BASIC and can be executed from the module • simple text formatting features including intelligent word wrap and reformat, indent and outdent • mouse support to speed menu selections •...
  • Page 17: Installation Procedure

    Installing the Software To interface the communication port (COM1 or COM2) on your personal computer with port DH485 on the module, use an Allen-Bradley 1747-PIC Interface/Converter: • for direct connection to port DH485 on the module • plus an Allen-Bradley 1747-AIC Isolated Link Coupler to interface your...
  • Page 18 Installing the Software When modifying your path command in the autoexec.bat file, IMPORTANT remove any other directories from the existing path. Add to the end of the current path line. This C:\ABBASIC\BDS; assumes you are installing your BASIC Development Software on the hard drive called C:.
  • Page 19: Directory Structure

    Installing the Software You may also choose a different drive. If the drive you choose has sufficient memory, the installation procedure continues. You are prompted to approve or alter the directory in which the software is to be installed: Specify main directory in which to install files. C:\ABBASIC Press to accept the directory name or type a new directory name and press...
  • Page 20: Backing-Up Your Software

    Installing the Software Backing-up Your ATTENTION Software This software is protected under the copyright laws of the United States. Unauthorized reproduction of copyrighted software violates U.S. copyright laws. Criminal penalties may include fines or imprisonment. You need as many blank, double-sided, double density disks for backup as you received for the original software installation (two-3.5 inch or three 5.25 inch disks).
  • Page 21: Getting Familiar With Your Development Software

    Chapter Getting Familiar with Your Development Software This chapter is intended to give you an overview of the BASIC development software so that you can understand the software’s general structure. The topics in this chapter include: • software start-up Starting Your Software •...
  • Page 22: Toplevel Menu

    Getting Familiar with Your Development Software Toplevel Menu The Toplevel menu allows you to create and edit your BASIC program. Table 2.1 Toplevel Menu Selections Selection Description Select a project allows you to select a project file through your own custom menu. Selecting file a project file is also available from the Other menu, and is described in Chapter 5.
  • Page 23: Status Line

    Getting Familiar with Your Development Software Figure 2.1 Window A ↑ Status Line 1747-PBASE V X.XX [Text Edit] Ins 175k 06-12-91 1:15pm File Window Block cUrsor Search Text Layout Print Macro Config Other Exit Message Line Labels for Current Window +=+A+========================================================??No-File??+====+ |>>...
  • Page 24: Message Line

    Help is context-sensitive, meaning that a help screen appropriate for the current subject appears. If you are not working on any specific subject at the time, 1747-PBASE REFERENCE GUIDE - TABLE OF appears. CONTENTS 2.
  • Page 25: Using Help Within A Program

    . From there you can 1747-PBASE REFERENCE GUIDE - TABLE OF CONTENTS select other topics that may be of benefit. There is also a comprehensive Help Index that can be selected.
  • Page 26: Navigating Within Windows

    Getting Familiar with Your Development Software Figure 2.2 File Dialog Box 1747-PBASE V x.xx [Text Edit] Ins 175k 06-12-91 1:15pm File Window Block cUrsor Search Text Layout Print Macro Config Other Exit +------------------FILE-------------------+ |Edit new file... |=========================?No-File?=+ |Load file into current window... <ShftF5>| |Save file in current window |save file As...
  • Page 27 Getting Familiar with Your Development Software Figure 2.3 Window Labels 1747-PBASE V x.xx [Text Edit] Ins 175k 06-12-91 1:15pm File Window Block Cursor Search Text Layout Print Macro Config Other Exit +=+A+=======D:\ABBASIC\BAS\BASE#1=+ +=+B+= =======D:\ABBASIC\BAS\BASE#2===+ |100 (this is BASE #1) |100 (this is BASE #2)
  • Page 28 Getting Familiar with Your Development Software Figure 2.4 Adjusting the Current Window 1747-PBASE V x.xx [Text Edit] Ins 175k 06-12-91 1:15pm File Window Block cUrsor Search Text Layout Print Macro Config Other Exit +----------WINDOW----------+ +=+A+|Open |=====================C:\ABBASIC\BAS\FIRST.BDL==+ |Close |Split |List... <AltF1>...
  • Page 29: Editing A Basic Program

    Getting Familiar with Your Development Software Editing a BASIC Program The BASIC Development Language (BDL) streamlines BASIC programming by providing a number of screen editing features, open-format line entry, and macros. Macros are commands that represent a more complex series of BASIC commands. After you finish writing your program in the BASIC development language, you must translate/compile it into the BASIC language that the BASIC or BASIC-T module understands.
  • Page 30: Saving Your Program

    2-10 Getting Familiar with Your Development Software 5. 5. 5. 5. Use the previously saved program: 6. 6. 6. 6. Move the cursor to the top left corner of the window. 7. 7. 7. 7. Type in the following program: {THIS IS A FIRST PROGRAM} REM FIRST PROGRAM FOR X=1 TO 100...
  • Page 31: Translating Your Program

    To do so requires that you connect the module to one of your personal computer’s serial ports (COM1 through COM8). If you have the Allen-Bradley 1784-KR card installed in your personal computer, you could connect to this instead of a serial port.
  • Page 32: Changing To Terminal Mode

    2-12 Getting Familiar with Your Development Software Changing to Terminal Mode Path: Toplevel menu → → → → teRminal [232] Path: Toplevel menu → → → → Edit mode → → → → Other → → → → teRminal [232] QuickStroke: [F3] 1.
  • Page 33: Downloading Your Program

    Getting Familiar with Your Development Software 2-13 Downloading Your Program Path: Toplevel menu → → → → teRminal [232] → → → → File → → → → Download from host to module Path: Toplevel menu → → → → Edit mode → → → → Other → → → → teRminal [232] → → → → File →...
  • Page 34 2-14 Getting Familiar with Your Development Software Publication 1746-PM001A-US-P...
  • Page 35: Configuring Your Software

    Chapter Configuring Your Software This chapter describes how to configure your software. Major topics include: • edit options • display options • mouse and keyboard options • filename extensions • printer options • memory options • file backup, temporary file, and autosave •...
  • Page 36: Command Line Switches

    Configuring Your Software Figure 3.1 Configuration Menu 1747-PBASE V x.xx [Text Edit] Ins 175k 06-12-91 1:15pm File Window Block cUrsor Search Text Layout Print Macro Config Other Exit +------SETUP AND CONFIGURATION-----+ +|DOS=5.0 CPU=80386 |===========================?No-File?=+ ||Video Card = VGA Color ||PBASE Path = C:\ABBASIC\BDS\...
  • Page 37 Configuring Your Software Table 3.1 Command Line Switches Switch Equals Summary Mouse disable The BASIC Development Software auto-detects the presence of a mouse driver. The BASIC Development Software requires DOS version 3.1 or higher. Mouse enable Don’t change keyspeed Some personal computers with special ANSI.SYS replacement files encounter problems when attempting to alter the keyspeed or keyboard repeat speed.
  • Page 38: Loading Files From The Command Line

    Configuring Your Software Table 3.1 Command Line Switches Switch Equals Summary Sets screen width to n No snow suppression on Do not wait for retrace on CGA video I/O. This CGA monitor disables snow suppression on CGA monitors. /EMSOFF Don’t use expanded memory Do not use Expanded Memory. This disables any expanded memory options available through the configuration menu.
  • Page 39 Configuring Your Software Figure 3.2 Edit Settings Dialog Box 1747-PBASE V x.xx [Text Edit] Ins 175k 06-12-91 1:15pm File Window Block cUrsor Search Text Layout Print Macro Config Other Exit +------SETUP AND CONFIGURATION------+ +|DOS=5.0 CPU=80386 |===============================?No-File?=+ ||Video+±±±±±±±±±±±±±±±±±±±±±±±±±EDIT SETTINGS±±±±±±±±±±±±±±±±±±±±±±±±±+ ||PBASE|Page break string..
  • Page 40 [Tab] position the cursor, and press to select the desired items. [Space bar]  This option tells 1747-PBASE whether or not to – Truncate spaces truncate spaces that trail lines of text. This truncation only occurs when loading a file.
  • Page 41: Configuring Display Setup

    Refer to the help screen for an example. •  allows you to configure whether 1747-PBASE is in the Default mode Insert or Overwrite mode when it is first invoked. When you are in Edit mode,...
  • Page 42: Configuring Your Filename Extensions

    Development Software. You can add (Create) or remove (Delete) extensions from this list as needed. Effect on Programming: Upon loading a file, the software searches this list for the extension of the file being loaded. Figure 3.3 Extension Setup 1747-PBASE V x.xx [Text Edit] Ins 175k 06-12-91 1:15pm...
  • Page 43 [Tab] [down arrow] bring up the Language list box. Note that was selected from this 1747-PBASE list for the .BDL extension. Effect on Programming: While you edit programs, the software notes the from the extension setup table and interacts accordingly.
  • Page 44 There it finds that files with .BDL as their filename extension use the compiler program called the 1747-PBASE Translator. This compiler is used during translate/compile. Figure 3.6 Compiler Setup Dialog Box +-----COMPILER/PROGRAM SETUP------+ Create<Ins>...
  • Page 45: Configuring Your Printer Options

    Configuring Your Software 3-11 Path: Toplevel Menu → → → → Configuration menu → → → → Printer Configuring Your Printer Path: Main Menu → → → → Config → → → → Printer Options When you select the option from the Setup and Configuration menu, Printer you get a list of common printers.
  • Page 46: Backup Files, Temporary Files, And Autosave

    3-12 Configuring Your Software Path: Toplevel Menu → → → → Configuration menu → → → → Backups/Temp files/ Backup Files, Temporary Autosave Files, and Autosave Path: Main Menu → → → → Config → → → → Backups/Temp files/Autosave When you select the option from the Setup and Backups/Temp files/Autosave...
  • Page 47: Search And Replace Defaults

    Configuring Your Software 3-13 Path: Toplevel Menu → → → → Configuration menu → → → → Search and Replace Search and Replace defaults Defaults Path: Main Menu → → → → Config → → → → Search and Replace defaults When you select the option from the Setup and Search and Replace defaults...
  • Page 48: Save Configuration And Exit

    3-14 Configuring Your Software Path: Toplevel Menu → → → → Configuration menu → → → → saVe configuration Save Configuration and and exit Exit Path: Main Menu → → → → Config → → → → saVe configuration and exit Some configuration changes are saved immediately at the time you assign them, while others are not saved until you select the saVe configuration and exit...
  • Page 49: Editing A Program

    Chapter Editing a Program This chapter is designed to help you understand the file editing features available with your BASIC Development Software. It provides a general description of the features so you can apply them as needed when you begin writing your own programs.
  • Page 50: Searching Operations

    Refer to Chapter 2 for details on using Help. Path: Toplevel menu → → → → Edit mode → → → → Search Quickstroke: available for individual items within the Search menu. Figure 4.1 Search Menu 1747-PBASE V x.xx [Text Edit] Ins 175k 06-12-91 1:15pm...
  • Page 51: Using Block Operations

    Editing a Program The Search menu is divided into two sections. The first section provides search options used to search the current file that is loaded into the edit window. The second section provides options used to search multiple files in the specified search path, regardless of whether or not the file has been loaded into an edit window.
  • Page 52 Editing a Program Figure 4.2 Block Menu 1747-PBASE V x.xx [Text Edit] Ins 175k 06-12-91 1:15pm File Window Block cUrsor Search Text Layout Print Macro Config Other Exit +--------------BLOCK-------------+ +=+A+=======|(Copy block <F9>) |======================?No-File?=+ |>> EOF << |(Move block <F10>) |(Delete block <CtrlF10>)|...
  • Page 53 Editing a Program Table 4.2 Block Defining Options Option QuickStroke Description allows you to mark specific lines in a file beginning or mark Lines [F7] of text ending with the line where the cursor is positioned prior to selecting this menu item. If using a mouse, click the left mouse button to define this cursor position in the file.
  • Page 54: Text Formatting, Undo, And Redo

    Path: Toplevel menu → → → → Edit mode → → → → Text QuickStroke: available for individual items within the Text menu Figure 4.4 Text Menu 1747-PBASE V x.xx [Text Edit] Ins 175k 06-12-91 1:15pm...
  • Page 55: Advanced Editing Techniques

    Editing a Program The following is a list of the options available from the text menu and a brief explanation of their function. Remember that Hypertext help is available with more details. Table 4.4 Text Menu Options Option QuickStroke Description allows you to undo your last editing actions, excluding Undo [Ctrl-F7]...
  • Page 56: Drawing Lines

    Linedraw allows you to draw single or double lines and boxes in a window. The lines are saved with the file and translated into BASIC code if you are using the 1747-PBASE Translator. Be aware that some printers may require special line characters to be defined in order to print the lines.
  • Page 57: Using The Calculator

    Editing a Program Using the Calculator Path: Toplevel Menu → → → → Edit mode → → → → Other → → → → Calculator QuickStroke: Toplevel Menu → → → → Edit mode → → → → [Alt-F2] The calculator feature, available through the Other menu, is useful for doing quick math operations right on your personal computer where the result can be pasted into the active file.
  • Page 58 4-10 Editing a Program Figure 4.6 Window Menu 1747-PBASE V x.xx [Text Edit] Ins 175k 06-12-91 1:15pm File Window Block cUrsor Search Text Layout Print Macro Config Other Exit +----------WINDOW----------+ +=+C+|Open |====================C:\ABBASIC\BAS\FIRST.BDL==+ |Close |Split |List... <AltF1> |--------------------------| |Next <ShftF1> |Previous <CtrlF1>...
  • Page 59: Using Keystroke Macros

    The recorded keystrokes are then saved as a keystroke macro that can be played back with a single QuickStroke. Path: Toplevel menu → → → → Edit mode → → → → Macro Figure 4.7 Macro Menu 1747-PBASE V x.xx [Text Edit] Ins 175k 06-12-91...
  • Page 60 4-12 Editing a Program Keystroke macros make your work easier and faster by allowing you to cut down on repetitive actions. For example, suppose that every time you create a program file, you enter the same information in a header. You can create a file that contains this information and splice it into each new program file.
  • Page 61 Editing a Program 4-13 5. Move the mouse cursor to the QuickStroke assignment field and click the left mouse button. If you do not have a mouse, press to move the cursor to [Tab] the QuickStroke assignment field and then press .
  • Page 62 4-14 Editing a Program The whole process of splicing header information into any new file has now been reduced to one keystroke, , and has been saved permanently to the active [Alt-B] disk drive. Editing Keystroke Macros You have just recorded, saved, renamed, and edited a keystroke macro using a step-by-step approach.
  • Page 63: Using Cursor Markers

    Editing a Program 4-15 Valid QuickStroke Key Assignments You can use any keystrokes that begin with provided that the combination is [Alt] not already in use. A message appears prompting you to enter a different combination if the one you selected is already in use. The QuickStroke key assignments are listed when you select Quick reference in Hypertext help.
  • Page 64 4-16 Editing a Program Figure 4.8 Cursor Menu 1747-PBASE V x.xx [Text Edit] Ins 175k 06-12-91 1:15pm File Window Block cUrsor Search Text Layout Print Macro Config Other Exit +-------------CURSOR POSITION------------+ +=+A+=============|Push position onto marker stack<AltF3> |=========?No-File?=+ |>> EOF <<...
  • Page 65: Manipulating Files

    Path: Toplevel menu → → → → Edit mode → → → → File QuickStroke: available for individual items within the File menu Figure 5.1 File Menu 1747-PBASE V x.xx [Text Edit] Ins 175k 06-12-91...
  • Page 66: Selecting Project Files

    Manipulating Files Table 5.1 File Menu Options Option QuickStroke Description Edit new file creates a new window where a new or existing file is loaded. A dialog box appears from which you can either type in the filename or select it from a directory list. The directory list has the flexibility to list files from any directory on any disk drive in your system.
  • Page 67 Manipulating Files Figure 5.2 User Menu 1747-PBASE V x.xx [Text Edit] Ins 175k 06-12-91 1:15pm File Window Block Cursor Search Text Layout Print Macro Config Other Exit +=+A+===============================================================?No-File?= + |>> EOF << +---------------User Menu---------------+ Create<Ins> Delete<Del> Copy<F4> Edit<F3> | Example Linedraw Program with macros Go<ENTER>...
  • Page 68: User-Defined Programs

    Copy<F4> Edit<F3> | Screen±saver program | Spreadsheet | Star±Death Computer Game | Word Processing | Go<ENTER> Cancel<ESC> Help<F1> | +================================+ Allen±Bradley Company, Copyright 1994 1747-PBASE All Rights Reserved This software is licensed to: ABBASIC FACSYS +===============================================================================+ 1 Help Publication 1746-PM001A-US-P...
  • Page 69: Name Selection

    Manipulating Files Programs are entered onto the User menu in a similar manner as the previous User menu, except that there are memory and directory issues to clarify. Name Selection When you enter a program into the User menu, you must create a descriptive name for the program, under which the program will be listed in the User menu.
  • Page 70: Memory Required Selection

    Manipulating Files Table 5.2 Swap Method Options Option Description No swap when executing a user-defined program, no additional memory is freed up by swapping BASIC Development Software out to disk or EMS. EMS refers to your computer’s expanded memory, if it has any.
  • Page 71: Use Command.com Option

    Manipulating Files Use COMMAND.COM Option option allows you to use internal DOS commands like Use COMMAND.COM DIR, DEL, COPY, etc. from the User-defined Programs menu. To select Use COMMAND.COM 1. Highlight Use COMMAND.COM 2. Use the space bar to toggle your selection. •...
  • Page 72 Manipulating Files Publication 1746-PM001A-US-P...
  • Page 73: Writing Programs Using The Basic Development Language

    Chapter Writing Programs Using the BASIC Development Language This chapter is designed to help you write programs using the BASIC development language. It begins with an overview of the language. Other topics include: • translator directives • keystroke and programming macros •...
  • Page 74: Translator Directives

    BASIC development language programs if you want to use any of the BASIC programming macros. It directs the 1747-PBASE Translator to a file called INCLUDE.BDL at the time the file is translated. This file contains the programming macros described in Appendix A of this manual.
  • Page 75: Include

    Writing Programs Using the BASIC Development Language Syntax:{ } Syntax: REM Example: Before translation: After translation: {This is a comment} 0 REM ... REM THIS IS A REMARK 10 REM THIS IS A REMARK If a dollar sign immediately follows the left curly bracket, it is not IMPORTANT interpreted as a comment.
  • Page 76: Label

    Writing Programs Using the BASIC Development Language For this example, we have included the file FIRST.BDL. Its name was entered in an include directive, and the entire program appeared after translation. During translation, the translator first looks to see if there is a DOS path specified with the include directive to indicate where the file FIRST.BDL can be found.
  • Page 77: Text

    Writing Programs Using the BASIC Development Language Syntax: {$L [labelname]} Example: Before translation: After translation: REM LABEL EXAMPLE 0 REM ... IF A>C THEN GOTO GET_C_VALUE 10 REM LABEL EXAMPLE A=55 20 IF A>C THEN GOTO 40 {$L GET_C_VALUE} 30 A=55 C=107 40 C=107 Text...
  • Page 78: Line Number

    Writing Programs Using the BASIC Development Language Line Number The Line Number directive allows you to specify a starting line number to be used by the translator when it assigns line numbers to each program line. The line number can be any number between the values of 1 and 65535. Line Number directives can be placed anywhere in the program.
  • Page 79: Breakpoint

    Writing Programs Using the BASIC Development Language Breakpoint The Breakpoint directive inserts a STOP statement into the program when it is translated. The STOP statement is inserted only if the Debug directive is turned on {$D+}. When downloaded to the module and executed, program execution halts when the STOP is encountered.
  • Page 80: Macros

    Writing Programs Using the BASIC Development Language Macros There are three types of macros used with the BASIC Development Software. They are: • keystroke macros  temporarily or permanently record a series of keystrokes and replace them with a single keystroke. Keystroke macros are described in Chapter 4.
  • Page 81: Bringing In Programs From Separate Files

    Writing Programs Using the BASIC Development Language Example: A programming macro is written to set the wall clock’s day, month, and year. The macro is named Setdate and is defined by the BASIC lines between {$MACRO...} . After the programming macro is defined, it can be called again any {$ENDM} number of times, anywhere in that program, by simply programming the name Setdate.
  • Page 82: Subprogram Call 70, Call 71

    6-10 Writing Programs Using the BASIC Development Language Subprogram CALL 70, CALL 71 In a main program, the BASIC commands CALL 70 and CALL 71 cause execution to branch to a subprogram. The subprogram must have been previously stored in the memory module of the BASIC or BASIC-T module.
  • Page 83: Creating A Second Program

    Writing Programs Using the BASIC Development Language 6-11 Creating a Second In Chapter 2, you created a simple program. Following is a more complex program to illustrate many of the programming features described. It includes using Program programming macros, labels, and line-draw. After you type in this BASIC development language program, translating, downloading, and executing it on your BASIC or BASIC-T module is briefly described.
  • Page 84 6-12 Writing Programs Using the BASIC Development Language 7. Type the screen setup comment and the screen commands that follow it. Note that these commands are programming macros. See Appendix A of this manual. {screen setup} background_Black( ) High_Intensity ( ) foreground_Yellow ( ) cls ( ) 8.
  • Page 85: Translating

    BASIC Language prior to downloading to the module. Do this by selecting Translate/Compile from the Other menu, and then selecting 1747-PBASE Translator. The program on the following page is the previous program after it is translated. Publication 1746-PM001A-US-P...
  • Page 86 6-14 Writing Programs Using the BASIC Development Language Second Program, After Translation (SECOND.BAS) Figure 6.1 REM . . . REM SECOND PROGRAM P. CHR(27),”[40M”, P. CHR(27),”[1M”, P. CHR(27),”[33M”, P. CHR(27),”[2J”, P. TAB(10),” “ P. TAB(10),” WARNING “ P. TAB(10),” Use of this machine is restricted “...
  • Page 87: Downloading

    Writing Programs Using the BASIC Development Language 6-15 Downloading Downloading a file requires that you connect your personal computer to the module using the configurations described in the SLC 500 BASIC and BASIC-T Modules User Manual (publication number 1746-UM004A-US-P). Module jumpers should be set to support that configuration per the SLC 500™...
  • Page 88 6-16 Writing Programs Using the BASIC Development Language Publication 1746-PM001A-US-P...
  • Page 89: Printing Your Program

    Most of the discussion in this chapter involves features selected from this menu. Path: Toplevel Menu → → → → Edit mode → → → → Print QuickStroke: none Figure 7.1 Print Menu 1747-PBASE V x.xx [Text Edit] Ins 175k 06-12-91 1:15pm...
  • Page 90: Printer Selection

    Main Menu → → → → Config → → → → Printer Path: Main Menu → → → → Print → → → → Printer type Path: Figure 7.2 Printer Selection 1747-PBASE V x.xx [Text Edit] Ins 175k 06-12-91 1:15pm...
  • Page 91: Printer Setup

    Printing Your Program Following is a description of the parameters that you can create or modify on the screen. Refer to the help screens for a more details. PRINTER DRIVER SETUP •  is entered if you are creating a new printer driver setup printer Type •...
  • Page 92: Serial Printers

    Printing Your Program Serial Printers Some printers use serial communications, and some are equipped for both serial and parallel. This section deals exclusively with serial printer configuration. The BASIC Development Software supports both parallel and serial printers. The port set-up of your personal computer determines which port on your personal computer is the printer output port.
  • Page 93: Using The Printer Controls

    Printing Your Program Using the Printer We have already discussed printer setup; but before we actually print a file, this section explains the various printer controls available from the BASIC Controls Development Software. Remember that Hypertext help is available with more details.
  • Page 94: Printing All Or Part Of A Document

    Printing Your Program Printing All or Part of a The Print menu, accessed from the main menu, allows you to print a block or file directly from a window. Document Path: Main Menu → → → → Print → → → → print current File QuickStroke: none Following is a brief explanation of the two print options available from the Print menu.
  • Page 95: Translating Your Program

    This is your source file you have written in the BASIC development language. This is the file you should be translating. name.BAS This is the BASIC file created by the 1747-PBASE Translator. This file is the file you download to the BASIC module. name.MAP This file is generated by the 1747-PBASE Translator.
  • Page 96 The software checks the extension of the file in the active edit window and prompts you to select a translator/compiler. The 1747-PBASE Translator expects your filename to have a IMPORTANT .BDL extension. If it does not, you get an error.
  • Page 97 Translating Your Program get_time (d1,m1,y1) {setup for operator #1} goto acknowledge {$L op2setup} get_time (d2,m2,y2) {setup for operator #2} {$L acknowledge} cls ( ) cursor_down(11) print_time ( ) print “Operator #”,op-48.” acknowledged” If no syntax errors are encountered during the translation, the translator creates a native BASIC program (with the .BAS extension) ready for downloading to the module: Figure 8.2 Second Program, After Translation (SECOND.BAS)
  • Page 98: Eliminating Translator Errors

    PROGRAM SETUP dialog box, accessed through the following path: Path: Toplevel Menu → → → → Configuration menu → → → → Filename extensions → → → → BDL → → → → Compiler–Program setup → → → → 1747-PBASE Translator Publication 1746-PM001A-US-P...
  • Page 99 Translating Your Program Figure 8.3 Compiler Program Setup Dialog Box ↑ 1747-PBASE V x.xx [Text Edit] Ins 175k 06-12-91 1:15pm File Window Block cUrsor Search Text Layout Print Macro Config Other Exit +------SETUP AND CONFI+------EXTENSION SETUP---------+ +|DOS=3.30 CPU=80386 Create<Ins> Delete<Del>...
  • Page 100 Translating Your Program The following table lists the translator configuration options available through the COMPILER/PROGRAM SETUP dialog box. Included are descriptions specific to the 1747-PBASE Translator. Table 8.2 Translator Configuration Options Options Description Command line This allows you to select different parameters for the translator call.
  • Page 101: Communicating With The Module

    Chapter Communicating with the Module After your application file has been translated into an understandable format for the BASIC or BASIC-T module (Chapter 8), you must establish communications between the module and the BASIC Development Software. Refer to Chapter 1 of this manual and the SLC 500™...
  • Page 102 Communicating with the Module The following table shows the BASIC commands that are executable on your module from Terminal mode. Refer to the BASIC Language Reference Manual (publication number 1746-RM001A-US-P) for additional information on these commands Table 9.1 Module Commands Command: Function: Examples:...
  • Page 103: Downloading File

    Communicating with the Module Downloading File After you have created and translated your program, your next step is to download the translated version to the module. Downloading is performed from the BASIC Development Software while in Terminal mode. Access the Terminal mode as discussed in the previous section.
  • Page 104: Uploading File

    Communicating with the Module 2. Enter the path, filename, and file extension of the file to be downloaded. Enter this filename using one of these methods: • The default filename for this operation is the last file you successfully translated during this session. If you want to download the default file, skip to step 3.
  • Page 105 Communicating with the Module Figure 9.2 File to Upload Screen ↓ STRING INPUT: Next field<TAB>, Previous<ShftTAB>, History list< > ↑↓→← File Setup Display deBug Exit to Edit PBASE RS±232 TERMINAL MODE Version x.xx +------------------FILE TO UPLOAD-------------------+ |Filename: BUGFIX.BAS |+=======Directory List=========+ ||Select this field to get OK<ENTER>...
  • Page 106: Hex File Transfers

    Communicating with the Module 3. Once the filename has been keyed in or selected from the directory screen, begin the upload operation by pressing [Enter] flashes on the status line of the BASIC Development Software, and UPLOADING the lines of the file scroll across the screen as they are uploaded to the module. If the file specified already exists in your personal computer, IMPORTANT (always the case if you selected a file from the directory screen), a...
  • Page 107: Downloading Hex Files

    Communicating with the Module 4. If your module has the 1747-M1 memory module installed, type for the 9FFFH ending address. If your module has the 1747-M2 memory module installed, type for the ending address. Refer to the SLC 500 BASIC and BASIC-T FFFFH User Manual publication number 1746-UM004A-US-P, if you need to verify whether you have the M1 or the M2 memory module.
  • Page 108: Backing Up The Module Image

    Communicating with the Module You can use any PROM programmer that: • interfaces to your personal computer • supports INTEL HEX file format • accommodates the UVPROMs used in the module Refer to the documentation provided with the PROM programmer for details on its configuration, interface, and protocol.
  • Page 109: Restoring The Module Image

    Communicating with the Module Restoring the Module Image Restoring the module image enables you to completely restore the configuration of a module to precisely match the state of the module that was previously backed up. This feature is compatible with both the 1771-DB Series B and the 1746-BAS and 1746-BAS-T modules.
  • Page 110 9-10 Communicating with the Module Not having a .MAP file may make debugging your original source code more difficult. The DEBUGGING INFORMATION screen showing the name of the file to be loaded into the debugger window is displayed. Pressing any key from this screen brings up the source file debugger.
  • Page 111: Debugging Example

    Communicating with the Module 9-11 Debugging Example The following example program will be used to illustrate the debugging features. It is a simple program so that you can visualize each line’s execution as it is being debugged. REM THIS IS A DEBUGGING EXAMPLE {SORT EVEN NUMBERED POSITIVE ENTRIES} {$L START} INPUT ”ENTER A NUMBER: ”,Y...
  • Page 112 9-12 Communicating with the Module Figure 9.3 Watch Window +====================SOURCE FILE: C:\ABBASIC\BAS\DEBUG.BDL====================+ | REM THIS IS A DEBUGGING EXAMPLE | {SORT EVEN NUMBERED POSITIVE ENTRIES} | {$L START} | INPUT ºENTER A NUMBER: º,Y | FOR X=1 TO Y | IF X*2=Y THEN GOTO DONE | NEXT X | PRINT ºNUMBER IS ODD OR LESS THAN 1, RESTARTINGº...
  • Page 113 Communicating with the Module 9-13 14. Move the cursor down to anywhere on the line and then press [ next x This causes the program to execute until it reaches the line you marked ( next in this case). The Terminal mode screen appears, and the executing program prompts you to enter a number.
  • Page 114: Making Corrections To Your Program

    9-14 Communicating with the Module Making Corrections to Your Program The normal sequence in writing programs using the BASIC Development Software 1. Write a .BDL file using the BASIC development language. 2. Translate/compile the .BDL file to create a .BAS file. 3.
  • Page 115: Autobaud

    Communicating with the Module 9-15 Figure 9.4 RS-232 Terminal Setup Menu HELP<F1>|MENU<F2>|EXIT<F3>| COM1 1200 8 1 N|LOG CLOSED|ANSI | 06-12-91 1:15pm ↓↑→← File Setup Display deBug Exit to Edit +------------------SETUP----------------------+ |Autobaud |===============================+ |General (file names, etc.)... |Terminal... |com Port settings (baud rate, etc.)... <AltP>| |Colors |saVe setup +-----------------Cancel<ESC>-----------------+...
  • Page 116: General Setup Parameters

    9-16 Communicating with the Module General Setup Parameters This menu selection prompts you with a dialog box that gives you the following general setup parameters: •  defines the DOS path in your personal computer where any Upload path files uploaded from the module will be sent •...
  • Page 117: Colors

    Communicating with the Module 9-17 The following parameters are available: •  allows you to select the port on your personal computer active Com port for use in communicating with the module Verify that the computer port you have selected for your IMPORTANT mouse does not conflict with the port selected for serial communications with the module.
  • Page 118: Dh485 Communications Setup

    9-18 Communicating with the Module DH485 Communications Before configuring terminal communication parameters, the type of communications being used must be selected as either RS-232 or DH485. Setup General Purpose Communications is not intended for use with NOTE the module. This is done through the Terminal Selection menu accessed through the Setup and Configuration menu.
  • Page 119: General Setup Parameters

    Communicating with the Module 9-19 General Setup Parameters This menu selection prompts you with a dialog box that gives you the following general setup parameters: •  defines the DOS path in your personal computer where any Upload path files uploaded from the module will be sent •...
  • Page 120: Com Port Settings

    9-20 Communicating with the Module Com Port Settings This menu selection brings up the dialog box that allows PORT SETUP configuration of communications port parameters. The default settings shipped with the BASIC Development Software match the default settings of the module’s DH485 port as follows: The following parameters are available: •...
  • Page 121: Who Active

    Communicating with the Module 9-21 Who Active The Who Active screen allows you to see the active nodes on the DH485 network. Notice that your personal computer (BASIC SOFT) is included in the list at the address configured for the communications port parameter Terminal Address. Figure 9.6 Who Active Screen HELP<F1>|MENU<F2>|EXIT<F3>| COM1 19200 DH-485 |ANSI | 06-12-91...
  • Page 122: Who Listen

    9-22 Communicating with the Module Who Listen The Who Listen display shows the active nodes without placing the terminal on the network. This allows you to insure that there are no duplicate node addresses prior to going on line. Figure 9.7 Who Listen Screen HELP<F1>|MENU<F2>|EXIT<F3>| COM1 19200 DH-485 |ANSI | 06-12-91 1:15pm...
  • Page 123: Basic Macro Library

    Appendix BASIC Macro Library This appendix contains important information you should be concerned with when using programming macros. The information is general in nature and supplements specific information contained in earlier chapters of this manual. Topics include: • screen functions •...
  • Page 124: Screen Functions

    BASIC Macro Library Screen Functions The following table describes the macro CALLs that you use to perform operations on the operator screen. Be aware that the screen macro CALLs pertain to the currently IMPORTANT configured program port only. Attempts to direct output to other ports will be ignored during program translation Table A.1 Operation Macros Screen Macro CALLs...
  • Page 125: Keyboard Functions

    BASIC Macro Library Table A.1 Operation Macros Screen Macro CALLs Macro Inputs Outputs background_black() Prints text with the background black. None None background_red() Prints text with the background red. None None background_green() Prints text with the background green. None None background_yellow() Prints text with the background yellow.
  • Page 126: Slc Backplane Functions

    BASIC Macro Library SLC Backplane The following table describes the macro CALLs that you use to communicate and pass data on the backplane of the SLC 500. Backplane macros for the 1771-DB/B Functions are located in the file INCLUDBB.BDL. Table A.3 Communication Macros Backplane Macro CALLs Macro Inputs...
  • Page 127: Clock Functions

    BASIC Macro Library Table A.3 Communication Macros Backplane Macro CALLs Macro Inputs Outputs wait_m1() Waits for the M1 file to be read. None None wait_m0() Waits for the M0 file to be updated. None None wait_input_image(%1) Waits on the input image file to be read. None %1 = The success of the transfer:...
  • Page 128: Battery Back-Up

    BASIC Macro Library Battery Back-Up The following table describes the macro CALLs used to control the battery back-up. Table A.5 Battery Back-up Macros Battery Back–up Macro Inputs Outputs Macro CALLs battery_on() Enables battery back-up. None None battery_off() Disables battery back-up. None None alloc_bat_var(%1)
  • Page 129: String Routines

    BASIC Macro Library String Routines The following table describes the macro CALLs used for string routines. Table A.7 String Routine Macros String Routine Macro Inputs Outputs Macro CALLs string_repeat(%1,%2) Allows you to repeat a character %1 times and %1 = Number of times to $(%2) = The new copy it into $(%2).
  • Page 130: [Ctrl-C] Functions

    BASIC Macro Library [CTRL-C] Functions The following table describes the macro CALLs used for functions. Table A.8 Control-C Macros Control-C Function Macro Inputs Outputs Macro CALLs disable_c() Disables the function. None None enable_c() Enables the function. None None Port Control Functions The following table describes the macro CALLs used for port control.
  • Page 131: 1771-Db/B Backplane Functions

    BASIC Macro Library 1771-DB/B Backplane The file INCLUDBB.BDL comes as part of the BASIC Development software package. It contains all of the BASIC programming macros listed in this library, Functions along with the information necessary to translate them. Review the contents of the macro as listed in this file so you fully understand its functions and interaction with its application.
  • Page 132 A-10 BASIC Macro Library Table A.11 1771-DB/B Backplane Macros Number Conversion Macro Inputs Outputs CALLs plc_bcd_6_to_db(%1,%2) Converts the number from PLC 6-Digit, Signed, Fixed %1=BTW word that holds %2=Converted Decimal BCD +/- XXXXXX to BASIC Floating-Point value to convert value plc_oct_to_db(%1,%2) Converts the number from PLC 4-Digit, Signed, Octal, +/ %1=BTW word that holds...
  • Page 133 Appendix The DOS Directory Shell This appendix supplements specific information about the DOS directory shell contained in earlier chapters of this manual. Topics include: • shell operation • file operations from the DOS directory shell Using the DOS Directory The DOS directory shell allows you to perform a large number of DOS related tasks while the BASIC development software is still active.
  • Page 134: Dos Directory Shell Operation

    To the right is a listing of the keystrokes required to execute specific DOS commands. To the left is the listing of the currently selected DOS directory. (Files and directories listed here are examples.) Figure B.1 DOS Directory Shell 1747-PBASE V x.xx [DOS Shell] Ins 175k 06-12-91...
  • Page 135 The following figure illustrates an example of two directory windows displayed on the screen at the same time. Notice that the bottom one is condensed while the top one displays a full directory list, complete with attributes. Figure B.2 Two Directory Windows 1747-PBASE V x.xx [DOS Shell] Ins 175k 06-12-91...
  • Page 136: File Operations From The Dos Directory Shell

    The DOS Directory Shell File Operations from the DOS Directory Shell Individual files can be copied, deleted, renamed, viewed, sorted, printed and loaded into a window from the DOS directory shell. Some of these operations can be performed on several files at once if the files have been marked. Files are marked by pressing the space bar when the filename is highlighted.
  • Page 137 Index Numerics language outline 1747-AIC Isolated Link Coupler starting 1747-PBASE Translator BASIC module 1747-PIC Interface/Convertor backing up module image choosing files 9-16 commands abbreviations and terms communicating with accessing programs connecting to 2-11 advanced editing techniques debugging programs ASCII table...
  • Page 138 3-12 Terminal mode program 3-13 2-13 6-15 connecting to BASIC module drawing lines 2-11 contacting Allen-Bradley for assistance contents of manual copying text Edit mode creating a program 6-11 editing options cursor editing programs motion advanced techniques...
  • Page 139 Index files linedraw autosave example 3-12 6-12 backup feature 3-12 downloading uses loading merging Macro directive saving macro manager selecting project dialog box 4-13 4-14 temporary 3-12 options 4-14 uploading Macro menu 4-11 function keys macros battery back-up clock goto line number communication 4-16 Ctrl C...
  • Page 140 Index menus program block downloading 2-13 cursor editing 4-15 file exiting 2-13 macro printing 4-11 main saving 2-10 other translating 2-11 print programming search BASIC development language setup and configuration debugging toplevel debugging example 9-11 user (project files) macros 6-10 user (user-defined programs) making corrections 9-14...
  • Page 141 6-15 Line Number overview 6-11 Macro translating 6-13 overview selecting project files Text Setup and Configuration menu troubleshooting software contacting Allen-Bradley backup directory structure disk contents installation undo outline uploading starting files sort hex files starting software user menu...
  • Page 142 Index WHO ACTIVE 9-21 WHO LISTEN 9-22 window labels window menu 4-10 windows writing programs Publication 1746-PM001A-US-P...
  • Page 144 Back Cover Publication 1746-PM001A-US-P - May 2000 40072-096-01(A) Supercedes Publication 1746-6.2 - November 1994 © 2000 Rockwell International Corporation. Printed in the U.S.A.

Table of Contents