Browse
(440) 299-7778
Menu
(440) 299-7778
One-year parts and labor warranty30-day money-back guaranteeContact

The text of a manual · part 4 of 17

1771-DB Basic Module User Manual, pages 31 to 40

Pages 31 to 40 of 167

The original document is the PDF (943 KB). This is its text as extracted, unedited; tables and drawings read best in the PDF, and each page heading opens it at that page.

For the Allen-Bradley 1771-DB

Page 31

Chapter 4 Using the Serial Ports

4.3.4 Connecting a T50 Industrial Terminal (Cat. No. 1784-T50) to the Program Port (continued)

4.3.4.1 Configuring the Software Configure the driver package for compatibility with the BASIC Module by setting: baud rate – 9600 baud recommended parity – none data bits – 8 start bits – 1 stop bits – 1 To download to the BASIC Module, you must use a line wait function. The industrial terminal waits for the “u” BASIC Module prompt before sending the next line to the module. You must enter a line delay of 1.5 seconds for terminal drivers that do not have the “wait for character” function, so that you do not lose subsequent lines. Most drivers allow storage of the complete set of parameters in a file for later recall. The industrial terminal stores the BASIC Module program in a text file on the hard or floppy disc depending on where you store the terminal driver package. We recommend you store the driver package on the hard drive to increase execution speed. Most driver packages have upload and download capability. Refer to the driver documentation for these commands.

4.3.4.2 Wiring Figure 4.5 Connecting a T50 Industrial Terminal to a BASIC Module

4–7

Page 32

Chapter 4 Using the Serial Ports

4.4 Peripheral Port

The peripheral port is an asynchronous serial communication channel compatible with RS-423A/232C or RS-422 interfaces. It uses bi-directional XON/XOFF software handshaking and RTS/CTS, DTR, DSR, DCD hardware handshaking for interfacing with printers, terminals and commercial asynchronous modems. Use a CALL routine to change peripheral port configuration. Configure the baud rate (300 to 19.2K bps) by setting a configuration plug. Refer to figure 3.2 for configuration plug locations. In addition, the peripheral port has the following format requirements: configurable parity: odd, even or none fixed start bits: 1 configurable stop bits: 1, 1.5 or 2 configurable data bits: 5,6,7 or 8 receiver threshold: 200 mV driver output (loaded): +3.6V Defaults are 1 start bit, 1 stop bit, 8 bits/character, no parity, handshaking off and 1200 baud. When you select 8 bits/character you have full access to all 8 bits of each character on both input and output data bytes. Refer to figure 4.2 for peripheral port wiring connections. The peripheral port can connect to printers (figure 4.6), asynchronous modems and to SA/SB recorders for program storage and retrieval (figure 4.7). Figure 4.6 Cable Connection to 1771-HC Printer

4–8

Page 33

Chapter 4 Using the Serial Ports

4.4 Peripheral Port (continued)

4.4.1 Using the XON/XOFF Commands for the Peripheral Port

Figure 4.7 Cable Connection to SA/SB Recorder

Output Data – The BASIC Module stops sending characters within 2 character times after receiving an XOFF. Transmission resumes when XON is received. Input Data – The BASIC Module sends XOFF when the input buffer reaches 224 characters. The module sends XON when the buffer contains less than 127 characters. The BASIC Module requires CTS (pin 5) to be true before data can be output. If hardware handshaking is not used with your device then RTS (pin 4) may be connected to CTS to satisfy this requirement. Jumper pin 4 to pin 5.

4.4.2 Connecting A T30 Industrial Terminal (1784-T30) to the Peripheral Port

Communication between a programmable controller and the T30 Industrial Terminal using the BASIC Module requires two data transfers. We use block-transfer-read and write instructions for bi-directional data transfer between the programmable controller data table and the BASIC Module. We use an RS-423/RS-232 communication link for bi-directional data transfer between the BASIC Module and the industrial terminal. Refer to the Plant Floor Terminal Application Data (publication number 1784-4.1) for more information.

4–9

