Beruflich Dokumente
Kultur Dokumente
PROGRAMMINGLOGICCONTROLLERS
4.1DEFINITIONOFPLC:
Aprogrammablelogiccontroller(PLC)Programisaspeciallydesigneddigitaloperatingmicroprocessor
basedcontrollerthatusesaprogrammablememoryforinternalstorageofinstructingandforinternalstorage
ofinstructingandforimplementingfunctionsuchaslogic,sequencing,timing,countingandarithmeticin
ordertocontrolmachinesandprocesses.
BASICCOMPONENTSOFPLC:
ThePLChardwaresystemconsistsofthebasiccomponentsare
Processor
Memory
PowerSupply
InputIOutputmodules
Programmingdevice
Monitor
Processor:
ItistheheartofPLC
Heprocessorprocessesthesignalsfrominputmoduleandgeneratescontrollingsignalsforthesystem
Italsoscansandsolvethelogicoftheuserprogram
ItconsistsofALU,microprocessorunit,memoryunitandsystempowersupply
Memory:
Thememoryunitcontainstheprogramstoredinit
Theprogramswerewrittenwithcontrolactionstobeexecutedbythemicroprocessorfortheinputgiven
RAMisatemporarystoragedeviceusedtostoreladderdiagramandfortestingandevaluation
ThenitisstoredinROMwherechangescannotdone
PowerSupply:
ThepurposeofapowersupplyunitistoconvertthemainA.CvoltageintoalowlevelD.Cvoltage(5V).
TheD.C.voltageissuppliedtotheprocessorandthecircuitsintheinputandoutputinterfacemodules.
Thepowersupplyshouldbefreefromheavyloads,noisesandvoltagefluctuations.
Input/OutputModules:
TheInputmodulereceivesinformationfromextendeddevicesandsendstoprocessorandcommunicatestheprocessed
informationtotheexternaldevicesthroughoutput
modules.
TheInputdevicesaremechanicalswitches,photosensors,temperaturesensors,flowsensors,other
typeofsensorskeypadsetc.,
Theoutputdevicesmayincludesolenoidvalves,Relays,contactors,lights,Horns,
Heatingelements,fans,Motorstarter,signalAmplifiers.Conveyorbelt,lift,automaticdooretc.,
I/Odevicesarealsocalledperipheraldevices.
ProgrammingDevice:
ItisusedtoentertherequiredprogramintothememoryoftheCPU
Theprogramisdevelopedinprogrammingdeviceandstoredintomemoryunit
BASICSTRUCTUREOR(INTERNALARCHITECTURE)OFAPLCSYSTEM:CentralProcessing
Unit:
TheCPUcontrolsandprocessesalltheoperationswithinthePLC.
Itissuppliedwithaclockwithafrequencyoftypicallybetween1to8MHz.
ThisfrequencydeterminestheoperatingspeedofthePLCandprovidesthetimingandsynchronizationforallelementsinthe
system.
TheinformationwithinthePLCiscarriedbymeansofdigitalsignals.
Theprocessorisamicroprocessorthatexecutesaprogramtoperformtheoperationsspecifiedinaladderdiagramorasetof
Booleanequations.
TheCPUconsistsofthefollowingunits
ArithmeticandLogicUnit(ALU):
ThisunitperformsdatamanipulationandarithmeticandlogicaloperationsoninputIvariabledataand
determinestheproperstateoftheoutputvariables.
Thearithmeticoperationincludesaddition,subtractionetc.,andlogicoperationsincludeAND,OR,AND,EXCLUSIVE
OR.
MemoryUnit:
Memorytermedregisterslocatedwithinthemicroprocessorandusedtostoreinformationinvolvedinaprogramexecution.
Theseprogramscontaincontrolactionstobeexecutedbythemicroprocessorforthegiveninput.Thereareseveralmemory
elementsinaPLCsystem.
SystemReadonlyMemory(ROM)givespermanentstoragefortheoperatingsystemandfixeddatawedbytheCPU.
RAMfortheusertodevelopprogramandactsatemporarymemory.
Inaddition,temporarybufferstoresfortheI/Ochannels.
ControlUnit:
Acontrolunitisusedtocontrolthetimingofoperations.
Theprocessorfunctionsunderapermanentsupervisoryoperatingsystemthatdirectstheoveralloperationsfromdatainput
andoutputtoexecutionofuserprograms.
Thecontrollercanperformonlyoneoperationatatime.So,itscanseachoftheinputssequentially,evaluatestheladder
diagramprogram,provideeachoutput(s),andthen
repeatthewholeprocess.
Hence,thetimingcontrol'snecessaryforaPLCsystem.
MemoryUnit:
Thesequenceofinstructionstobeexecuted,programsarestoredinthememoryunit.
DuringenteringandeditingincludingDebugging,theprogramisstoredinthetemporarystoragescalled
RAM(RandomAccessmemory).
Oncetheprogramiscompletelyfinished(free&fromerrors).
Itmaybe'burned'intoROM
WhentheROMispluggedintothePLC,thedeviceisreadytobeplacedintoserviceintheindustrialenvironment.
FornetworkprogrammedPLCs,thefinalPLCsprogramisdownloadedintoaspecialreprogrammable
ROM(EPROM,PROM,andEEPROM)inthePLC.MemorymaybeeithervolatiletypeorNonvolatiletype.
VolatileMemory:
VolatilememoryortemporarymemoryorApplicationmemoryistheusermemory,wheretheusercanenterandeditthe
program.
Volatilememorywillloseallitsprogrammedcontentsifoperatingpowerisremovedorlost.
Therefore,necessarytoprovideabatterybackuppowertoalltimes.
NonVolatileMemory:
Nonvolatilememoryorpermanentmemoryorsystemmemoryis(used)asystemmemorythatstoresthemonitorabooting
programs,lookuptablesetc.,
Thisusuallyprogrammedandsuppliedbythemanufacturer.
ThiscontrolstheoperationofPLC.
Itdoesnotloseitscontentduringpowerfailure.
Itdoesnotrequireanybattery.
TheROMmemoryofferstheCPUtouseonlyfixedamountofdata.
TheDifferentTypesofROMSare
_
MaskprogrammedROM
PROM
EPROM
EEPROM
MaskProgrammedROM:
ItisaspecialtypeofROMwhichisprogrammedduringmanufacturing.
TheprogrammedcontentstoredbythistypeofROMmemorycannotbealtered.
PROM:
PROMstandsforprogrammableReadonlymemory.
ItisaspecialtypeofROMusuallyprogramedbymanufacturerduringmanufacturing.
Ithasthedisadvantageofrequiringspecialprogrammingdeviceandonceprogrammedcannotbeerasedoraltered.
EPROM:
EPROMstandsforelectricallyprogrammableReadonlyMemory.
Here,theuserprogramselectrically.
OnecanerasetheprogramcompletelybyshiningUVlightsourceorquartzwindowinpackage.
Aftertheprogramchipiserasedcompletely,programchangescanbemade.
WhentheprogramdevelopedinRAM,themanufacturersusuallyloaditinEPROMtomakepermanentstorage.
EEPROM:
EEPROMElectricallyErasableprogrammableReadonlymemory.
Eventhough,itisanonvolatilememory,itofferssomeprogrammingflexibilityasRAM.
Onecanerasetheprogramcompletelybyelectricalsignals.
ProgramchangescanbemadeveryeasilywiththeuseofaPCwithEEPROMsoftware.
Itcanbeelectricallyprogrammablebytheuser.
Buses:
AsetofparallellinesthatprovidescommunicationbetweenvariousdevicesofasystemistermedasaBus.
ThebussystemcarriesinformationanddatastoandfromtheCPU,MemoryandI/Ounits.
Theinformationistransmittedinbinaryformas0or1
Digitalsignalsorelectricalsignalsareflowinginsidethebus.
Itmightbetracksonaprintedcircuitboard(PCB)orwiresinaribboncable.
ThePLCsystemcontainsfourbuses.
TheyarenamelyDataBus,AddressBus,Controlbusandsystembus.
DataBus:
Thedatabuscontains8,16or32parallelsignallinesforsendingdatabetweenthevariousdevicesofasystem.
An8bitmicroprocessorhasaninternaldatabuswhichcanhandle8bitnumbers.
Thedoubleendedarrowsonthebuslineshowthattheyarebidirectional.
ThismeansthatCPUcanreaddatainfrommemoryorfromI/OunitontheselinesoritcansenddataouttomemoryortoI/O
unitontheselines.
Manydevicesinasystemwillhavetheiroutputsconnectedtothedatabus,butonlyonedevicewillhaveitsoutputenabledat
atime.
AddressBus:
TheAddressbuscontains16,20,24or32parallelsignallinestocarrytheAddressofthememorylocationsforaccessing
storeddata.
EverymemorylocationisgivenadistinctuniqueaddresstolocateeasilyandaccessedbytheCPUeithertoreadorwrite
data.
ControlBus:
TheControlbuscontains4to10parallelsignallinestocarrythesignalsusedbytheCPUthatarerelatedtointernalControl
actions.TypicalcontrolbussignalsareMemory
readMemorywrite,I/OReadandI/Owrite.
I/OSystemBus:
_
TheI/OsystembusprovidethecommunicationbetweentheI/OportsandI/Ounits
Input/OutputUnit:
TheI/Ounitsprovidetheinterfacebetweenthesystemandtheoutsideworld,allowingforconnectionstobemadethrough
I/Ochannelstoinput/outputdevices.
ProgramsareenteredfromaprogrampanelthroughI/Ounit.
INPUT/OUTPUTPROCESSING:
ThesourcingandsinkingareusedtodescribethewayinwhichDCdevicesareconnected
toPLC
Sourcing:
Ifaswitchisconnectedtothepositiveofthebatteryandcurrentflowsfrompositivetonegative,itissaidtobethesourcing
thecurrent.So,theinputdevicereceivescurrent
fromtheinputmodule.
ForthePLC,inputunit,henceinputmoduleisthesourceofthecurrent.ForthePLCoutputunit,outputmoduleisthesource
ofcurrentasitsuppliescurrenttotheoutput
devices.Sourcingoutputunitsforinterfacingwithsolenoids.
Sinking:
Here,theinputdevicesuppliescurrenttotheinputmodule.ForthePLCinputunit,hencetheinputmoduleisthesinkforthe
current.Sinkinginputunitsareusedfor
interfacingwithelectronicequipment.
So,ifaswitchisconnectedtothenegativeofthebatteryandcurrentflowsfrompositivetonegative,byconventionalcurrent
flowdirection,itissaidtobethesinkingfor
Current.ForthePLCoutputunit,thecurrentflowsfromoutputdevicetotheoutputmodulethentheoutput
moduleisthesinkforcurrent.
STEPSINVOLVEDININPUT/OUTPUTPROCESSING:
ThesequencefollowedbyaPLCwhencarryingoutaprogramcanbeasfollows:
Scantheinputsassociatedwithonerungoftheladderprogram
Solvethelogicoperationinvolvingthoseinputs.
Set/Resettheoutputsforthatrung
Moveonthenextrungandrepeattheoperations1,2,3
ThetwomethodsofInput/Outputprocessingoperationsare
Continuousupdating
MassInput/Outputcopying
ContinuousUpdating:
Thesequencefollowedthusincontinuousupdatingisasfollows:
Fetchanddecodethefirstprograminstruction
Scanthererelevantinputs
Fetchanddecodethesecondprograminstruction
Scantherelevantinputsetc.Fortheremainingprograminstructions
Updateoutputs
Reporttheentiresequence.
MassInput/OutputCopying:
ThesequencefollowedinMassI/Ocopyingisthus:
ScanalltheinputsandcopyintoRAM
Fetchanddecodeandexecutealltheprograminstructionsinsequence
CopyalltheoutputinstructionstoRAM
Repeatthesequence
PLCLOGIC:
InstructionCodeMnemonics:
ANDLogicFunction:
ANDlogiccircuitrepresentsseriescircuit
ANDgateiscomposedwithtwoinputsandoneoutput.
ANDgateproduceoutputwhenboththeinputsareHIGHstate.
InputA
InputB
OutputA.B
0
0
0
0
1
0
1
0
0
1
1
1
ORLogicFunction:
ORlogiccircuitrepresentstheparallelcircuit.
ORGateiscomposedoftwoormoreinputsandoneoutput.
ORoperationislikeadditionofbinarynumbers.
ORgateproduceoutputwhenanyoneinputareHIGHstate.
InputA
InputB
Output(A+B)
0
0
0
0
1
1
1
0
1
1
1
1
NOTLogicFunction:
NOTfunctionisalsoknownasInverter.
NOTgateiscomposedofsingleinputandasingleoutput.
Thebubble,orcircle,attheoutputisthestandardsymbolusedtorepresentinversion.
InNOTgate,thereisanoutput,whenthereisnoinputandnooutputwhenthereisaninput
NANDLogicFunction:
NANDisacombinationofANDandNOTgates.
ArrangementshowsANDgateisfollowedbyNOTgate.HenceitiscalledNOTANDgate.
BoththeinputsAandBhavetobeatLOWstatetogettheoutputatHIGHstate.
NANDGateiscomposedoftwoormoreinputwithasingleoutput.
AnyoneinputisinLOWstatealsooutputwillbeHIGHstate
NORLogicFunction:
NORisacombinationofORandNOTgates.
ArrangementshowsORgateisfollowedbyNOTgate.HenceitiscalledNOTORgate.
BoththeinputsAandBhavetobeatLOWstatetogettheoutputatHIGHstate.
NORGateiscomposedoftwoormoreinputwithasingleoutput.
AnyoneinputisinHIGHstatealsooutputwillbeLOWstate
ExclusiveOR(XOR)LogicFunction:
WhenboththeinputsareatLOWstatetheoutputwillbeatLOWstate
WhenboththeinputsareatHIGHstatetheoutputwillbeatLOWstate
WhenanyoneinputisHIGHstatetheoutputwillbeatHIGHstate
latching:
Itisnecessarytoholdanoutputcoilenergized,evenwhentheinputceases
Thetermlatchisusedforthecircuitusedtocarryoutsuchanoperation.
Latchcircuitisaselfmaintainingcircuitthatmaintainsitsoutputinanenergizedstateuntilthenextinputisupdated
TIMER:
AtimerisaspecialcounterladderfunctionthatallowsthePLCtoperformtimingoperationsbasedonapreciseinternal
clock.
TypesofTimers:
DelayONTimersorONdelaytimers
DelayOFFTimersorOFFdelaytimers
PulseTimers
CascadedTimers
ONOFFCycleTimers
OneShotTimers
DelayONTimers:
Thetermdelayisusedtoindicatethatthistimerburnson,afterwaitingforafixedtimedelayperiod.
Whenthereisaninput,thetimerisenergisedandstartstiming,aftersomepresetvalue,thetimercontactsareclosedto
output.
TONisusedtodenoteONdelay.
DelayOFFTimers:
OFFdelaytimersaremaintainedasONforafixedtimeofdelayperiodbeforeturningoff.
TOFisusedtodenoteOFFdelay.
PulseTimers:
PulsetimerswitchesisanothertypeofTimerwhichcomeseitherONorOFFforafixedperiodoftimeasafunctionof
pulses.
TPisusedtodenotePulseTimers
CascadedTimers:
Cascadingmeansmoreelementsarelinkedtogethertoformasystem.
Thecascadingtimersarelinkedtogethertogivelongerdelaytimeswhichiseasilyachievedthanjustonetimer.
ONOFFCycleTimer:
Timersproducinganoutputforsomeperiodandnooutputforsomeperiodandanoutputforsomeperiod.
ThetimerisdesignedtoswitchanoutputforTsecandoffforanotherTsecond
OneShotTimers:
Oneshottimersproducesanoutputforafixedlengthofsomeinitiationinput.
INTERNALRELAY:
Aninternalrelaybehaveslikerelayswiththeirassociatedcontacts,buytheyarenotactualrelayswhosesimulationsarecontrolled
bythePLCsoftware.
Internalrelayscanbeveryusefulintheimplementationofswitchingsequences.
Theyareoftenusedwhenthereareprogramswithmultipleinputconditions.
TheyarealsoknownasAuxiliaryrelaysormarkers.
Inusinganinternalrelays,ithastobeactivatedononerungofaprogramandthenitsoutputusedtooperateswitching
contactsonanotherrungofaprogram.
COUNTERS:
Countersareusedtocountaspecifiednumberofcontactoperations.
TypesofCounters:
UpCounters
DownCounters
UpCounters:
Upcounterscountupfromthezerotopresetvalue
Theeventsareaddeduntilthepresetvalueisreached
Whenthecounterreachesthesetvalue,itscontactschangestate
DownCounters:
Downcounterscountdownfromthepresetvaluetozero
Theeventsaresubtracteduntilthepresetvalueisreached
WhenthecounterreachestheZerovalue,itscontactschangestate
SHIFTREGISTER:
Ashiftregisterisanelectronicstoragedevicethatallowsthestoredbitsofonerelaytogetshiftedintoanotherrelay.
DATAHANDLING:
ThestepsinvolvedindatahandlingwithaPLCsystemare
Movingdatafromonememorylocationtoanother
ComparisonofMagnitudesofdata
_
Arithmeticoperations
_
Dataconversion
DataHandling
Source
Destination
Instruction
Address
Address
DataMovement:
Instruction
:MOV
Function
:Tocopyavaluefromoneaddresstoanother
Program:
LDX400
MOV
D1
D2
WhenthereisaninputtoX400,
Thedatamovesfromthedesignatedsourceaddresstothedesignateddestinationaddress.
Thedatatransfermightmoveaconstantintoadataregister
DataComparison:
ThedatacomparisoninstructiongetsthePLCtocomparetwodatavalues.
Itcompareapresetvalue(1)totheinputvalue(2)
orEQU
orGRT
orLEQ
or<>orNEQ
orGEQ
Fordatacomparisonthetypicalinstructionwillcontainthedatatransferinstructiontocomparethedatafromsourceaddressand
designationaddress
Itisrequiredtosoundanalarmifasensorindicatesatemperatureabove90Candremainsoundinguntilthe
temperaturefallsbelow75C.
Forthis,theladderdiagramisshownabove.
Theinputtemperaturedataisinputtedtothesourceaddressandthedestinationaddresscontainsthesetvalue.
Whenthetemperaturerises90Corhigher,thedatavalueinthesourceaddressbecomes>thedestination
addressvalueandthereisanoutputtothealarmwhichlatchestheinput
Whenthetemperaturefallsto75Corlower,thedatavalueinthesourceaddressbecomes<thedestinationaddress
valueandthereisanoutputtotherelaywhichthen
opensthecontactsandsoswitchesthealarmoff.
DataArithmeticOperations:
PLCsareofferedwiththeabilitytocarryoutthearithmeticoperationssuchasaddition,subtraction,
multiplicationanddivisiononly.
Theycannotcarryoutexponentialfunctions.
Additionandsubtractionoperationsareusedtoalterthevalueofdataheldindataregisters.
Multiplicationsareusedtomultiplysomeinputbeforeaddingtoorsubtractingitfromanother.
CodeConversions:
AlltheinternaloperationsintheCPUofaPLCarecarriedoutthroughbinarynumbers.
MostPLCsprovideBCDtobinaryandbinarytoBCDconversionforuse.
Whenadecimal(input)signalisgiven,BCDconversionisused.
Similarly,whenadecimaloutputisrequired,Decimalconversionisused.
ThedataatthesourceaddressisinBCDandconvertedtobinaryandplacedatthedestinationaddress.
SELECTIONOFPLCS
TheselectionprocessofPLCforaparticulartaskdependsonthefollowingfactors.
CapacityofInputandOutput
No.ofInputsandOutputs
TypesofInputsandOutputs
SizeofmemoryrequiredI,
SpeedandPowerrequiredoftheCPU