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

The text of a manual · part 21 of 70

SLC 500 Instruction Set Reference Manual, pages 201 to 210

Pages 201 to 210 of 694

The original document is the PDF (7.2 MB). 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 1747-L514

Page 201

Proportional Integral Derivative Instruction

9-29

Output Limiting with Anti-Reset Windup You may set an output limit (percent of output) on the control output. When the instruction detects that the output (CO) has exceeded a limit, it sets an alarm bit (bit 10 for lower limit, bit 9 for upper limit) in word 0 of the PID control block, and prevents the output (CO) from exceeding either limit value. The instruction limits the output (CO) to 0 and 100% if you choose not to limit. Select upper and lower output limits by setting the limit enable bit (bit 3 of control word 0), and entering an upper limit (word 11) and lower limit (word 12). Limit values are a percentage (0 to 100%) of the control output (CO). The difference between selecting output alarms and output limits is that you must select output limiting to enable limiting. Limit and alarm values are stored in the same words. Entering these values enables the alarms, but not limiting. Entering these values and setting the limit enable bit enables limiting and alarms. Anti-reset windup is a feature that prevents the integral term from becoming excessive when the output (CO) reaches a limit. When the sum of the PID and bias terms in the output (CO) reaches the limit, the instruction stops calculating the integral sum until the output (CO) comes back in range. The integral sum is contained in words 17 and 18 of the control block.

The Manual Mode In the manual mode, the PID algorithm does not compute the value of the control variable. Rather, it uses the value as an input to adjust the integral sum (words 17 and 18) so that a bumpless transfer takes place upon re-entering the AUTO mode. To set the manual output level, design your ladder program to write to the CV address when in the manual mode. Note that this number is in the range of 0 to 16383, not 0 to 100. Writing to the CV percent (word 16) with your ladder program has no effect in the manual mode but adversely effects bumpless transfer. The example on the next page shows how you can manually control the control variable (CV) output with your ladder program.

Publication 1747-RM001G-EN-P - November 2008

Page 202

9-30

Proportional Integral Derivative Instruction

PID Rungstate If the PID rung is false, the integral sum (words 17 and 18) is cleared and CV remains in its last state.

