Transcription of Basics of PLC Programming - UNED
1 Lecture PLC Programming BasicsMME 486 Fall 20061 of 62 Basics of PLC ProgrammingIndustrial Control SystemsFall 2006 Lecture PLC Programming BasicsMME 486 Fall 20062 of 62 PLC ArchitectureLecture PLC Programming BasicsMME 486 Fall 20063 of 62 PLC SystemLecture PLC Programming BasicsMME 486 Fall 20064 of 62 Processor MemoryOrganizationAdvanced ladder logic functionsallow controllers toperform calculations, make decisions and do othercomplex tasks. Timers and counters are examples of ladder logic functions. Theyare more complex thanbasic inputs contacts and output coils and relyheavily upon data stored in the memoryof the PLC. The memoryof a PLC is organized bytypes. The memoryspace can be divided into two broad categories:programand PLC Programming BasicsMME 486 Fall 20065 of 62 Memory MapA memory map can be used to show how memoryisorganized in a PLC.
2 Data tableUser programHousekeeping memory Input/output locations Internal relay and timer/counter locationsThe user program causesthe controller to operatein a particular mannerUsed to carry out functions needed to makethe processor operate(no access by user)Lecture PLC Programming BasicsMME 486 Fall 20066 of 62 Program FilesProgram file organizationfor SLC-500 controller . The user program willaccount for most of thememoryof a PLC system. Program files contain the logic controllingmachine operation. This logic consists ofinstructions that areprogrammed in aladder logic PLC Programming BasicsMME 486 Fall 20067 of 62 Data FilesData file organizationfor SLC-500 data file portion of memorystores input and output status, processor status, the status ofvarious bits and numerical data. Lecture PLC Programming BasicsMME 486 Fall 20068 of 62 Data FilesData files are organized bythe type of data theycontainLecture PLC Programming BasicsMME 486 Fall 20069 of 62 Input Table File OperationInput moduleSwitch OpenBinary 0 stored0 Lecture PLC Programming BasicsMME 486 Fall 200610of 62 Input Table File OperationInput moduleProcessor continuallyreads current inputstatus and updatesinput image table fileSwitch ClosedBinary 1 stored1 Lecture PLC Programming BasicsMME 486 Fall 200611of 62 Output Table File OperationOutput moduleProcessor continuallyactivates or deactivatesoutput status according to output image tablefile statusStatus 00 OutputOFFL ecture PLC Programming BasicsMME 486 Fall 200612of 62 Output Table File OperationOutput moduleProcessor continuallyactivates or deactivatesoutput status according
3 To output image tablefile statusStatus 11 OutputONLecture PLC Programming BasicsMME 486 Fall 200613of 62 Program ScanDuring each operating cycle, the processor reads allinputs, takes these values, and energizes or de-energizesthe outputs according to the user program. This process is known as a scan. I/O scan records status data of input devices. Energizes output devices thathave their associated status bits set toON (1) Program scan instructions are executed sequentiallyBecause the inputs can change at anytime, the PLC must carryon this process PLC Programming BasicsMME 486 Fall 200614of 62 Scan ProcessThe scan timeindicates how fast the controller can reactto changes in inputs. Scan times vary with computermodel and program content, and length. If a controllerhas to react to an input signal that changes states twice during the scan time, it is is possible that the PLC willnever be able to detect this change.
4 Scan time maybe a concern in high speed operations Lecture PLC Programming BasicsMME 486 Fall 200615of 62 Scan ProcessRead inputsAdjustsoutputsRunprogramThe scan is aa continuous and sequentialprocessLecture PLC Programming BasicsMME 486 Fall 200616of 62 Data FlowOverviewProgramInput imagetable fileOutputimage table fileInputmodulesInputdataExamine dataCheck/compare/examinespecific conditionsOutputdataOutputmodulesTake someactionReturn resultsLecture PLC Programming BasicsMME 486 Fall 200617of 62 Scan ProcessInputModuleOutputModuleProgramInp utdeviceOutputdeviceInputfileOutputfileI :3/6O:4/7I:3/6O:4/7I:3/6O:4/7 When the input is closed, the input module senses a voltage and an ONcondition (1) is entered into theinput table bit I:3/6 During the program scan the processor sets instructions I:3/6 and O:4/7 to ON (1)The processor turnslight output O:4/7ON during the nextI/O scanLecture PLC Programming BasicsMME 486 Fall 200618of 62 Scan PatternsHorizontal Scanning OrderThe processor examinesinput and output instructions from the first command, top leftin the program, horizontally, rung byrung.
5 End of ladderIn addition to the program itself, the scan time is also dependent on the clock frequency of the processor!Lecture PLC Programming BasicsMME 486 Fall 200619of 62 Scan PatternsVertical ScanningOrderThe processor examinesinput and output instructions from the first command, vertically,column bycolumn andpage bypage. Pages areexecuted in sequence. End of ladderMisunderstanding the way the PLC scans can cause Programming bugs! Lecture PLC Programming BasicsMME 486 Fall 200620of 62 PLC Programming Languages The term PLC Programming languagerefers to the method bywhich the user communicates information to the PLC. The three most common language structures are:ladder diagram language, Boolean language, andfunctional chart. Ladder diagram languageBoolean languageFunctionalchartLecture PLC Programming BasicsMME 486 Fall 200621of 62 Comparing Programming LanguagePB1CR1CR2LS1 SOLR elaySchematicPB1CR1CR2LS1 SOLE quivalent ladder diagram languageEquivalent Boolean languageLecture PLC Programming BasicsMME 486 Fall 200622of 62 Relay-Type InstructionsThe ladder diagram language is basicallya symbolicset of instructions used to create the controller program.
6 These ladder instructions symbols are arranged to obtain the desired control logic . Lecture PLC Programming BasicsMME 486 Fall 200623of 62 Examine If Closed (XIC) InstructionSymbolAnalogous to the normallyopen relay contact. For this instruction we ask the processor to EXAMINE IF (the contact is) CLOSED (XIC) Typicallyrepresents anyinput. Can be a switch or pushbutton, a contact from a connected output,or a contact from an internal a bit-level address which is examined for anON status bit will be either 1 (ON) or 0 (OFF).Lecture PLC Programming BasicsMME 486 Fall 200624of 62 Examine If Closed (XIC) InstructionI:012I:01204 Lecture PLC Programming BasicsMME 486 Fall 200625of 62 Examine If Closed (XIC) InstructionI:012I:01204If the status bit is 0 (OFF), then the instructionis FALSE. Lecture PLC Programming BasicsMME 486 Fall 200626of 62 Examine If Closed (XIC) InstructionI:012I:01204If the status bit is 1 (ON), then the instruction is TRUE.
7 Lecture PLC Programming BasicsMME 486 Fall 200627of 62 Examine If Open (XIO) InstructionSymbolAnalogous to the normallyclosed relaycontact. For this instruction we ask the processor to EXAMINE IF (the contact is) OPEN (XIO). Typicallyrepresents anyinput. Can be a switch or pushbutton, a contact from a connected output,or a contact from an internal a bit-level address which is examined for an OFF status bit will be either 1 (ON) or 0 (OFF).Lecture PLC Programming BasicsMME 486 Fall 200628of 62 Examine If Open (XIO) InstructionI:012I:01204If the status bit is 0 (OFF), then the instruction is TRUE. Lecture PLC Programming BasicsMME 486 Fall 200629of 62 Examine If Open (XIO) InstructionI:012I:01204If the status bit is 1 (ON), then the instruction is FALSE. Lecture PLC Programming BasicsMME 486 Fall 200630of 62 SymbolAnalogous to the relay coil.
8 The processor makes this instruction true (analogous to energizing a coil) when there is path of true XIC and XIO instructions in the anyoutput that is controlled bysome combination of input logic . Can be a connecteddevice or an internal output (internal relay).If anyleft-to-right path of input conditions is TRUE,the output is energized (turned ON).Output Energize (OTE) InstructionLecture PLC Programming BasicsMME 486 Fall 200631of 62 Output Energize (OTE) InstructionO:013I:012O:01301I:012I:01211 15 OUTPUT ENERGIZE instruction - TRUE Lecture PLC Programming BasicsMME 486 Fall 200632of 62 Output Energize (OTE) InstructionO:013I:012O:01301I:012I:01211 15 OUTPUT ENERGIZE instruction - FALSEL ecture PLC Programming BasicsMME 486 Fall 200633of 62 Status Bit ExamplesAAABit statusInput moduleOutputOutputButton not actuatedTrueFalseONOFFL ecture PLC Programming BasicsMME 486 Fall 200634of 62 Status Bit ExamplesAAABit statusInput moduleOutputOutputButton actuatedOFFONF alseTrueLecture PLC Programming BasicsMME 486 Fall 200635of 62A ladder rung consists of a set of input conditions,represented bycontact instructions, and an outputinstruction at the end of the rung, represented bythecoil RungABCDO utputinstructionInput conditionsOutputinstructionLecture PLC Programming BasicsMME 486 Fall 200636of 62 Ladder RungABCDO utputinstructionInput conditionsOutputinstructionFor an output to be activated or energized, at least oneleft-to-right path of contacts most be closed.
9 Acomplete path is referred to as having logic continuity. When logic exists the rung condition is said to be TRUE. Lecture PLC Programming BasicsMME 486 Fall 200637of 62 Rung ContinuityBit in memoryBit in memoryLS_1 SOL_511 The Examine If Closed instruction is TRUE making the rung TRUEL ecture PLC Programming BasicsMME 486 Fall 200638of 62 Rung ContinuityBit in memoryBit in memoryLS_1 SOL_500 The Examine If Closed instruction is FALSE making the rung FalseLecture PLC Programming BasicsMME 486 Fall 200639of 62 Allen-BradleySLC-500 controller Addressing AddressinputterminalI1:3/12 Closed inputInput image tablefile 1I:3/12 Bit addressI1:312 User-programmed rungEnergizedoutput6O:0:4 AddressoutputterminalO0:4/6 Output image tablefile 0O:0:4/6 Bit addressLecture PLC Programming BasicsMME 486 Fall 200640of 62 Structure of A16-Bit Word 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 Word(16 bits)Bit0 OFF ON1I/O Connection DiagramL1L2PB1LS1I:4/5I:4/6L1L2O:2/3O.
10 3/6 SOL 1PL 1 RLecture PLC Programming BasicsMME 486 Fall 200641of 62 Parallel Input Branch InstructionsABCB ranch instructions are usedto create parallel paths ofinput condition at least one of these parallel branches forms a true logicpath, the logic is PLC Programming BasicsMME 486 Fall 200642of 62 Parallel Output BranchingABCDEOn most PLC models, branches can be established atboth the input and output portion of the output branching, you can program parallel outputs on a rung to allow a true logic path to control multiple PLC Programming BasicsMME 486 Fall 200643of 62 Nested Input and Output BranchesInput and output branches can be nestedto avoid redundant instructions and to speed up the processorscan nested branch starts or ends within another PLC Programming BasicsMME 486 Fall 200644of 62 Nested Contact ProgramABCDEYN estedcontactOn some PLC models,the Programming of anested branch circuitcannot be done instructionC repeatedABCCDEYR eprogrammed toobtain the PLC Programming BasicsMME 486 Fall 200645of 62 PLC Matrix Limitation DiagramMax parallellinesNo.