Anda di halaman 1dari 11

Teknik Elektro Universitas Muhammadiyah Yogyakarta

PLC MEMORY
Topics: o PLC-5 memory types; program and data o Data types; output, input, status, bit, timer, counter, integer, floating point, etc. o Memory addresses; ords, bits, data files, e!pressions, literal "alues and indirect. #b$ecti"es: o To %no t&e basic memory types a"ailable o To be able to use addresses for locations in memory

A. I TRO!UCTIO
'd"anced ladder logic functions allo controllers to perform calculations, ma%e decisions and do ot&er comple! tas%s. Timers and counters are e!amples of ladder logic functions. T&ey are more comple! t&an basic input contacts and output coils and t&ey rely upon data stored in t&e memory of t&e PLC. T&e memory of t&e PLC is organi(ed to &old different types of programs and data.

". MEMORY A!!RE##E#


T&e memory in a PLC is organi(ed by data type as s&o n in )igure *+.*. T&ere are t o fundamental types of memory used in 'llen-,radley PLCs - Program and Data memory. Memory is organi(ed into bloc%s of up to *--- elements in an array called a file. T&e Program file &olds programs, suc& as ladder logic. T&ere are eig&t Data files defined by default, but additional data files can be added if t&ey are needed.

C. PRO$RAM %ILE#
.n a PLC-5 t&e first t&ree program files, from - to /, are defined by default. )ile contains system information and s&ould not be c&anged, and file * is reser"ed for 0)Cs. )ile / is a"ailable for user programs and t&e PLC ill run t&e program in file / by default. #t&er program files can be added from file 1 to 222. Typical reasons for creating ot&er programs are for subroutines. 3&en a user creates a ladder logic program it& programming soft are, it is con"erted to a mnemonic-li%e form, and t&en transferred to t&e PLC, &ere it is stored in a program file. T&e contents of t&e program memory cannot be c&anged &ile t&e PLC is running. .f, &ile a program as running, it as o"er ritten it& a ne program, serious problems could arise.

PLC MEMORY

Teknik Elektro Universitas Muhammadiyah Yogyakarta

Figure 14.1 PLC Memory

!. !ATA %ILE#
Data files are used for storing different information types, as s&o n in )igure *+./. T&ese locations are numbered from - to 222. T&e letter in front of t&e number indicates t&e data type. )or e!ample, F8: is read as floating point numbers in data file 8. 4umbers are not gi"en for O: and I:, but t&ey are implied to be O0: and I1:. T&e number t&at follo s t&e : is t&e location number. 5ac& file may contain from - to 222 locations

PLC MEMORY

Teknik Elektro Universitas Muhammadiyah Yogyakarta

t&at may store "alues. )or t&e input I: and output O: files t&e locations are con"erted to p&ysical locations on t&e PLC using rac% and slot numbers. T&e addresses t&at can be used ill depend upon t&e &ard are configuration. T&e status S2: file is more comple! and is discussed later. T&e ot&er memory locations are simply slots to store data in. )or e!ample, F8:35 ould indicate t&e 16t& "alue in t&e 7t& data file &ic& is floating point numbers.

Figure 14.2 Data )iles for an 'llen ,radley PLC-5 #nly t&e first t&ree data files are fi!ed O:, I: and S2:, all of t&e ot&er data files can be mo"ed. .t is also reasonable to &a"e multiple data files it& t&e same data type. )or e!ample, t&ere could be t o files for integer numbers N : and N10:. T&e lengt& of t&e data files can be from - up to 222 as s&o n in )igure *+.1. ,ut, t&ese files are often made smaller to sa"e memory.

Figure 14.3 Locations in a Data )ile

PLC MEMORY

Teknik Elektro Universitas Muhammadiyah Yogyakarta

)igure *+./ s&o s t&e default data files for a PLC-5. T&ere are many additional data types, a full list is s&o n in )igure *+.+. 0ome of t&e data types are comple! and contain multiple data "alues, including !", #, $%, &', (, S#, and ". 8ecall t&at timers re9uire integers for t&e accumulator and preset, and TT, D4 and 54 bits are re9uired. #t&er data types are based on single bits, 7 bit bytes and *6 bit ords.

Figure 14.4 'llen-,radley Data Types 3&en using data files and functions e need to as% for information it& an address. T&e simplest data addresses are data bits : e &a"e used t&ese for basic inputs and outputs already;. 'n e!ample of 'ddress bits is s&o n in )igure *+.5. Memory bits are normally indicated it& a for ard slas& follo ed by a bit number )n. T&e first e!ample is from an input card I:000, t&e t&ird input is indicated it& t&e bit address )02. T&e second e!ample is for a counter #5: done bit )'N. T&is could also be replaced it& #5:4)15 to get e9ui"alent results. T&e 'N notation, and ot&ers li%e it are used to simplify t&e tas% of programming. T&e e!ample !3)4 ill get t&e fourt& bit in bit memory !3. )or bit memory t&e slas& is not needed, because t&e data type is already bits. bit - indi"idual bits in accessed - t&is is li%e addressing a single output as a data bit.

