Selasa, 10 Maret 2009

Control Program Of PLC

The control program is a software program in the PLC’s memory. It’s what puts the control in a programmable controller. The user or the system designer is usually the one who develops the control program. The control program is made up of things called instructions. Instructions are, in essence, little computer codes that make the inputs and outputs do what you want in order to get the result you need. There are all different kinds of instructions and they can make a PLC do just about anything (add and subtract data, time and count events, compare information, etc.). All you have to do is program the instructions in the proper order and make sure that they are telling the right devices what to do and voila!…you have a PLC-controlled system. And remember, changing the system is a snap. If you want the system to act differently, just change the instructions in the control program. Different PLCs offer different kinds of instructions. That’s part of what makes each type of PLC unique. However, all PLCs use two basic
types of instructions:
• contacts
• coils
Contacts are instructions that refer to the input conditions to the control program—that is, to the information supplied by the input field devices. Each contact in the control program monitors a certain field device. The contact waits for the input to do something in particular (e.g., turn on, turn off, etc.—this all depends on what type of contact it is). Then, the contact tells the PLC’s control program, “The input device just did what it’s supposed to do. You’d better check to see if this is supposed to affect any of the output devices.”
A contact is a computer code that monitors the status of an inputÉ ÉA coil is a computer code that monitors the status of an output. Coils are instructions that refer to the outputs of the control program— that is, to what each particular output device is supposed to do in the system. Like a contact, each coil also monitors a certain field device. However, unlike a contact, which monitors the field device and then tells the PLC what to do, a coil monitors the PLC control program and then tells the field device what to do. It tells the output device, “Hey, the PLC just told me that the switch turned on. That means that you’re supposed to turn on now. So let’s go!”

Central Procssing Unit of PLC

A PLC basically consists of two elements: the central processing unit and the input/output system the central processing unit (CPU) is the part of a programmable controller that retrieves, decodes, stores, and processes information. It also executes the control program stored in the PLC’s memory. In essence, the CPU is the “brains” of a programmable controller. It functions much the same way the CPU of a regular computer does, except that it uses special instructions and coding to perform its functions.
The CPU has three parts:
• the processor
• the memory system
• the power supply
The processor is the section of the CPU that codes, decodes, and computes data. The memory system is the section of the CPU that stores both the control program and data from the equipment connected to the PLC. The power supply is the section that provides the PLC with the voltage and current it needs to operate. The input/output (I/O) system is the section of a PLC to which all of the field devices are connected. If the CPU can be thought of as the brains of a PLC, then the I/O system can be thought of as the arms and legs. The I/O system is what actually physically carries out the control commands from the program stored in the PLC’s memory. The I/O system consists of two main parts:
• the rack
• I/O modules
The rack is an enclosure with slots in it that is connected to the CPU. I/O modules are devices with connection terminals to which the field devices are wired. Together, the rack and the I/O modules form the interface between the field devices and the PLC. When set up properly, each I/O module is both securely wired to its corresponding field devices and securely installed in a slot in the rack. This creates the physical connection between the field equipment and the PLC. In some small PLCs, the rack and the I/O modules come prepackaged as one unit.
All of the field devices connected to a PLC can be classified in one of two categories:
• inputs
• outputs
Inputs are devices that supply a signal/data to a PLC. Typical examples of inputs are push buttons, switches, and measurement devices. Basically, an input device tells the PLC, “Hey, something’s happening out here…you need to check this out to see how it affects the control program.” Outputs are devices that await a signal/data from the PLC to perform their control functions. Lights, horns, motors, and valves are all good examples of output devices. These devices stay put, minding their own business, until the PLC says, “You need to turn on now” or “You’d better open up your valve a little more,” etc.

why we use PLC