I:2.0 ] [ 2

N7:10 (L) 1

I:2.0 ] [ 1

N7:10 (U) 1

N7:10 ] [ 1

I:2.0 ] [ 0

FRD

B3 [OSR] 0

FROM BCD Source

I1:1.0

Dest

N7:0

LIM

MUL

LIMIT TEST Low Lim

MULTIPLY Source A

N7:0

N7:0

Source

16384

100

Dest

Test High

Lim

0

B

N7:2

DDV DOUBLE Source

Notes on Operation

DIVIDE 100

Dest

A 3-digit BCD thumbwheel is wired to an input module at I1:1.0 (range 0-100). A pushbutton wired to I1:2.0/0 accepts the thumbwheel value. A selector switch for auto/manual mode is wired to I1:2.0/1 (auto) and I1:2.0/2 (manual). N7:0 stores the value entered on the thumbwheel switch. N7:2 stores an intermediate calculation. N7:8 is the PID control variable address. N7:10 is the control block address of the PID instruction. N7:26 Percent output is updated automatically by the PID instruction.

N7:8

S:5 (U) 0

LIM LIMIT TEST Low Lim

101

Test

N7:0

High

Lim

B3 ( ) 3

–1

Time Proportioning Outputs For heating or cooling applications, the Control Variable analog output is typically converted to a time-proportioning output. While this cannot be done directly with the processor, you can use the program on the following page to convert the Control Variable to a time proportioning output.

Publication 1747-RM001G-EN-P - November 2008

Page 203

Proportional Integral Derivative Instruction

9-31

In this program, cycle time is the preset of timer T4:0. Cycle time relates to % on-time as follows:

T4:0.PRE is the cycle time % on-time 100% output on-time

Example - Time proportioning outputs

PID PID Control Process Control Control

Block Variable Variable Block Length

N7:2 N7:0 N7:1 23

TON TIMER ON DELAY Timer Time Base Preset Accum

(EN)

T4:0 0.01 1000 0

(DN)

Cycle Time of Output GRT

O:1.0 (U) 0

GREATER THAN Source A T4:0.ACC 0 Source B N7:25 0

T4:0 ] [ DN

T4:0 (RES) NEQ NOT EQUAL Source A Source

N7:25 0 0

B

O:1.0 (L) 0

Control Variable

MUL

N7:2 ] [ 13

MULTIPLY Source A Source

PID Instruction Done Bit

Time Proportioning Output Contacts

B

Dest

N7:1 0 T4:0.PRE 1000 N7:25 0

DDV DOUBLE Source Dest

DIVIDE

Output as a Fraction of Cycle Time

16383 N7:25 0

CLR CLEAR Dest

Clears Minor Error Flag S:5 0

END

Publication 1747-RM001G-EN-P - November 2008

Page 204

9-32

Proportional Integral Derivative Instruction

Notes:

Publication 1747-RM001G-EN-P - November 2008

Page 205

Chapter

10

ASCII Instructions

This chapter contains general information about the ASCII instructions and explains how they function in your application program. Each of the instructions includes information on: • what the instruction symbol looks like. • how to use the instruction.

Table 10.1 ASCII Instruction

1

Instruction Mnemonic

Instruction Name

Purpose

Page

ABL

Test ASCII Buffer for Line

Determine the number of characters in the buffer, up to and including the user configured end of line character(s).

10-6

ACB

Number of ASCII Characters in Buffer

Determine the total number of characters in the buffer.

10-7

ACI

String to Integer

Convert a string to an integer value.

10-8

ACL

ASCII Clear Receive and/or Send Buffer

Clear the receive and/or transmit buffers.

10-9

ACN

String Concatenate

Link two strings into one.

10-11

AEX

String Extract

Extract a portion of a string to create a new string.

10-12

AHL

ASCII Handshake Lines

Set or reset modem handshake lines.

10-13

AIC

Integer to String

Convert an integer value to a string.

10-14

ARD

ASCII Read Characters

Read characters from the input buffer and place them into a string.

10-15

ARL

ASCII Read Line

Read one line of characters from 10-17 the input buffer and place them into a string.

ASC

String Search

Search a string.

10-18

ASR

ASCII String Compare

Compare two strings.

10-19

AWA

ASCII Write with Append

Write a string with user-configured character(s) appended.

10-20

AWT

ASCII Write

Write a string.

10-22

Publication 1747-RM001G-EN-P - November 2008

Page 206

10-2

ASCII Instructions

ASCII Instruction Overview

ASCII instructions are available in SLC 5/03 OS301 and above processors, and all SLC 5/04 and SLC 5/05 processors. There are two types of ASCII instructions. • ASCII port control - these include instructions that use or alter the communication channel for receiving or transmitting data. When using these instructions, the system configuration for channel 0 must be set to “User Mode.” (ABL, ACB, ACL*, AHL*, ARD, ARL, AWA*, AWT*) *may be executed in either user or system mode ASCII port control instructions are queued in the order that they are scanned and are dependent on one another to execute (except ACL which executes immediately). For example, if you have an ARD (ASCII Read instruction) and then an AWT (ASCII Write instruction), the Done bit or the Error bit of the ARD must be set before the AWT can begin executing (even if the AWT was enabled while the processor was executing the ARD). A second ASCII port control instruction cannot begin executing until the first has completed. However, the processor does not wait for an ASCII port control instruction to complete before continuing to execute your ladder program. • ASCII string control - these include instructions that manipulate string data. (ACI, ACN, AEX, AIC, ASC, ASR) ASCII string control instructions execute immediately. They are never sent to the queue to wait their turn for execution.

Protocol Parameter Overview

Listed below are the ASCII protocol parameters that you set via the Channel 0 configuration screens in your programming software. Table 10.2 ASCII Protocol Parameters

Publication 1747-RM001G-EN-P - November 2008

Description

Specification

Baud Rate

Toggles between 110, 300, 600, 1.2K, 2.4K, 4.8K, 9.6K, and 19.2K (additional rate of 38.4K for SLC 5/04 and SLC 5/05 only). The default is 19.2K.

Start Bits

The default is 1 and cannot be changed.

Stop Bits

Options include 1, 1.5, and 2 The default is 1.

Parity

Toggles between None, Odd, and Even. The default is None.

Page 207

ASCII Instructions

10-3

Table 10.2 ASCII Protocol Parameters Description

Specification

Data Bits

Toggles between 7 and 8. The default is 8.

Termination Characters

Allows you to configure up to 2 ASCII characters. The default is CR.

Append Characters

Allows you to configure up to 2 ASCII characters. The AWA instruction adds the characters to the end of every string to serve as termination characters for the receiving device. The default is CR LF.

Using the ASCII Data File Type These are 1-word elements. Assign ASCII addresses as follows. Table 10.3 Addressing Format Format

Explanation A

ASCII file f

File number. A file number between 9 to 255 can be used.

:

Element delimiter e

Element number

/

Bit delimiter b

Bit number

Bit location within the element. Ranges from 0 to 15.

A9:2

Element 2, ASCII file 9

A10:0/7

Bit 7, Element 0, ASCII file 10

Af:e/b

Examples

Ranges from 0 to 255. This is a 1-word element.

Using the String (ST) Data File Type This file type is valid for SLC 5/03 OS301 and higher, SLC 5/04, and SLC 5/05 processors. These are 42-word elements. You can address string lengths by adding a .LEN to any string address (for example, ST17:1.LEN). Valid string data file numbers are 9 to 255. String lengths must be between 0 and 82 bytes. In general, lengths that are outside of this range cause the processor to set the ASCII Error bit (S:5/15) and the instruction is not executed. TIP

You can enter ASCII strings characters either directly into the ST file or as \ followed by the Hex value of the ASCII character. Refer to See Table 10.9 for more information.

Publication 1747-RM001G-EN-P - November 2008

Page 208

10-4

ASCII Instructions

You configure append or end-of-line characters via the Channel Configuration screen. The default append characters are carriage return and line feed; the default end-of-line (termination) character is a carriage return.

TIP

All instructions except ACL and AHL will error if the port is disabled. Assign string addresses as follows.

Table 10.4 Addressing Formats Format STf:e.s/b

Examples

Publication 1747-RM001G-EN-P - November 2008

Explanation ST

String file f

File number. A file number between 9 to 255 can be used.

:

Element delimiter e

Element number

.

Subelement delimiter s

Subelement number Ranges from 0 to 41. Word 0 is the length,.LEN. Words 1 to 41 are entered in as .DATA[0] to .DATA[40]

/

Bit delimiter b

Bit number

Bit location within the element. Ranges from 0 to 15.

ST9:2

Element 2, string file 9

ST9:2.LEN

Length, in bytes of element 2, string file 9

ST9:2.DATA[0]

Word 1 of element 2, string file 9

ST9:2.DATA[0]/15

Bit 15 of word 1 of element 2, string file 9

Ranges from 0 to 255. These are 42-word elements.

Page 209

ASCII Instructions

10-5

Entering Parameters The control element for ASCII instructions includes eight status bits, an error code byte, and two character words. Table 10.5 ASCII Control Element 15

14

13

12

11

10

09

08

07

06

Word 0

EN

EU

DN

EM

ER

UL

IN

FD

Error Code

Word 1

Number of Characters For Sending or Receiving (LEN)

Word 2

Number of Characters Sent or Received (POS)

05

04

03

02

01

00

EN = Enable Bit EU = Queue Bit DN = Asynchronous Done Bit EM = Synchronous Done Bit ER = Error Bit UL = Unload Bit IN = Running Bit (This is the IN Bit in the control data file [R6:].) FD = Found Bit • Found Bit FD (bit 8) indicates that the instruction found the end of line or termination characters in the buffer (applies to ABL and ACB instructions). • Running Bit IN (bit 9) indicates that a queued instruction is executing. • Unload Bit UL (bit 10) ceases instruction operation before (may be queued) or during execution. If this bit is set while an instruction is executing, any data already processed is sent to the destination. Note that the instruction is not removed from the queue; any remaining data is just not processed. You set this bit. • Error Bit ER (bit 11) indicates that an error occurred while executing the instruction, such as a mode change via channel 1, or the instruction was cancelled using the UL bit or ACL instruction. • Synchronous Done Bit EM (bit 12) is set concurrently to a program scan to indicate the completion of an ASCII instruction. • Asynchronous Done Bit DN (bit 13) is set opposite to a program scan when an instruction successfully completes its operation. Note that an instruction can take longer than one program scan to finish executing. • Queue Bit EU (bit 14) indicates that an ASCII instruction was placed in the ASCII queue. This action is delayed if the queue is already filled. The queue may contain up to 16 instructions. • Enable Bit EN (bit 15) indicates that an instruction is enabled due to a false-to-true transition. This bit remains set until the instruction has completed executing or errors.

Publication 1747-RM001G-EN-P - November 2008

Page 210

10-6

ASCII Instructions

Test ASCII Buffer for Line (ABL)

Use the ABL instruction to determine the total number of characters in the input buffer, up to and including the end-of-line characters (termination). This instruction looks for two termination characters that you configure via the ASCII port configuration screen. On a false-to-true transition, the processor reports the number of characters in the POS field of the ASCII control block. The serial port must be configured for User mode.

Entering Parameters ABL Ascii Test For Line Channel 0 Control R16:0 Characters 0 Error 0

EN

Enter the following parameters when programming this instruction.

DN ER

Fixed SLC SLC SLC SLC SLC 5/01 5/02 5/03 5/04 5/05 •

•

•

Output Instruction

• Channel is the number of the RS-232 port (Channel 0). • Control is the area that stores the control register required to operate the instruction. • Characters are the number of characters in the buffer that the processor finds (0-1024). This parameter is display only and resides in word 2 of the control block. • Error displays the hexadecimal error code that indicates why the ER bit was set in the control data file (R6). See page 10-24 error code descriptions.

Example

When the rung goes from false-to-true, the Enable bit (EN) is set. The instruction is put in the ASCII instruction queue, the Queue bit (EU) is set, and program scan continues. The instruction is then executed outside of the program scan. However, if the queue is empty the instruction executes immediately. Upon execution, the Running bit (IN) is set. The processor determines the number of characters (up to and including the end-of-line/termination characters) and puts this value in the position field. The Done bit (DN) is then set. If a zero appears in the POS field, no end-of-line/termination characters were found. The Found bit (FD) is set if the position field was set to a non-zero value. When the program scans the instruction and finds the Done bit (DN) set, the processor then sets the Synchronous Done bit (EM). The EM bit acts as a secondary done bit corresponding to the program scan.

Publication 1747-RM001G-EN-P - November 2008