PLC MEMORY

Teknik Elektro Universitas Muhammadiyah Yogyakarta

Figure 14.5 ,it Le"el 'ddressing 5ntire ords can be addressed as s&o n in )igure *+.6. T&ese "alues ill normally be assumed to be /s compliment, but some functions may assume ot&er ise. T&e first e!ample s&o s a simple integer memory "alue. T&e ne!t e!ample gets up to inputs :from card - in rac% (ero; as a single ord. T&e last t o e!amples are more comple! and t&ey access t&e accumulator and preset "alues for a timer. <ere a =.= is used as t&e =>= as used for bit memory to indicate it is an integer. T&e first t o e!amples don=t need t&e =.= because t&ey are bot& integer "alue types. #t&er types of ord addressing are possible, including floating point numbers.

Figure 14.* .nteger 3ord 'ddressing Data "alues do not al ays need to be stored in memory, t&ey can be define literally )igure *+.? s&o s an e!ample of t o different data "alues. T&e first is an integer, t&e second is a real number. <e!adecimal numbers can be indicated by follo ing t&e number it& +, a leading (ero is also needed &en t&e first digit is ,, !, #, ', - or F. ' binary number is indicated by adding a ! to t&e end of t&e number. literal data "alue - a data "alue can be pro"ided it&out storing it in memory.

Figure 14. Literal Data @alues

PLC MEMORY

Teknik Elektro Universitas Muhammadiyah Yogyakarta

0ometimes e ill ant to refer to an array of "alues, as s&o n in )igure *+.7. T&is data type is indicated by beginning t&e number it& a pound or &as& sign =A=. T&e first e!ample describes an array of floating point numbers staring in file 8 at location 5. T&e second e!ample is for an array of integers in file starting at location 0. T&e lengt& of t&e array is determined else &ere. file - t&e first location of an array of data "alues.

Figure 14.8 )ile 'ddressing .ndirect addressing is a met&od for allo ing a "ariable in a data address, as s&o n in )igure *+.2. T&e indirect :"ariable; part of t&e address is s&o n bet een brac%ets =B= and =C=. .f a PLC is loo%ing at an address and it finds an indirect address it ill loo% in t&e specified memory location, and put t&at number in place of t&e indirect address. Consider t&e first e!ample belo I:000).N :2/, if t&e "alue in t&e integer memory location N :2 is +5, t&en t&e address becomes I:000)45. T&e ot&er e!amples are "ery similar. T&is type of tec&ni9ue is "ery useful &en ma%ing programs t&at can be adapted for different recipes by c&anging a data "alue in one memory location t&e program can follo a ne set of data. indirect - anot&er memory location can be used in t&e description of a location.

Figure 14.0 .ndirect 'ddressing 5!pressions allo addresses and functions to be typed in and interpreted &en t&e program is run. T&e e!ample in )igure *+.*- ill get a floating point number from file 7, location 1, perform a sine transformation, and t&en add *.1. T&e te!t string is not interpreted until t&e PLC is running, and if t&ere is an error, it may not occur until t&e program is running - so use t&is function cautiously. e!pression - a te!t string t&at describes a comple! operation.

Figure 14.10 5!pression Data @alues

PLC MEMORY

Teknik Elektro Universitas Muhammadiyah Yogyakarta

T&ese data types and addressing modes ill be discussed more as applicable functions are presented later in t&is c&apter and boo%. )loating point numbers, e!pressions and indirect addressing may not be a"ailable on older or lo er cost PLCs. )igure *+.** s&o s a simple e!ample ladder logic it& functions. T&e basic operation is suc& t&at &ile input , is true t&e functions ill be performed. T&e first statement ill mo"e :M#@; t&e literal "alue of 130 into integer memory N :0. T&e ne!t mo"e function ill copy t&e "alue from N :0 to N :1. T&e t&ird statement ill add integers "alue in N :0 and N :1 and store t&e results in N :2.

Figure 14.11 'n 5!ample of Ladder Logic )unctions

User "it Memory


.ndi"idual data bits can be accessed in t&e bit memory. T&ese can be "ery useful &en %eeping trac% of internal states t&at do not directly relate to an output or input. T&e bit memory can be accessed it& indi"idual bits or it& integer ords. 5!amples of bit addresses are s&o n in )igure *+.*/. T&e single blac%ened bit is in t&e t&ird ord !3:2 and it is t&e +t& bit 03, so it can be addressed it& !3:2)03. #"erall, it is t&e 15t& bit, so it could also be addressed it& !3)35. T&is met&od can also be used to access bits in integer memory also.

PLC MEMORY

Teknik Elektro Universitas Muhammadiyah Yogyakarta

Figure 14.12 ,it Memory

Timer Counter Memory


Pre"ious c&apters &a"e discussed t&e operation of timers and counters. T&e ability to address t&eir memory directly allo s some po erful tools. 8ecall t&at by default timers are stored in t&e "4: file. T&e bits and ords for timers are;