The softwiring advantage provided by programmable controllers is tremendous. In fact, it is one of the most important features of PLCs. Softwiring makes changes in the control system easy and cheap. If you want a device in a PLC system to behave differently or to control a different process element, all you have to do is change the control program. In a traditional system, making this type of change would involve physically changing the wiring between the devices, a costly and time-consuming endeavor.
For exsample :
LetÕs say that two push buttons, PB1 and PB2, are connected to a PLC. Two pilot lights, PL1 and PL2, are also connected to the PLC. The way these devices are connected now pressing push button PB1 turns on pilot light PL1 and pressing push button PB2 turns on pilot light PL2. LetÕs say that you want to change this around so that PB1 controls PL2 and PB2 controls PL1. In a traditional system, you would have to rewire the circuit so that the wiring from the first push button goes to the second pilot light and vice versa. However, because these devices are connected to a PLC, making this change is as simple as making a small change in the control program.

In addition to the programming flexibility we just mentioned, PLCs offer other advantages over traditional control systems. These advantages include:
• high reliability
• small space requirements
• computing capabilities
• reduced costs
• ability to withstand harsh environments
• expandability

Jumat, 06 Maret 2009

Function block in the ladder diagram.

First Rung Place a function block in the ladder diagram.
1. Choose Data Move from the box on the left side of the Compact Function Toolbar. The listbox will become populated with the Data Move Functions.
2. Choose MOVE_WORD from the listbox, click the Function Drop Mode button , and move the cursor into the ladder diagram. A small function block icon will appear next to the mouse pointer.
3. Place the MOVE_WORD instruction in the diagram underneath the rung you created earlier by clicking in this location. Notice that this automatically becomes Rung 2 in the margin. Press the Escape key.
4. Wire the power flow input of the function to the power rail using the point-to-point wiring method.
5. Click in the grid block next to the IN input on the MOVE_WORD function. A gray box will appear next to the input.
6. Type 16#A01 and press Enter. You have just entered a hexadecimal constant as input to the function. The same convention is followed for octal and binary numbers (8#, 2#). You do not need to type a 0 in as a placeholder.
7. After hitting Enter, the gray box moved over to the space next to the Q output. Type REG_1,1R and press the Enter key. The name and address are added to the VDT.
8. Next, double click on the function block. The Function Properties Dialog Box appears. Enter the desired length (and for other functions, the address) and click OK.

Insert a row and drag & drop.
1. Insert an empty row between the Rungs 1 and 2 by right clicking on the MOVE_WORD function and selecting Insert Row from the context-sensitive menu.
2. Highlight the function block by clicking on the space to the left of the block and dragging down and to the right. Make sure the entire block and connected values are highlighted, including the constant 16#A01 and the output Reg_1. Release the mouse button.
3. Place the pointer back in the highlighted area and click and drag. When the function block is in the desired position, release the mouse button. The entire block has been cut and pasted into the new location.
4. Note that similar results can be achieved by highlighting an area and then right clicking and choosing Cut and then moving the cursor to the new location, right clicking, and selecting Paste. Or, you can use Ctrl + C
and Ctrl + V to cut and paste the highlighted elements.
5. Save your work: Select File, Save All or press Ctrl + Shift + A.

Insert a comment.
1. Click in an area below Rung 2.
2. From the Insert menu, select Comment. A comment line will appear in the area where the cursor was. This is automatically named Rung 3.
3. Double click on the comment line. A scroll box will appear.
4. Type in your comment, hitting enter when you want to create a new line. When you want to exit, press Ctrl + Enter to leave the comment window. Your LD program should be similar to the one shown below.
Note: To change the comment display format, select Tools, Options and choose the Brief or Full option on
the General tab.

Compile the program and navigate to errors
1. Insert a few contacts without naming them and a few function blocks without assigning lengths or inputs or outputs
2. Select Folder, Check Block _MAIN. This compiles the folder and brings up the Information Window. If the Information Window is too small, place the cursor on the edge of the window and
click and drag to enlarge it.
3. Scroll through the Information Window to see the errors. To navigate to an error, place the cursor on the error text and double click. The area where the error occurred will be highlighted in the
Ladder Editor window.
4. Fix the errors and check the block again. When there are no more errors, the Syntax Check Summary in the Information Window will show “Total errors: 0.”

