Вы находитесь на странице: 1из 85

LAB 1: RSLinx Configuration

1. Open RSLinx Classic by clicking Start > Programs > Rockwell

Software > RSLinx

RSLinx Classic starts in a minimized mode you will see an RSLinx icon in your Windows System Tray.
2. In RSLinx Classic, click Communications > Configure Drivers. This

opens the Configure Drivers window.

RSlogix 500 V1.0 Sofcon India Pvt. Ltd.(Confidential-For Internal Use Only

Page 1

3. In the Configure Drivers window, select the driver you need to use

based on your physical connection to the processor. For example, if you are connecting with a MicroLogix 1100, select the Ethernet_IP devices driver.

Click Add New to add the driver to the Configured Drivers list.
4. RSlogix 500 V1.0 Sofcon India Pvt. Ltd.(Confidential-For Internal Use Only Page 2

RSLinx Classic asks you to name the driver. RSLinx Classic uses this name to refer to the driver. You can use the default name, or enter a name (names can be up to 15 characters long). Click OK.
5.

The window that appears next depends on the driver you selected. This window is where you configure the driver. Configure the driver to match your physical connection to the processor. If you need help with the parameters for the driver, click the Help button on the window.
6.

RSlogix 500 V1.0 Sofcon India Pvt. Ltd.(Confidential-For Internal Use Only

Page 3

When you have finished configuring the driver, the driver appears in the Configured Drivers list of the Configure Drivers window. Click Close.
7.

You need to make sure the communications driver you configured is working properly. To do this, use the RSWho function in RSLinx Classic. This function shows what processors and other
8. RSlogix 500 V1.0 Sofcon India Pvt. Ltd.(Confidential-For Internal Use Only Page 4

communications devices are available through the driver. To display an RSWho window, click Communications > RSWho

RSlogix 500 V1.0 Sofcon India Pvt. Ltd.(Confidential-For Internal Use Only

Page 5

LAB 2: RSLogix 500 configuration


RSLogix 500 software is a 32-bit Windows ladder logic programming package for the SLC 500 and MicroLogix processors. 2.1- Exploring RSLogix 500 To navigate through the various windows and toolbars in RSLogix 500 more easily, you should understand what they contain and what functionality each provides. When you open a project in RSLogix 500 you can expect to see:.

RSlogix 500 V1.0 Sofcon India Pvt. Ltd.(Confidential-For Internal Use Only

Page 6

Menu bar - Select functionality from the menus that appear as you click each

selection on this bar.


Icon bar - The icon bar contains many functions that you will use repeatedly

as you develop and test your logic program. If you want to know what any of the icons represent, RSLogix 500 can tell you. Move your cursor over the icon, and floating ToolTip window appears to tell you what the icon is used for.
Online bar - See at a glance the processor mode and whether you have

online edits or forces present. You can also view the communications driver and node number.
Project tree - This view contains all the folders and files contained in your

project. You can usually click an icon in this tree and then click the right mouse button for a menu that applies only to the icon selected. For example, if you click the right mouse button on a program file, you see options to rename the program file, open the program file, hide the program file, or reveal properties of the program file.
Status bar - Look here for ongoing status information and prompts as you

use the software.


Results pane - Displays the results of a Find All search or a verification

procedure. You can hide this pane or place it anywhere on your screen.
Ladder view - This is where you edit your ladder logic. You can view several

program files at the same time.


Instruction toolbar - Displays instruction mnemonics in tabbed categories.

When you click on a category tab the instruction toolbar just above it changes to show that category of instructions. Click an instruction to insert it in your ladder program. 2.2- Create a new project To create a new project, click File > New. RSLogix 500 prompts you for the type

RSlogix 500 V1.0 Sofcon India Pvt. Ltd.(Confidential-For Internal Use Only

Page 7

of processor you will communicate with and creates a project tree for the project.

Now press ok. The following programming window will appear as

RSlogix 500 V1.0 Sofcon India Pvt. Ltd.(Confidential-For Internal Use Only

Page 8

2.3- Open an existing project To open an existing project, click File > Open. The software displays a window that allows you to choose a project to open.

RSlogix 500 V1.0 Sofcon India Pvt. Ltd.(Confidential-For Internal Use Only

Page 9

Now press ok. The following programming window will appear as

2.3- Using the project tree

RSlogix 500 V1.0 Sofcon India Pvt. Ltd.(Confidential-For Internal Use Only

Page 10

When you have opened or created a project, RSLogix 500 displays the projects project tree. The project tree allows you to navigate through the various program and data table files in your project. The following illustration shows the parts of the project tree.

RSlogix 500 V1.0 Sofcon India Pvt. Ltd.(Confidential-For Internal Use Only

Page 11

2.4- Define chassis and modules

After you have opened a project, you need to define your chassis, identify the I/O cards. You perform these procedures in the I/O
Configuration window.

Access this window by double-clicking the I/O Configuration icon in the project tree. From the I/O Configuration window, click the I/Os button to examine the loading on a rack based on the module configuration that you have selected.

RSlogix 500 V1.0 Sofcon India Pvt. Ltd.(Confidential-For Internal Use Only

Page 12

2.5- Automatic I/O configuration To do this, click the Read I/O Config button on the I/O dialog. Configuration

2.6- Analog and specialty module configuration If you have a Specialty I/O Module in your configuration, you have to enter additional parameters so that the module can function properly in your program. You enter this information in the Advanced I/O Configuration window.

RSlogix 500 V1.0 Sofcon India Pvt. Ltd.(Confidential-For Internal Use Only

Page 13

Go to this dialog by clicking the Adv Config button on the I/O Configuration dialog. 2.7- Enter a logic program When you open a program file by double-clicking its icon in the project tree, the ladder file opens in the right side of the RSLogix 500 window.

RSlogix 500 V1.0 Sofcon India Pvt. Ltd.(Confidential-For Internal Use Only

Page 14

Usually, program file #2, the main program file, will open when you open a project. If you have not entered any ladder logic in a program file, only the end rung will show. Click the end rung and then select the New Rung icon from the user toolbar. To place an instruction on a rung, click the instructions button.

RSlogix 500 V1.0 Sofcon India Pvt. Ltd.(Confidential-For Internal Use Only

Page 15

2.8- Validate your project Before you can compile and download your project to a processor, you must validate the project. You can validate a single program file, click the Verify File icon or click Edit > Verify File. To verify your whole project, click the Verify Project icon or click Edit > Verify Project. After you initiate verification, the Verify Results output window displays and gives you information about mistakes or omissions that may have occurred as you wrote your program logic.

RSlogix 500 V1.0 Sofcon India Pvt. Ltd.(Confidential-For Internal Use Only

Page 16

2.9- Data Files in SLC and MICROLOGIX PLC


The Allen-Bradley PLC has different type of Memory each performs a particular function.

RSlogix 500 V1.0 Sofcon India Pvt. Ltd.(Confidential-For Internal Use Only

Page 17

One type of files are called Data Files. The plc programmer uses these files Extensively.

There are 256 Data Files and Each files has registers that stores 16-bit words. The 16-bit in each registers are labeled 0-15. These 256 registers are referred as element and are labeled 0 through 256.
RSlogix 500 V1.0 Sofcon India Pvt. Ltd.(Confidential-For Internal Use Only Page 18

The data file types are: Output (file 0) This file stores the state of the output terminals for the controller. Input (file 1) This file stores the status of the input terminals for the controller. Status (file 2) This file stores controller operation information. This file is useful for troubleshooting controller and program operation. Bit (file 3) This file is used for internal relay logic storage. Timer (file 4) This file stores the timer accumulator and preset values and status bits. Counter (file 5) This file stores the counter accumulator and preset values and the status bits. Control (file 6) This file stores the length, pointer position, and status bits for specific instructions such as shift registers and sequencers.
RSlogix 500 V1.0 Sofcon India Pvt. Ltd.(Confidential-For Internal Use Only Page 19

Integer (file 7) This file is used to store numeric values or bit information .

You can also drag and drop physical address from its Data File directly.

RSlogix 500 V1.0 Sofcon India Pvt. Ltd.(Confidential-For Internal Use Only

Page 20

I:0.0/3

LAB 3: Introduction of XIC/XIO, Uploading/Downloading

Creating simple ladder instruction Step_1: first of all create a new blank rung in your RSLogix500 as

Step_2: Now go to instruction tab and drag/drop XIC/OTE instruction to the blank created Rung. . The green drop zone indicates correct placement.

RSlogix 500 V1.0 Sofcon India Pvt. Ltd.(Confidential-For Internal Use Only

Page 21

Step_3: Give a H/W Input Address to this XIC instruction and H/W output Address XIO instruction.

Step_4: Now verify your program for any error.

RSlogix 500 V1.0 Sofcon India Pvt. Ltd.(Confidential-For Internal Use Only

Page 22

Step_5: Download your program to PLC

Now you have downloaded your PLC.


RSlogix 500 V1.0 Sofcon India Pvt. Ltd.(Confidential-For Internal Use Only Page 23

A Download Progress dialog will flash through several progress bars as various parts of the program are loaded. Eventually, you should see:

The RSLogix status box will change to show you are on-line live with the processor

Next, we will change the SLC 500 processor key switch from PROGRAM Mode to REMOTE RUN Mode.

RSlogix 500 V1.0 Sofcon India Pvt. Ltd.(Confidential-For Internal Use Only

Page 24

Uploading from PLC In this section we learn how to upload program from PLC to PC. For this adopt the following steps.

RSlogix 500 V1.0 Sofcon India Pvt. Ltd.(Confidential-For Internal Use Only

Page 25

LAB 4: Concept of Switching Function w.r.t to Field Contacts Start/Stop Logic and Holding

Note: How to upload program? will be explained later on

In this section you will learn how to develop a ladder logic DOL starter or Start Stop ladder logic. Step_1: Here we are considering you have already done your RsLinx communication and you have also created a new project file as

RSlogix 500 V1.0 Sofcon India Pvt. Ltd.(Confidential-For Internal Use Only

Page 26

Step_2: Give a H/W Input Address to this XIC instruction and H/W output Address XIO instruction as

RSlogix 500 V1.0 Sofcon India Pvt. Ltd.(Confidential-For Internal Use Only

Page 27

Now download it to PLC and monitor it.

RSlogix 500 V1.0 Sofcon India Pvt. Ltd.(Confidential-For Internal Use Only

Page 28

LAB 5:

Realization of Logic Gates by Bit Instructions

In this section we will examine the basic instructions for PLC programming by using ladder diagram. BIT Logic Instructions The pre-determined sequence of operations may be called the logic combinational and the system operation. When the operational sequence is carried out with the help of a PLC, it is called PLC logic. To convert a control objective into an equivalent ladder diagram, the truth table of the control objective is first determined, and then the equivalent ladder logic program is drawn. Truth Table of Logic Gates
x Input 1 y Input 2 O=x.y Output (OR) O=x+y (AND Gate) O= x (NOT Gate) O= x+ y (NOR Gate) O= x. y (NAND Gate) O= x y = x . y+ x . y (XOR) 0 1 0 1 0 0 1 1 0 0 0 1 0 1 1 1 1 0 1 0 1 1 1 0 1 0 0 0 0 1 1 0

RSlogix 500 V1.0 Sofcon India Pvt. Ltd.(Confidential-For Internal Use Only

Page 29

Equivalent Ladder Diagram for Logic Gates

RSlogix 500 V1.0 Sofcon India Pvt. Ltd.(Confidential-For Internal Use Only

Page 30

RSlogix 500 V1.0 Sofcon India Pvt. Ltd.(Confidential-For Internal Use Only

Page 31

LAB 6:

PLC-SCADA Communication

In this section you will learn how to communicate your developed scada animation to your PLC controller. Step_1: First communicate AB PLC using RSLINX as

Now verify your PLC communication using RSWHO command in RSLINX.

Step_2: In this section we will create a topic in RSLINX as Step_4: In this section we will create few animations so that we can communicate those one to PLC. 1. Creating discrete button for start- stop application

RSlogix 500 V1.0 Sofcon India Pvt. Ltd.(Confidential-For Internal Use Only

Page 32

In order to add a data server to the tag do the following configuration

RSlogix 500 V1.0 Sofcon India Pvt. Ltd.(Confidential-For Internal Use Only

Page 33

RSlogix 500 V1.0 Sofcon India Pvt. Ltd.(Confidential-For Internal Use Only

Page 34

2. Creating Indicator in SCADA

Step_5: Developing ladder logic to communicate above scada button to PLC

RSlogix 500 V1.0 Sofcon India Pvt. Ltd.(Confidential-For Internal Use Only

Page 35

LAB 7:

TIMERS AND ITS APPLICATION

Timers In this section we will cover timers used in ladder logic programming. A timer is a device that introduces a time delay in a circuit or a system during its ON or OFF condition.

Functions in a Timer 1. Enable bit (EN) It follows the input enable contact status. 2. Timer Timing bit (TT) It is set when the timer is operating. 3. Done bit (DN) When the timer is timed out, this bit is set. 4. Time base - The unit of measurement used to determine the speed at which time increments are counted. The time base is always 1 msec in RSLogix 5000 timers. For example, for a 2 second timer, enter 2000 for the .PRE value. 5. Accumulator value (ACC) - This is the time that has elapsed, since the timer was last reset. When enabled, a timer updates this continually.
RSlogix 500 V1.0 Sofcon India Pvt. Ltd.(Confidential-For Internal Use Only Page 36

6. Preset value (PRE) This specifies the value that he timer must

reach before the controller sets the done bit. Classification of a Timer
1. ON-Delay Timer (TON)

On delay timers are used when an action is to begin a specified time after the input becomes true.

Functions of an ON-Delay Timer Output bit Timer Done Bit (DN) Timer Enable Bit (EN) Timer Timing Bit (TT) Is set when Accumulator value is normally greater than the preset value. Rung conditions are true. Rung conditions are true and the all values are less than the PRESET value. Remains set until use of the following Rung condition becomes false. Rung conditions become false. Rung condition becomes false or when the done bit is set.

The TON instruction accumulates time until:


The TON instruction is disabled The .ACC .PRE

When the TON instruction is disabled, the .ACC value is cleared.


RSlogix 500 V1.0 Sofcon India Pvt. Ltd.(Confidential-For Internal Use Only Page 37

RSlogix 500 V1.0 Sofcon India Pvt. Ltd.(Confidential-For Internal Use Only

Page 38

2. OFF-Delay Timer (TOF)

Off- delay timer instructions is used to program a time delay to begin after rung input goes false.

Functions of an OFF-Delay Timer Output bit DN Remains set until use of the following Rung conditions are Rung condition becomes true. false and the accumulator value is greater than or equal to the preset value. Rung conditions are Rung conditions become false and the true or when the done bit accumulator value is set. is less than the preset value. Rung conditions are Rung condition becomes true. false. Is set when

TT

EN

The TOF instruction accumulates time until:


The TOF instruction is disabled The .ACC .PRE

When the TOF instruction is disabled, the .ACC value is cleared.

RSlogix 500 V1.0 Sofcon India Pvt. Ltd.(Confidential-For Internal Use Only

Page 39

RSlogix 500 V1.0 Sofcon India Pvt. Ltd.(Confidential-For Internal Use Only

Page 40

3. Retentive-ON Timer (RTO)

Retentive timer is a timer which retains the accumulated value in case of power loss or rung state going from true to false (rung state transition).

Functions of a Retentive Timer Outpu Is set when t bit DN The accumulator value is equal to or greater than the preset value. TT Rung conditions are true and the accumulator value is less than the preset value. EN Rung conditions are true. Remains set until use of the following The appropriate RES instruction is enabled. Rung conditions become false or DN bit is set. Rung condition becomes false.

The RTO instruction accumulates time until it is disabled. When the RTO instruction is disabled, it retains its .ACC value. You must clear the .ACC value, typically with a RES instruction referencing the same TIMER structure.

RSlogix 500 V1.0 Sofcon India Pvt. Ltd.(Confidential-For Internal Use Only

Page 41

RSlogix 500 V1.0 Sofcon India Pvt. Ltd.(Confidential-For Internal Use Only

Page 42

LAB 8: Exercises based on timers


Solved the below exercises: minutes Duration: 30

Exercise 1: Draw a ladder diagram for a two-motor system having the following conditions: 1) Starting push button starts motor-1 2) After 10 seconds, motor-1 is off and motor-2 is on 3) Stopping the switch stops motor-2 Exercise 2: Draw a ladder diagram for a two-motor system having the following conditions: The start switch starts motors 1 and 2. The stop switch stops motor 1 first, after 15 seconds motor 2 stops. Exercise 3: Draw a ladder diagram for a three-motor system having the following conditions: Motor 1 (M1) starts as soon as the start switch is on, after 10 seconds, M1 goes off and M2 starts. After 5 seconds, M2 goes off and M3 comes on. After 10 seconds, M3 goes off and M2 comes on; and after 5 seconds, M2 goes off and M1 comes on, and the cycle is repeated. Exercise 4: Blinking indicator lights are used quite extensively in industry. Design a circuit in which two lights are flashed alternately every 5 seconds.

RSlogix 500 V1.0 Sofcon India Pvt. Ltd.(Confidential-For Internal Use Only

Page 43

LAB 9:
Counters

COUNTER AND ITS APPLICATION

A device that counts the occurrence of an event. This may include pulses developed from operations such as: switch closures, interruptions of light beams, or other discrete events. In controllers, a software counter eliminates the need for hardware counters. Counter Parameters
a) The accumulator value (ACC) is the number of false-to-true

transitions that have occurred since the counter was last reset. b) The preset value (PRE) specifies the value that the counter must reach, before the controller sets the done bit. Types of Counters
1. Count Up (CTU)

It increases the current value by an increment of 1 every time an input transitions from FALSE to TRUE. Count up counters is started from zero and continue counting until the accumulated value matches the preset value.

When enabled and the .CU bit is cleared, the CTU instruction increments the counter by one. When enabled and the .CU bit is set, or when disabled, the CTU instruction retains its .ACC value.

RSlogix 500 V1.0 Sofcon India Pvt. Ltd.(Confidential-For Internal Use Only

Page 44

The accumulated value continues incrementing, even after the .DN bit is set. To clear the accumulated value, use a RES instruction that references the counter structure or write 0 to the accumulated value.
2. Count Down (CTD)

A device that decreases the current value by an increment of 1 every time an input transitions from false to true. Count down counters should always start counting at the preset value.
RSlogix 500 V1.0 Sofcon India Pvt. Ltd.(Confidential-For Internal Use Only Page 45

When enabled and the .CD bit is cleared, the CTD instruction decrements the counter by one. When enabled and the .CU bit is set, or when disabled, the CTU instruction retains its .ACC value.

RSlogix 500 V1.0 Sofcon India Pvt. Ltd.(Confidential-For Internal Use Only

Page 46

The accumulated value continues decrementing, even after the .DN bit is set. To clear the accumulated value, use a RES instruction that references the counter structure or write 0 to the accumulated value. Now we have some exercises which can be solved by using above concept. Exercise 1: Draw a ladder diagram for a box packaging system having the following conditions. Five boxes are stacked at a time and then bound with a wrapper. Exercise 2: Design a ladder diagram that will control a stepper motor so that it moves 10 steps forward, waits for 20 seconds, and then cause the motor to move 10 steps in the reverse direction.

RSlogix 500 V1.0 Sofcon India Pvt. Ltd.(Confidential-For Internal Use Only

Page 47

RSlogix 500 V1.0 Sofcon India Pvt. Ltd.(Confidential-For Internal Use Only

Page 48

LAB 10: PLC Timer and Counter Based Problems

RSlogix 500 V1.0 Sofcon India Pvt. Ltd.(Confidential-For Internal Use Only

Page 49

LAB 11: Compare Instruction and its Application


Comparison instructions are basically input instructions and are used to test the values of two parameters to condition the logical continuity of a rung. Comparison instructions are given in Ladder Elements Toolbar. You can drag and drop the desired block to the rung.

EQUAL OR EQU Instruction The EQU instruction is used to test whether two values are equal. If source A and source B are Equal, the instruction is logically true. If these values are not equal, the instruction is logically false.

NOT EQUAL OR NEQ Instruction The NEQ instruction is used to test whether two values are not equal. If source A and source B are not Equal, the instruction is logically true. If these values are equal, the instruction is logically false.

RSlogix 500 V1.0 Sofcon India Pvt. Ltd.(Confidential-For Internal Use Only

Page 50

LESS THAN OR LES Instruction The LES instruction is used to test whether the value of source A is less than the value of source B. If this condition is fulfilled, the instruction is logically true, if the value at source A is greater than or equal to the value of source B, the instruction is logically false.

LESS THAN OR EQUAL OR LEQ Instruction The LEQ instruction is used to test whether one value (source A) is less than or equal to another (source B). If the value at value at source A is less than or equal to the value at source B, the instruction is logically true if the former is greater than the latter, the instruction is logically false.

GREATER THAN OR GRT Instruction


RSlogix 500 V1.0 Sofcon India Pvt. Ltd.(Confidential-For Internal Use Only Page 51

The GRT instruction is used to test whether one value (source A) is greater than another (source B). If the value at value at source A is greater than the value at source B the instruction is logically true but if the former is equal to or less than the latter, the instruction is logically false.

GREATER THAN OR EQUAL TO OR GEQ Instruction The GRT instruction is used to test whether one value (source A) is greater than or equal to another value at source B. If the value at value at source A is greater than or equal to the value at source B the instruction is logically true but if the former is less than the latter, the instruction is logically false.

MASKED COMPARISON EQUAL OR MEQ Instruction The MEQ instruction is used to compare data of the source address to data of the reference address, by using the instruction portions of the data can be masked by a separate word.

RSlogix 500 V1.0 Sofcon India Pvt. Ltd.(Confidential-For Internal Use Only

Page 52

Source is the address of the value you want to compare. Mask is the address of the mask through which the instruction moves data. The mask can be a hexadecimal value. Compare is an integer value or the address of the reference.

LIMIT TEST OR LIM Instruction The LIM instruction is used to test whether certain values are within or outside a specified limit.

Exercise based on above instructions


RSlogix 500 V1.0 Sofcon India Pvt. Ltd.(Confidential-For Internal Use Only Page 53

Exercise 1: Motor 1(M1) starts as soon as the PLC starts. After 10 seconds, motor 1 goes off and motor 2 starts. After 5 seconds, M2 goes off and M3 starts. After another 10 seconds, M2 restarts and after 5seconds it stops, and M1 starts and the cycle is repeated. Prepare the logic diagram for the process.

LAB 12: Mathematics Instruction and its Application


Mathematical Instructions ADD Instruction (ADD)
The ADD instruction is used to add a numerical value in source A to another numerical value in source B. The result is then placed into a destination register.

With This Bit: Carry (C) Overflow (V)

The Processor: sets if a carry is generated; otherwise resets (integer). For floating point it is cleared. sets if an overflow is detected at destination; otherwise resets. On overflow, the minor error flag is also set. For floating point the overflow value is placed in the destination. For an integer, the value -32,768 or 32,767 is placed in the Page 54

RSlogix 500 V1.0 Sofcon India Pvt. Ltd.(Confidential-For Internal Use Only

destination. Exception: If you are using an SLC 5/02, SLC 5/03, or SLC 5/04 processor or a MicroLogix 1000 controller and have S:2/14 (math overflow selection bit) set, then the unsigned, truncated overflow remains in the destination. Zero (Z) Sign (S) sets if the result is zero; otherwise resets. sets if the result is negative; otherwise resets.

SUBTRACT Instruction (SUB)


The SUB instruction is used to subtract a numerical value from source B to another numerical value in source A. The result is then placed into a destination register.

With This

The Processor: Page 55

RSlogix 500 V1.0 Sofcon India Pvt. Ltd.(Confidential-For Internal Use Only

Bit: Carry (C) sets if a borrow is generated; otherwise resets (integer). For floating point it is cleared. sets if an underflow is detected at destination; otherwise resets. On underflow, the minor error flag is also set. For floating point the overflow value is placed in the destination. For an integer, the value -32,768 or 32,767 is placed in the destination. Exception: If you are using an SLC 5/02, SLC 5/03, or SLC 5/04 processor or a MicroLogix 1000 controller and have S:2/14 (math overflow selection bit) set, then the unsigned, truncated overflow remains in the destination. sets if the result is zero; otherwise resets. sets if the result is negative; otherwise resets.

Overflow (V)

Zero (Z) Sign (S)

MULTIPLY Instruction (MUL)


The MUL instruction is used to multiply a numerical value from source A with another numerical value in source B. The result is then placed into a destination register.

RSlogix 500 V1.0 Sofcon India Pvt. Ltd.(Confidential-For Internal Use Only

Page 56

With This Bit: Carry (C) always resets

The Processor:

Overflow (V)

sets if an overflow is detected at destination; otherwise resets. On overflow, the minor error flag is also set. The value -32,768 or 32,767 is placed in the destination. Exception: If you are using an SLC 5/02, SLC 5/03, or SLC 5/04 processor or a MicroLogix 1000 controller and have S:2/14 (math overflow selection bit) set, then the unsigned, truncated overflow remains in the destination. For floating point destinations the overflow result remains in the destination. sets if the result is zero; otherwise resets. sets if the result is negative; otherwise resets.

Zero (Z) Sign (S)

DIVIDE Instruction (DIV)


The DIV instruction is used to divide a numerical value from source A by another numerical value in source B. The rounded quotient is then placed
RSlogix 500 V1.0 Sofcon India Pvt. Ltd.(Confidential-For Internal Use Only Page 57

into a destination register. If the remainder is 0.5 or greater, a round up occurs in the destination register. The unrounded quotient is stored in the most significant word of the math register and the remainder is placed in the least significant word of the math register.

With This Bit: Carry (C) always resets.

The Processor:

Overflow (V)

sets if division by zero or overflow is detected; otherwise resets. On overflow, the minor error flag is also set. The value 32,767 is placed in the destination. Exception: If you are using an SLC 5/02, SLC 5/03, or SLC 5/04 processor or a MicroLogix 1000 controller and have S:2/14 (math overflow selection bit) set, then the unsigned, truncated overflow remains in the destination. For floating point destinations the overflow result remains in the destination. sets if the result is zero; otherwise resets; undefined if overflow is set. sets if the result is negative; otherwise resets; undefined if overflow is set.

Zero (Z) Sign (S)

RSlogix 500 V1.0 Sofcon India Pvt. Ltd.(Confidential-For Internal Use Only

Page 58

SQUARE ROOT Instruction (SQR)


When this instruction is evaluated as true, the square root of the absolute value of the source is calculated and the rounded result is placed in the destination.

With This Bit: Carry (C) Overflow (V) Zero (Z) Sign (S)

The Processor: is reserved (integer). For floating point it is always cleared. always resets. sets when destination value is zero. always resets.

In applications where the source value may be negative, use a comparison instruction to evaluate the source value to determine if the destination may be invalid

RSlogix 500 V1.0 Sofcon India Pvt. Ltd.(Confidential-For Internal Use Only

Page 59

Convert to BCD Instruction (TOD)


The TOD instruction is used to convert BCD values into integers. Programming Problem Develop a ladder rung that when the rung conditions are true, a stored binary value is converted to BCD and stored in the destination.

RSlogix 500 V1.0 Sofcon India Pvt. Ltd.(Confidential-For Internal Use Only

Page 60

In this example, when the binary bit B3:0/1 is set the stored binary value of 10 in the Source word N7:0 is converted to the equivalent BCD value and is stored in the destination N7:1. The N7 data file shows that the binary equivalent is shown in the N7:0 words and the BCD equivalent is shown in the N7:1 word. The N7:0 word shows 10 as a binary number, with the 3 bit, being equivalent to 8 added to the 1 bit which is equivalent to 2. In the N7:1 word, Bits 4-7 represents the first BCD digit. The 4 bit set to 1 show that the first digit in BCD is a 1. Bits 0-3 represent the second BCD digit. With all bits being set to 0 means that the second BCD value is 0. The resulting value of this is 10 in BCD.

Convert from BCD Instruction (FRD)


The FRD instruction is used to convert 16-bit integers into BCD values. Programming Problem Design a ladder program that will convert a value entered from two BCD switches to a binary number. For example, if a 26 is selected on the BCD switches it will be converted to the binary equivalent.

This example shows that when a 26 is entered using two BCD switches and the binary bit B3:3/1 is set, the BCD equivalent is stored in the word address N7:0. The BCD value is then converted to the binary equivalent and stored in the word address N7:1.

RSlogix 500 V1.0 Sofcon India Pvt. Ltd.(Confidential-For Internal Use Only

Page 61

The N7 data file shows that the BCD equivalent is shown in the N7:0 words and the binary equivalent are shown in the N7:1 word. Bits 4-7 represent the first BCD digit. The 5 bit set to 1 show that the first digit in BCD is a 2. Bits 0-3 represent the second BCD digit. The 1 and 2 bits set to 1 show that the 1 bit being 2 added to the 2 bit which is 4, results in the second digit in BCD which is 6. The final value in BCD therefore is 26. The N7:1 word shows 26 as a binary number, with the 4 bit, being equivalent to 16 added to the 3 bit which is equivalent to 8 added to the 1 bit which is equivalent to 2.

CPT instruction
The CPT instruction is used to perform copy, arithmetic, logical, and conversion operations. The user defines the operation in the Expression and the result is written in the destination. Use indexed or indirect addressing.

The following parameters are necessary when programming this instruction: Destination- Word address or the address of a floating-point data element. Expression- Zero or more lines, up to 28 characters per line, 255 characters.

RSlogix 500 V1.0 Sofcon India Pvt. Ltd.(Confidential-For Internal Use Only

Page 62

Negate Instruction (NEG) The NEG instruction is used to change the sign of the source and then place it in the destination.

Programming Example: When a water valve is opened a negative angle is read. Design a ladder program that will convert this negative value to a positive value so that it can be converted to radians.

LN instruction
RSlogix 500 V1.0 Sofcon India Pvt. Ltd.(Confidential-For Internal Use Only Page 63

The LN instruction is used to take the natural log of a number in the source location and store the result in the destination location.

Programming Example: Develop a ladder rung that will use a value located in N7:0 and take the natural log of it, storing the result in N7:10.

LOG instruction The LOG instruction is used to take the log to the base 10 of a number and then store the result in the destination output.

Programming Problem Develop a ladder rung that will use a value located in B3:0/8 and takes the log base 10 of it, storing the result in B3:2/3.

RSlogix 500 V1.0 Sofcon India Pvt. Ltd.(Confidential-For Internal Use Only

Page 64

Radian to Degrees (DEG) Use this instruction to convert radians (source) to degrees and store the result in the destination. The following formula applies: Source * 180/Pi where Pi = 3.141592 Example: Convert 3 radians to degrees. Using ratio where 180 = P in radians, we have:

Source is the integer and/or floating point values. Destination is the address of the word where the data is to be stored.

RSlogix 500 V1.0 Sofcon India Pvt. Ltd.(Confidential-For Internal Use Only

Page 65

XPY instruction The XPY instruction is used to raise a value to a specified power and then store the result in the destination location.

Programming Problem Develop a ladder rung that will take the value located in N7:0 and raise it to the value located in N7:2, while storing the result in N7:10.

Trigonometrical Mathematics Instructions The SIN instruction is used to take the sine of a number and then store the result in the destination output.

RSlogix 500 V1.0 Sofcon India Pvt. Ltd.(Confidential-For Internal Use Only

Page 66

Programming Problem Develop a ladder rung that will use a value located in N7:0 and take the sine of it, storing the result in N7:10.

The COS instruction is used to take the cosine of a number and then store the result in the destination output.

Programming Problem Develop a ladder rung that will use a value located in N7:0 and take the cosine of it, storing the result in N7:10.

RSlogix 500 V1.0 Sofcon India Pvt. Ltd.(Confidential-For Internal Use Only

Page 67

The TAN instruction is used to take the Tangent of a number and then store the result in the destination output.

Programming Problem Develop a ladder rung that will use a value located in N7:0 and take the Tangent of it, storing the result in N7:10.

RSlogix 500 V1.0 Sofcon India Pvt. Ltd.(Confidential-For Internal Use Only

Page 68

The ASN command takes the arc sine of a number (source in radians) and stores the result in the destination.

Programming Problem Develop a ladder rung that will take the Arc sine of a number and display the result in the destination. Floating point values must lie within {-1.0, 1.0}

. The ACS command takes the arc cosine of a number (source in radians) and stores the result in the destination.

Programming Problem Develop a ladder rung that will take the Arc cosine of a number and display the result in the destination. Floating point values must lie within {-1.0, 1.0}.
RSlogix 500 V1.0 Sofcon India Pvt. Ltd.(Confidential-For Internal Use Only Page 69

The ATN instruction is used to take the arc tangent of a number in the Source location and display the result in the destination location.

Programming Problem Develop a ladder rung that will use a value located in N7:0 and take the arctangent of it, storing the result in N7:10.

RSlogix 500 V1.0 Sofcon India Pvt. Ltd.(Confidential-For Internal Use Only

Page 70

RSlogix 500 V1.0 Sofcon India Pvt. Ltd.(Confidential-For Internal Use Only

Page 71

LAB 13: Exercise Based on Counter, Timer, Compare and Math Blocks

RSlogix 500 V1.0 Sofcon India Pvt. Ltd.(Confidential-For Internal Use Only

Page 72

LAB 14:

File Instruction

File Instructions Interrupts Program Control Instructions Scaling Instruction

File Instructions Copy Instruction (COP)


The COP instruction copies blocks of data from one Source address location into a Destination address.

There are three parameters, Source, Destination (Dest), and Length associated with the copy command: Source is the address of a word (such as I:1, S:3, N7:0, B3:3, or T4:0.ACC) of the file you want to copy. Dest is the address of a word (such as I:1, S:3, N7:0, B3:3, or T4:0.ACC) that you are copying the source file to. Length is the number of elements, or addresses in the file you want to copy.

RSlogix 500 V1.0 Sofcon India Pvt. Ltd.(Confidential-For Internal Use Only

Page 73

FIFO Load (FFL) and FIFO Unload (FFU)


FFL and FFU instructions are used in pairs. The FFL instruction loads words into a user-created file called a FIFO stack. The FFU instruction unloads words from the FIFO stack, in the same order as they were entered.

FFL Instruction Operation: When rung conditions change from false-to-true, the FFL enable bit (EN) is set. This loads the contents of the source, N7:10, into the stack element indicated by the position number, 9.

RSlogix 500 V1.0 Sofcon India Pvt. Ltd.(Confidential-For Internal Use Only

Page 74

FFU Instruction Operation: When rung conditions change from false-to-true, the FFU enable bit (EU) is set. This unloads the contents of the element at stack position 0 into the destination, N7:11.

LIFO Load (LFL) and LIFO Unload (LFU)


LFL and LFU instructions are used in pairs. The LFL instruction loads words into a user-created file called a LIFO stack. The LFU instruction unloads words from the LIFO stack in the opposite order as they were entered.

RSlogix 500 V1.0 Sofcon India Pvt. Ltd.(Confidential-For Internal Use Only

Page 75

When rung conditions change from false-to-true, the LFL enable bit (EN) is set. This loads the contents of the source, N7:10, into the stack element indicated by the position number, 9. The position value then increments.

LFU Instruction

When rung conditions change from false-to-true, the LFU enable bit (EU) is set. This unloads data from the last element loaded into the stack (at the position value minus 1), placing it in the destination, N7:11. The position value then decrements.
RSlogix 500 V1.0 Sofcon India Pvt. Ltd.(Confidential-For Internal Use Only Page 76

Shift Registers
A bit shift register is a register that allows the shifting of bits through a single register, or group of registers. The bit shift register shifts bits serially (from bit to bit) through an array in orderly fashion.

RSlogix 500 V1.0 Sofcon India Pvt. Ltd.(Confidential-For Internal Use Only

Page 77

Bit Shift Left Instruction


It Load a bit of data array, shifts the pattern of data through the array to the left and unloads the last bit of the data in the array.

RSlogix 500 V1.0 Sofcon India Pvt. Ltd.(Confidential-For Internal Use Only

Page 78

Bit Shift Right Instruction


It Load a bit of data array, shifts the pattern of data through the array to the Right and unloads the last bit of the data in the array.

LAB 15:

Program Control Instruction


Jump (JMP) and Label (LBL)

Use these instructions in pairs to skip portions of the ladder program.


RSlogix 500 V1.0 Sofcon India Pvt. Ltd.(Confidential-For Internal Use Only Page 79

Jump to Subroutine (JSR),Subroutine (SBR) & Return (RET)


The JSR, SBR, and RET instructions are used to direct the controller to execute a separate subroutine file within the ladder program and return to the instruction following the JSR instruction.

Master Control Reset (MCR)


Use MCR instructions in pairs to create program zones that turn off all the non-retentive outputs in the zone.

Temporary End (TND) This instruction, when its rung is true, stops the processor from scanning the rest of the program file, updates the I/O, and resumes scanning at rung 0 of the main program (file2). If this instructions rung is false, the processor continues the scan until the next TND instruction or the END statement.

RSlogix 500 V1.0 Sofcon India Pvt. Ltd.(Confidential-For Internal Use Only

Page 80

Suspend (SUS)
When this instruction is executed, it causes the processor to enter the Suspend Idle mode and stores the Suspend ID in word 7 (S:7) of the status file. All outputs are de-energized.

RSlogix 500 V1.0 Sofcon India Pvt. Ltd.(Confidential-For Internal Use Only

Page 81

In this example when I:1/0 is False or I:1/1 is TRUE the suspend command stops the program scan, de-energizes the outputs and activates the status bit. By using multiple SUS commands allows the ladder programmer the ability to section the ladder into section that may be stop at anytime. This command allows the ladder programmer to easily debug a program by progressively stop the ladder section to finds an incorrect result.

Enter a suspend ID number from -32,768 to +32,767 when you program the instruction. When the SUS instruction is executed, the programmed suspend ID, S:7 (word 7), as well as the program file ID, S:8 (word 8), from which the SUS instruction executed is placed in the system status file.

RSlogix 500 V1.0 Sofcon India Pvt. Ltd.(Confidential-For Internal Use Only

Page 82

LAB 16:

Analog Scaling

An SCP (Scale with Parameters) is a really handy instruction in RSLogix 500. It scales any range of values to a range defined by the programmer. One of the common uses of the SCP instruction is to take the value from an analog input and scale it to an engineering value. In RSLogix 500, doubleclick on 0000. This opens up the ASCII editor.

Type SCP in the box and press enter. SCP stands for Scale with Parameters. It allows you to take an analog input from a sensor and scale it to the output units you want. The SCP instruction starts out looking like this.

RSlogix 500 V1.0 Sofcon India Pvt. Ltd.(Confidential-For Internal Use Only

Page 83

Setting up an SCP The Input parameter is the value that will be scaled. Lets use this SCP instruction for the Scales. The input we will use is the address we assigned to the analog input card; that is, I:1.0(let us consider). The Input Min parameter is the value that is read by the analog card when there is no liquid in the tank. The Input Max is the value that is read by the card when the tank is full . The Scaled Min parameter is the lowest value you want the SCP to calculate in the units you want. The Scaled Max parameter is the highest value you want the SCP to calculate. The Output parameter is typically an address where you want to store the result of the SCP.

RSlogix 500 V1.0 Sofcon India Pvt. Ltd.(Confidential-For Internal Use Only

Page 84

RSlogix 500 V1.0 Sofcon India Pvt. Ltd.(Confidential-For Internal Use Only

Page 85

Вам также может понравиться