You are on page 1of 20
Object: Components/sub components of a PLC, learning functions of different modules of g Ploy ject: . Theory: 1 PROGRAMMABLE LOGIC CONTROLLER (PLC) is an industrial computer control system continuously monitors the state of input devices and makes decisions upon a custom propan to control the state of output devices. ‘Almost any production line, machine function, or process can be greatly enhanced using this of control system, However, the biggest benefit in using a PLC is the ability to change and replicas the operation or process while collecting and communicating vital information. PLCs are designed for multiple input and output arrangements. They can withstand various temperature ranges, electrical noises, vibrations, and impacts. Integrating a PLC into any production tine mechanical process is highly beneficial. PLCs enable operation processes to be changed or replicated, while simultaneously collecting and communicating important information. ‘There are four basic steps in the operation of all PLCs; Input Scan, Program Scan, Output Scan, and Housekeeping. These steps continually take place in a repeating loop. Four Steps In The PLC Operations 1. Input Scan © Detects the state of all input devices that are connected to the PLC 2. Program Scan Executes the user created program logic 3. Output Scan Energizes or de-energize all output devices that are connected to the PLC. 4. Housekeeping * This step includes communications with Programming terminals, internal diagnostics, etc. Start Housekeeping ner A scan Output scan Program scan Fig. P1.1 Practicals 4, Concept of PLC = PLC Programmable Logic Concept Programmable logic controller is a microprocessor based ing technique , which is used to perform many functions in industrial iced Programmable logic controller operates similar to the ordinary controller. But in this system different operation are performed by software If we want to change program it is only needed to change the program in the software PLLC takes input instructions in the form of ladder diagram or computer software instructions ‘These instructions are decoded in CPU and CPU provides differed signals to control or to operate many devices of System When these devices change their position or cause to change controlled variable. A sample of controlled variable is given to CPU indicate that change in controlled variable has been eliminated, PLC basically consists of a ladder network, which is performed according requirements of the system. Input and output device used in PLC: (@) Input Device An input device is a piece of computer hardware equipment used to provide data, and control signals to an information processing system (IPS). Some examples of input devices include: © Switches and push buttons * Sensing devices «Limit switches * Proximity sensors «Photoelectric Sensors * Condition sensors © Vacuum switches ‘© Temperature switches © Level switches © Pressure switches (b) Output Devices : ‘An output device is any piece of hardware used fo communicate the results of data processing cartied out by an IPS, and translate the information into an understandable form. * Valves ij * Motor starters + Homs and alarms © Stack lights i * Control relays * Pumps © Printers © Fans a SCADA Microcontroller ané free Pc js shown in above figure. Thy 3. Block Diagram FPLC sic controller (PLC) is 8 © PLC i ‘The block diagram of progr following basic sections ae- OM uo TO essor > u | OL—> —> ree ul FB To oe output Solenoids, sont contactors, limit switches, etc. Programming alarms, etc. device Fig, P1.2. PLC Block Diagram (i) Processor section (CPU) ‘The processor section is brain of PLC which consists of RAM, ROM, logic solver and user memory. The central processing unit is heart of PLC. CPU controls monitors and supervises all operation within PLC. The CPU makes decision and executes control instructions based on the program instruction in memory. (i) Input and output module The input module is a mediator between input devices and central processing unit (CPU) which is used to convert analog signal into digital signal. The output module is a mediator between output devices and central processing unit (CPU) which is convert digital signal into analog signal. . Power supply . P is provi ; say bine at pa the processor unit, input and output module unit. Power supply ly mo i volts. vunted unit. Most of the PLC operates on 0 volts DC and 24 (iv) Memory section The memory section is the area of the reieved. Data Memory is wret CPU it which data and information is stored and re code data etc. User memory contains sey ne Practicals 4834] Ww Programming device Programming devices are dedicated devices used for loading the user program into the program memory or edit it and to monitor the execution of the program of the PLC. It is also used to troubleshoot the PLC ladder logic program, Hand held terminal (HHT) or dedicated terminal or personal computer are programming devices commonly used in most of the PLCs. Result: Hence we learn about PLC, its concept and function of its different module. rocontroller and SCADA PRACTICAL NO. 2.) ee ing hand bar Zoprammer ) [84 PLC, Mic Object: Practical steps in interface. programming a PLC (#) us Theory: ing Hand held programming: Teg for programming a PLC for a certain application depends on the type of stand xe procs aes, en atarer software tool and the type of control application. Step 1: Analyze and Get the Idea of Control Application ; ‘The primary step to prograin the PLC is to get the idea for which you are going to develop an application, based program, if you are driving a line follower robot by the use of DC motor when the push bution is pressed. This status must be displayed by the LED light when the motor gets tun on. The motors also attached with a sensor (Here it is considered..as another switch) that detects obstacles, so when this turned on, the motor should be tured off. And correspondingly, if the motor switched off, the buzzer should be tuned on, ‘Switch 7 | ~ i: he Design usin, 2 Flowchart Brine te Mi Motor, A: input Switch 1, lnies : Bic is easy with the implementatio, Fig. P21 PLO Contro} t Step 2: List All the Conditions and Get Tole The variables of the above Buzzer, and the designing of the below for the above application Input Switch 2, L:LED and Bu: n of flow chart, which is give? Practicals 185] Switch On A Switch On C Switch Of B Switch OnB — |-_—»}Buzzeris On Motor is started and LED is on Fig. P2.2 Flowchart of PLC Programming suep3: Open and Configure the PLLC Programming Software Open the programming software installed in the PC that comes with PLC hardware. Select the hardware mde] of the PLC in the software and configure it with appropriate input and output modules. Select the Inder language (LD) from the list of the programming languages, and choose the hardware processor and give a name for the program. Fig. P2.3. PLC Programming Software Step 4: Add and Address Them the Required Rungs ae Add the required rungs based on the control application logic and giv ‘very input and outputs. The re the address 0 adder logic diagram of the above discussed example is given below. ler and SCADA PLC, Microcontrol [196 et 4 etl 4 A ef} 4 Rung 2 B Rung 3 aA KEL c BOA Fig, P2.4 Example of Ladder Logic Program Step 5: Check the Errors and Simulate It Locate the Online section in the menu bar and select Online. Check for the errors and make necessary changes after selecting Offiine. Again, go online and select the Run option to simulate. it, Step 6: Download the Program to PLC CPU Memory ‘After the successful simulation of the program, download the program to CPU by selecting the Download option through a network or communication cable. () Using Computer Interface These five steps will help you in your PLC programming. (@ Define the task (ii) Define the inputs and outputs Gii) Develop a logical sequence of operation (iv) Develop the PLC program (v) Test the program The five steps form the basis of all PLC development. Result: Hence, we learn some common practical steps in PLC programming =-4340 TZ, Practicals 1934] — opject* Basic logic operations, AND, NOT, OR functions ‘pheory? der Logic Functions i's take a real world event, allocate it to a norms . lope the real world events are defined as PLC inputs Slog (NC) contac nad salts Now, let’s call the result of the logic fu “y . jg defined as a PLC output. inction *Y’. In ladder logic the result of a rung logic function | When we take these two fundamental elements and insert them into a rung in a ladder diagram we get your first line of code! It's equivalent to “Hello World” in other programming languages... Input Output 7 pet te 4.1 Ladder Logic Basics - Hello World Input Output A Y It Then ( 4.2. Reading Ladder Logic Diagrams — In Built Functions Fig. tions by highlighting them in blue in order to illustrate the Now, let’s expose the hidden inbuilt func rung structure and it’s inbuilt IF, THEN functions... Telationship between the ladder diagram g as IF A THEN Y. We can write out the logic expression in the above as run ‘TRUE or FALSE. Because PLC input A follows the binary concept it has two possible states, Therefore it results in two possible logic iterations: IF A = FALSE THEN Y = FALSE IF A= TRUE THEN Y = TRUE We also can express this in a truth table... [194 PLC, Microcontroller and SCADA Truth Table Output Tnput iagram we express it symbolically in the form of a relay coil for the output. Remember the logic flow eh fq If we translate this into a ladder logic di t of current flow in an electric circuit. ‘open (NO) contact for the input and a left to right and follows the same concep! ‘The ladder logic truth table is shown below. Ladder Logic Basics Truth Table — Hello World Output A Y — A= False /--— A=True }_—__ ( ladder logic there are three more fundamental logic functions Input In order to fast track our understanding that are essential to know. You may be surprised, but wh ised, len we combine these thi i i to program the majority of automation control requireme ee en ele The three functions are: 1. NOT 2. AND 3. OR i) Ladder Logic NOT Function So if PLC input A is FALSE the result wi TRUE the result will be FALSE, O° TRUE. And vise versa when PLC input A* The NOT ion i i Function is sometimes referred toas reverse Noslecth ; ic. Check out the truth table below" If we translate a NOT function into a I form of @ normally closed (NC) contact Truth Tat Practicals 195] ~ NOT Function —" Tn re Output Y False Law ame = False ladder logic dia The ladder logic truth table is shown below. gram We express it symbolically in the Ladder Logic Basics Truth Table - NOT Function A Not A False SE True SE ie SIE (ii) Ladder Logic AND Function The AND function examines multiple PLC inputs and has one resulting output. If we translate an AND function into a ladder diagram we can express it symbolically in the form of two normally open (NO) contacts (PLC inputs A and B) and a relay coil (PLC output Y). They are all connected in line, just like a series connection in an electric circuit. Input A B Y i And Then ( Input Output Fig. P4.3 Ladder Logic Basics - AND Function This time we have also highligl nted the hidden AND function to illustrate the relationship between the ladder logic functions and the ladder diagram rung structure. We can write out the logic expression above as IF A AND B THEN Y. The AND function examines if all the PLC inputs are T' also TRUE, However if any one of the PLC inputs is FALSE then the correspo! also FALSE. RUE, then the corresponding result is nding result is Because PLC input A and B follows the binary concept and are part ofthe AND fonction there are four possible logis iterations. —_—_— 196 PLC. Microcontolier and SCADA Check out the truth table below.. ‘Truth Table - AND Function Input | Owput | Y False False False False True False True False False True True True ‘The number of logic iterations increases with the number of PLC inputs (2PLC Inputs), But that doesn’t matter too much with the AND function because the result can only be TRUE if all the PLC inputs are TRUE. If we translate an AND function into a ladder logic truth table we get the table below... Ladder Logic Basics Truth Table ~ AND Function Inputs Oui A B Y A= False B = False | 7 \ C } A= False B> True ; Y = False } ( ) Y = False f ( A= True B= True Epo ‘Nee yi) vader Logic OR Function Practicals 1974] (i ‘the OR function examines multiple PLC in . puts: sens an OR function ino a iden ae and has one resulting output. ram We can, of two normally open (NO) contacts (PLC inputs A aga ne re symbolically in the form jnputs are placed in 5 . ind B) and a relay il (PL ‘The inpul Placed in the Tung in what is known as a by *y coil q shania Y). el connection in an electric circuit, a branch. This is the equivalent of a ‘The output is then connected in line with the run Bese Input ” output = Then cy | | C} | Or Input B Fig. P4.4 Ladder Logic Basics - OR Function This time we have also highlighted the hidden OR function when we create a branch (parallel connection) with PLC input B across PLC input A. We can write out the logic expression above as IF A OR B THEN Y. ‘The OR function examines if any of the PLC inputs are TRUE, then the corresponding result is also TRUE. However, all the PLC inputs must be FALSE in order for the corresponding result is also be FALSE. Because PLC input A and are four possible logic iterations. Check out the truth table below... ‘ ‘Truth Table - OR Function s B follows the binary concept and are part of the OR function there Inputs Output Y fh 9 | PLC, Microcontroller and SCADA Remember, the number of logic iterations increases with the number of PLC inputs (2°Ctapus), But that doesn't matter too much with the OR function because the result can be TRUE if any of the PLC inputs are TRUE. If we translate an OR function into a ladder logic truth table we get the table below Ladder Logic Basics Truth Table ~ OR Function Output Y Input x3 A= False A t+—- ( J B = False Input Y = False B | | Input A= False A T ( B= True Input Y =True B Input A=Tnue A B= False Input Y=True B — a | 4H YH Result: Hence, we learn about logic operation and, or, not, el eree hs [226 PLC. Microcontroller and SCADA Object: Familiarization of micro controllers (8051) kit. Theory: ICROCONTROLLER : sien: ‘The 8051 is a 8-bit microcontroller planned by icro-controller has on-chip fringe devices. The * ; ean mat he vanced for math and single Boolean operations. Its family MCS-51 incorporates 8031, 8051 and 8751 microcontrollers. atta’ st In spite of it’s moderately, the 8051 is a standout amongst the most mainstres ocontrolles being used today. Numerous subordinate microcontrollers have subsequent to been produced that are in view of and perfect'with the 8051. In this way, the capacity to program 8051 is an essential ability for any individual who arrangements to create items that will exploit microcontrollers. e 2. FEATURES OF 8051 © 4096 bytes on-chip program memory. ‘* 128 bytes on-chip data memory. « Four register banks. 128 User defined software flags. © Two multiple mode, 16 bit timers/counters. * Hardware Multiple and divide in 4ysec. ‘© 64Kb each program and external RAM addressability. 3. ARCHITECTURE OF 8051 The 8051 microcontroller comprises of CPU, two sorts of memory segments, data and output pots uncommon capacity registers and control logic required for differem Peripheral functions. Thes¢ components comraunicates with 8-bit information BUS and Bus is Buffered to the outside through 4” V/O port when memory is fancied, Practicals 227 External intomupts ON-CHIP| ROM Bus 40 Serial ay ‘10 a bal TP EB nuh] SOPESE | = sopr PoPi Pa Py THD RXD “410 30 MHz Normally 11.0592 MHz fciveoeOate Fig. P61 4, PIN-OUT OF 8051 ‘The 8051 microcontroller is bundled in a 40-pin DIP (Dual Inline Package) . Every microcontroller have data and output ports. The 8051 has’32 V/O pins arranged as four 8-bit parallel ports (PO, Pl, P2, P3). Every one of the four ports are bidirectional i.e. every pin will be designed as data or output or both. Every single port pin are multiplexed with the exception of the pins of portl. Every port comprises of a hook, a output driver and an information support. The pin description is explained below: P10 wk 1 Pit 2 P00 P12 3 Pot p13 4 P02 pia 15 pos pis 16 Poa p16 7 a p17 18 Pos 9 POT, P30 P3.t P32 P33 Pay Fat P26 i P25 P24 P23 P22 P24 2.0 Fig. P6.2 [228 PLC. Microcontroller and SCADA PORT 1 Pins 1-8 . | Port 1 pins can be used only as Input and Output /O pins. PORT 2 Pins 21-28 | ilized to get to outer memory. Port2 outputs the high request byy, drives of port2 are uti smory. high re of be ostside memory address when the location is 16-bits wide, generally Port2is utilized as yg port. PORT3 Pins 10-17 All port pins of port3 are multifunctional. They have special functions. POWER-SUPPLY PINS 8051 operates on D.C power supply of +5v. The +5v is connected to the pins Vec (pin 40) and GND is connected to the pin 20. XTAL2 AND XTALI OSCILLATOR } For generating an internal clock signal, the external crystal oscillator is connected at these two pins. | | Ce 18 XTAL2 Cy 18 XTAL1 20 GND Fig. P6.3 ALE (ADDRESS LATCH ENABLE) ADO to AD7 lines are multiplexed. To de-multip| i ; = lex these Ii i address, an external latch and ALE signal of 3051 is used. Tp ae Kr eiaising lover baal RST (RESET) The pin is used to reset 8051. For i $ . For proper reset operation, i i two machine cycles, when crystal oscillator is running. Perce ast beheld igh a eas PSEN (PROGRAM STORE ENABLE) Pin 29 : Itis the active low output c i to activate able signal of the external RO! ive lox ontrol signal used tivate the en: ign: EPROM. It is activated every six oscillator periods while reading the em al may ternal memory. ahd Practicals 2284) 5A (EXTERNAL ACCESS) pin 31 av the point en BA pin is high Goined with vec), the system gets to address 0000H through iH are coordinated to interior ROM and project gets to addresses 1000H through FFFFH are jinated to outside ROM/EPROM. At the point when EA is low (When Ov) all addresses (Q000H_ comEFH) got by project are coordinated to the outside ROM/EPROM. 5, $051 0SC 1n 8051, # macl ods). Every state is partitioned into two stages (Phas Mock is dynamic and Phase 2 clock is dynamic amid ¢> exillator periods, (Sate 1, Phase 1) to (Sate 6, Phase 2) of | Hees 1D MHz. Every stage goes on for one oscillator period. {LLATOR AND CLOCK hhine cycle comprises of a succession of 6 states numbered $1 to $6 (12 oscillator e 1 and Phase 2). Amid Phase 1, Phase 1 ‘ase 2. A machine cycle comprises Of if the oscillator recurrence is 1¢——_ One machine cycle voles ezles[ voor | || rare =| Lv ee = XTAL Fig. P6.4 6, Kit Content: 1 x 8051 Development Board with AT89S52 Controller 1 x MAX232 IC 1 x DS1307 IC « 1.x ULN2003 IC «1x 16x2 LCD (Female) « 1x8 Pin Female to Female Connecting Wire” * 1x3 Pin Female to Female Connecting Wire « 2.x 4 Pin Female to Female Connecting Wire © 1x 8051 USBASP Programmer bout 8051 Microcontroller architecture, Result: Hence, we learn al pin diagram an its kit. [230 PLC. Microcontroller and SCADA PRACTICAL NO. 7 Object: Testing of general input/ output on micro controller board. Theory: 1. Testing of Input/output Ports: In this example I will explain how to use I/O ports of ‘8051 microcontroller. Input to the microcontroller can be given through push button and output can be seen through LED. Firstly all the port pins are defined. Port 2 is used as output port and port 3 is used as input port. These Ports are initialized with 0 (to write) and 1 (to read) logic respectively. Delay function is used to give the delay in showing output. Frequency of crystal should be set to 11.059MHz. Program is written in C language using “Keil”. software and hex file is loaded in the microcontroller. D1 a Rt Soy ‘= — LED-YELLOW C1 D2 =| ut 2 R2 a on “pe Shee ubvetiow * ES ext . os > —@: | RET — LED-YELLOW R4 D3. . © 300. . —_LED-YELLOW 18 P10 P3.0/AxD} #10 2elory — paampfett P12 P3.DiNTOLEI2 P13 PaginTifet3 Pid PLS P16 PIT \TESC51 . a Fig. P7.1 i Practicals 231] 2, WORKING of input output ports 8051 m ‘ . icrocontroller: When we run the simulation, if first be ON according to the respective input of then delay call is passed large integer value, Programming Code: #include sbit Led1 & P20; sbit Led2 = P241; sbit Led3 = P22; sbit Led4 = P23; sbit Button] = P30; /Defining Button Pins sbit Button2 = P31; sbit Button3 = P32; sbit Button = P343; ‘MDefining LED Pins void Delay(int); MDelay function declaration int main () { P2 = 0x00, Hased as.autput port P3 = OxFF; /used as input port do { 1 if(Button] == 0) INE 1switch pressed =1 MMst LED ON Delay(1000); Ledl = LED OFF if(Button2 == 0 ) inf 2°switch pressed Led2 = 1; 172° LED ON [282 PLC, Microcontroller and SCADA if(Button3 == 0 ) { Led3 = 1; /LED ON Delay(1000); //Delay Led3 = 0; //LED .QFF } if(Button4 == 0 ) { Led4 = 1; /LED ON Delay(1000); //Delay Led4 = 0; //LED OFF } while(1); } void Delay(int k) { int j; inti; forlimO;i

You might also like