Creating New Blocks
You can create new objects in the folder by right clicking in the Folder Browser and picking the appropriate menu item from the File menu or the context-sensitive menu.
Note: If you are using a Series 90 Micro PLC or Series 90-70 PLC, which do not support Instruction List subroutines, you will want to skip Lessons 7 and 8. You can continue with lessons 9 and 10.

Create an Instruction List block.
1. Right click in the Folder Browser and select New, Subroutine, Instruction List from the context sensitive menu. The Create New Instruction List dialog box will be displayed.
2. Name the new block and type in a brief description of the block. Click OK. An Instruction List editor window for the new block will open.
3. Set temporary variables for the IL block. Select Edit, Properties, Variable Table. Select the Temporary Variables radio button. In the Boolean Address Start field, type 1T (or %T00001). In the Integer Address Start field, type 500R (or %R00500). Click OK.

Place a call to your new block in the _MAIN program.
1. Open the _MAIN program. (If the _MAIN program is already open, select it from the Window menu. If it is not open, double click the _MAIN-LD block in the folder browser.)
2. Click the Call button in the Ladder Toolbar and then click in the ladder diagram below the comment you created in Lesson 6. Press Enter. The Call function block will appear as follows.
3. Press Enter and select the new block from the list box that appears.

Creating ladder logic diagram using Versapro

The ladder editor in VersaPro is a free form editor that allows you to place elements in different rungs, assign names and addresses when convenient, and then check and compile the program all at once or block-by-block. The editor also includes common Windows features such as undo, copy/paste, and drag and drop.

Place, name, and assign addresses to Boolean elements in the ladder diagram.

1. Make sure that the VDT is visible. If not, select View, Variable Declaration Table, or press Alt + 3.

2. If the MAIN.blk Ladder Diagram editor window is not open, double click the _MAIN-LD block in the folder browser.

3. In the VersaPro _MAIN.blk window, click the Normally Open Contact button on the Ladder Toolbar.

4. Move your cursor into the ladder diagram. Note that the mouse pointer has a Normally Open Contact symbol as a subscript. Click in the first row and leftmost column in the ladder diagram. A

Normally Open Contact is placed in the grid where the pointer sits, and a gray box surrounds the contact.

5. Without moving the cursor, type Input_1, 1i and press Enter. The editor recognizes that you are typing a variable name and address, shows the name in the ladder diagram, and places the

name and address in the VDT. (1i indicates the address %I00001.)

6. Note that the Normally Open Contact button "sticks." Once it is selected, you will place a contact in every time you click in the diagram. Cancel the Normally Open Contact selection by

pressing the Escape key.

7. Click the cursor to the right of the Input_1 contact and type nocon (for Normally Open Contact). Since there is no element in the current space, a progressive search is performed to find the

element you want as you type. Press Enter.

Note: You can drag and drop a variable from the VDT to an element in the logic editor if the function does

not have a variable assigned to the parameter. Steps 8 and 9 use this alternate means of assigning a variable

name to an element.

8. In the VDT, type the Name, Type, Len, and Address as shown in the figure below. (You can type in the bottom, empty row or choose Insert Row from the context-sensitive menu.)

9. Select the name Input_2 and drag it to the contact that you created in step 7.

10. Choose the Normally Open Coil from the Ladder Toolbar.

11. Place the coil in the diagram a few spaces away and to the right of the second contact.

12. Type Output_1, 1q and press Enter. A variable named Output_1 with a reference address of %Q00001 will be created in the VDT. Press Escape.

13. Use point-to-point wiring to connect the contacts and the coil. Do this by placing the pointer on the right side of the second contact, then right click, hold, and drag to draw a connection

from the contact to the right side of the coil. (The cursor changes to a hand with a pencil.)