's discussed before e can access timer and counter bits and ords using t&e proper notation. 5!amples of t&ese are s&o n in )igure *+.*1. T&e bit "alues can only be read, and s&ould not be c&anged. T&e presets and accumulators can be read and o"er ritten. Consider t&e simple ladder logic e!ample in )igure *+.*+. .t s&o s t&e use of a timer timing "" bit to seal on t&e timer &en a door input &as gone true. 3&ile t&e timer is counting, t&e bit ill stay true and %eep t&e timer counting. 3&en it reac&es t&e *second delay t&e "" bit ill turn off. T&e ne!t line of ladder logic ill turn on a lig&t &ile t&e timer is counting for t&e first *- seconds.

PLC MEMORY

Teknik Elektro Universitas Muhammadiyah Yogyakarta

Figure 14.13 5!amples of Timer and Counter 'ddresses

Figure 14.14 Door Lig&t 5!ample

PLC #tatus "its &'or PLC()s and Mi*rologi+,


0tatus memory allo s a program to c&ec% t&e PLC operation, and also ma%e some c&anges. ' selected list of status bits is s&o n in )igure *+.*5 for 'llen-,radley Micrologic and PLC-5 PLCs. More complete lists are a"ailable in t&e manuals. )or e!ample t&e first four bits S2:0)1 indicate t&e results of calculations, including carry, o"erflo , (ero and negati"e>sign. T&e S2:1)15 ill be true once &en t&e PLC is turned on - t&is is t&e first scan bit. T&e time for t&e last scan ill be stored in S2:8. T&e date and cloc% can be stored and read from locations S2:18 to S2:23.

PLC MEMORY

Teknik Elektro Universitas Muhammadiyah Yogyakarta

Figure 14.15 0tatus ,its and 3ords for Micrologi! and PLC-5s T&e ot&er status ords allo more comple! control of t&e PLC. T&e atc&dog timer allo s a time to be set in S2:28 so t&at if t&e PLC scan time is too long t&e PLC ill gi"e a fault condition - t&is is "ery important for dangerous processes. 3&en a fault occurs t&e program number in S2:20 ill run. )or e!ample, if you &a"e a di"ide by (ero fault, you can run a program t&at reco"ers from t&e error, if t&ere is no program t&e PLC ill &alt. T&e locations from S2:30 to S2:55 are used for interrupts. .nterrupts can be used to run programs at fi!ed time inter"als, or &en inputs c&ange.

User %un*tion Control Memory


0imple ladder logic functions can complete operations in a single scan of ladder logic. #t&er functions suc& as timers and counters ill re9uire multiple ladder logic scans to finis&. 3&ile timers and counters &a"e t&eir o n memory for control, a generic type of control memory is defined for ot&er function. T&is memory contains t&e bits and ords in )igure *+.*6. 'ny gi"en function ill only use some of t&e "alues. T&e meaning of particular bits and ords ill be described later &en discussing specific functions.

PLC MEMORY

*-

Teknik Elektro Universitas Muhammadiyah Yogyakarta

Figure 14.1* ,its and 3ords for Control Memory

Integer Memory
.nteger memory is *6 bit ords t&at are normally used as /s compliment numbers t&at can store data "alues from -1/?67 to D1/?6?. 3&en decimal fractions are supplied t&ey are rounded to t&e nearest number. T&ese "alues are normally stored in 4?:!! by default, but ne bloc%s of integer memory are often created in ot&er locations suc& as N0:11. .nteger memory can also be used for bits.

%loating Point Memory


)loating point memory is a"ailable in ne er and &ig&er cost PLCs, it is not a"ailable on t&e Micrologi!. T&is memory stores real numbers in + ords, it& ? digits of accuracy o"er a range from D>-*.*?5+2++e-17 to D>-1.+-/7/1?e17. )loating point memory is stored in )7:!! by default, but ot&er floating point numbers can be stored in ot&er locations. ,it le"el access is not permitted :or useful; for t&ese numbers.

E. #UMMARY
o Program files store users programs in files / - 222. o Data files are a"ailable to users and ill be --222 locations long. o Default data types on a PLC-5 include #utput :#-:;, .nput :.*:;, 0tatus :0/:;, ,it :,1:;, Timer :T+:;, Counter :C5:;, Control :86:;, .nteger :4?:; and )loat :)7:;. o #t&er memory types include ,loc% Transfer :,T;, '0C.. :';, '0C.. 0tring :0T;, ,CD :D;, Message :ME;, P.D Control :PD;, 0)C 0tatus :0C;. o .n memory locations a =>= indicates a bit, =.= indicates a ord. o .ndirect addresses ill substitute memory "alues bet een =B=, =C=. o )iles are li%e arrays and are indicated it& =A=. o 5!pressions allo e9uations to be typed in. o Literal "alues for binary and &e!adecimal "alues are follo ed by ! and +.

PLC MEMORY

**

Anda mungkin juga menyukai