Page 34

Chapter 4 Using the Serial Ports

4.4.2 Connecting A T30 Industrial Terminal (1784-T30) to the Peripheral Port (continued)

4.4.2.1 Hardware Configuration You must configure the BASIC Module peripheral port and the T30 Industrial Terminal serial port in the same way for proper communications to occur. We configure the peripheral port on the BASIC Module as follows: Baud rate

1200 bps

Parity disabled

Duplex full (default setting)

Bits per character

8

Stop bits

1

Handshaking disabled

Configure the T30 Industrial Terminal serial port the same way. Refer to the following figure 4.8 for T30 Serial Port/BASIC Module Peripheral Port connections. Figure 4.8 T30 Serial Port/BASIC Module Peripheral Port Connections

Important: Jumper the T30 Industrial Terminal and BASIC Module pins 4 and 5 if you do not use them.

4–10

Page 35

Chapter 4 Using the Serial Ports

4.4.3 Connecting a 1770-SA/SB Recorder to the Peripheral Port

You can use a 1770-SB Data Cartridge Recorder or 1770-SA Digital Cassette Recorder to save and load BASIC programs to the BASIC Module. Figure 4.6 shows cable pin connections. Use the connections shown in figure 4.6 otherwise improper operation could occur. Note that the standard cable does not connect properly with the BASIC Module. Refer to the user manuals for the 1770-SB (publication number 1770-6.5.4) and 1770-SA (publication number 1770-6.5.1) for more information on these recorders. It is not necessary to set the peripheral port parameters (except baud rate) before CALLing the recorder interface routines. This is done automatically by the software. The parameters are returned to their original state when the routine is complete. You can find more information on saving and loading programs in Chapter 6 of this manual. Important: STR LINK II and III Recorders do not function like SA/SB recorders. Do not use them with the BASIC Module.

4.4.4 Connecting a 1770-HC Printer to the Peripheral Port

You can connect a 1770-HC Printer to the peripheral port for program listing, report generation etc. Figure 4.7 shows cable pin connections. Refer to your printer product manual for more information. We recommend enabling XON/XOFF on the peripheral port (see Chapter 5 section titled, “Peripheral Port Support – Parameter Set”) and selecting XON/XOFF(DEC) protocol on the 1770-HC Printer (switch selectable). Refer to your printer manual. You can find more information on printing reports and listing programs in Chapter 5 of this manual.

4.4.5 Connecting RS-422 Devices

The BASIC Module can communicate with various RS-422 devices. RS-422 signals for both sending and receiving data are located on the module’s peripheral port. Figure 4.9 shows point-to-point signal connections. The RS-422 port floats (i.e no voltages are applied to the output) when it is not sending characters. This allows you to connect two transmitting devices on the same line. Also, you can connect more than one device in a multi-drop configuration (figure 4.10).

4–11

Page 36

Chapter 4 Using the Serial Ports

4.4.5 Connecting RS-422 Devices (continued)

Figure 4.9 Point-to-Point RS-422 Connections

Figure 4.10 Multi-drop configuration with master and multiple slaves

Important: When you use the peripheral port as a 422 port, you must connect pin 4 to pin 5 on the port. When using an RS-422 interface you must install termination resistors at each end of the line. The module has a jumper selectable termination resistor (Refer to figure 3.2). Use a cable with 2 twisted pairs and a nominal impedance of 100 ohms. Important: Use terminating resistors only at the ends of the link if using multiple RS-422 devices, and at both ends if using point-to-point connections.

4–12

Page 37

Chapter 4 Using the Serial Ports

4.5 Cable Assembly Parts

You must supply cables for connecting devices to the program and peripheral ports. You can construct the cables with the parts listed in Table 4–1. Table 4–1

Cable assembly parts for connection to the program and peripheral ports Part

Manufacturer’s Part Number

25 pin female connector

Cannon type DB-25S, or equivalent

25 pin male connector

Cannon type DB-25P, or equivalent

Plastic Hood

Amp type 205718-1

2 twisted pair 22 gauge, individually shielded cable

Cat. No. 1778-CR, Belden 8723 or equivalent (Do not use for cable RS-422 connections)

4–13

Page 38

Chapter 5

Operating Functions

5.1 Chapter Objectives

After reading this chapter you should be familiar with the BASIC instruction set and be ready to begin BASIC programming. This chapter is a reference section to help you with module programming. You should already be familiar with BASIC programming.

5.2 Definition of Terms

The following sections define the following terms: commands, statements, format statements, data format, integers, constants, operators, variables, expressions, relational expressions, system control values, argument stack and control stack.

5.2.1 Commands

The BASIC module operates in two modes, the command or direct mode and the interpreter or run mode. You can only enter commands when the processor is in the command or direct mode. This document uses the terms run mode and command mode to refer to the two different operation modes.

5.2.2 Statements

A BASIC program consists of statements. Every statement begins with a line number, followed by a statement body, and terminated with a carriage return (cr), or a colon (:) in the case of multiple statements per line. There are three types of statements: assignments, input/output and control. Every line in a program must have a statement line number ranging between 0 and 65535 inclusive. BASIC uses this to order the program statements in sequence. You can use a statement number only BASIC automatically orders once in a program.

statements in ascending order.

A statement may not contain more than 79 characters. BASIC ignores blanks (spaces) and automatically inserts them during a LIST command.

Page 39

Chapter 5 Operating Functions

5.2.2 Statements (continued)

You may put more than one statement on a line, if separated by a colon (:). You can use only one statement number per line. You can enter lower case characters in the COMMAND mode. Any keywords, commands, variable and array names entered in lower case change to upper case when stored in memory.

5.2.3 Format Statements

You can use format statements within the print statement. The format statements include TAB( (|expr|), SPC([expr]), USING(special symbols), and CR (carriage return with no line feed).

5.2.4 Data Format

You can represent the following range of numbers in +1E–127 to +.99999999E+127 the BASIC module:

There are eight significant digits. Numbers are internally rounded to fit this precision. You can enter and display numbers in four formats: integer, decimal, hexadecimal and exponential. Example:

5.2.5 Integers

129, 34.98, 0A6EH, 1.23456E+3

In the BASIC module, integers are numbers that range from 0 to 65 535 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 (e.g. 170H). If the hexadecimal number begins with A – F, then it must be preceded by a zero (i.e. You must enter A567H as OA567H). When an operator, such as .AND. requires an integer, the BASIC module truncates the fraction portion of the number so it fits the integer format. We refer to integers and line numbers as: [integer] – [ln-num]

5–2

Page 40

Chapter 5 Operating Functions

5.2.6 Constants

A constant is a real number that ranges from +1E–127 to +.9999999 9E+127. A constant can be an integer. We refer to constants as: [const]

5.2.7 Operators

An operator performs a predefined operation on variables and/or constants. Operators require either one or two operands. Typical two operand or dyadic operators include ADD (+), SUBTRACT (–), MULTIPLY (*) and DIVIDE(/). We call operators that require only one operand, unary operators. Some typical unary operators are SIN, COS and ABS.

5.2.8 Variables

A variable can be: a letter (e.g. A, X,I) a letter followed by a one dimensioned expression, (e.g. J(4), GA(A + 6), I(10*SIN(X)) a letter followed by a number followed by a one dimensioned expression (e.g. A1(8), P7(10*SIN(X)), W8(A + B). a letter followed by a number or letter (e.g. AA, AC, XX, A1, X3, G8) except for the following combinations: CR, DO, lE, IF, IP, ON, PI, SP, TO, UI and UO. We refer to variables that include a one dimensioned expression [expr] as dimensioned or arrayed variables. We refer to variables that contain a letter or a letter and a number as scalar variables. Any variables entered in lower case are changed to upper case. We refer to variables as: [var]. The BASIC module allocates variables in a “static” manner. This means that the first time a variable is used, BASIC 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 (e.g. Q 3), you cannot tell BASIC 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.

5–3