plc memory iii.3

Upload: sarjito

Post on 04-Jun-2018

217 views

Category:

Documents


0 download

TRANSCRIPT

  • 8/13/2019 Plc Memory III.3

    1/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. ITRO!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 relyupon 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&on in )igure *+.*. T&ere

    are to 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 filesdefined 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 creatingot&er programs are for subroutines.

    3&en a user creates a ladder logic program it& programming softare, it is

    con"erted to a mnemonic-li%e form, and t&en transferred to t&e PLC, &ere it is stored ina 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"erritten it& a ne program, serious

    problems could arise.

    PLC MEMORY *

  • 8/13/2019 Plc Memory III.3

    2/11

    Teknik Elektro Universitas Muhammadiyah Yogyakarta

    Figure 14.1 PLC Memory

    !. !ATA %ILE#Data files are used for storing different information types, as s&on in )igure

    *+./. T&ese locations are numbered from to 222. T&e letter in front of t&e numberindicates t&e data type. )or e!ample,F8: is read asfloating point numbers in data file 8.

    4umbers are not gi"en for O: andI:, but t&ey are implied to be O0: andI1:. T&e number

    t&at follos t&e : is t&e location number. ac& file may contain from to 222 locations

    PLC MEMORY /

  • 8/13/2019 Plc Memory III.3

    3/11

    Teknik Elektro Universitas Muhammadiyah Yogyakarta

    t&at may store "alues. )or t&e inputI: 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 &ardare 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 canbe 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 to files for integer numbersN: andN10:. T&e lengt& of t&e

    data files can be from up to 222 as s&on 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 1

  • 8/13/2019 Plc Memory III.3

    4/11

    Teknik Elektro Universitas Muhammadiyah Yogyakarta

    )igure *+./ s&os t&e default data files for a PLC-5. T&ere are many additional

    data types, a full list is s&on in )igure *+.+. 0ome of t&e data types are comple! and

    contain multiple data "alues, including!", #,$%,&',(, S#, and ". 8ecall t&at timersre9uire integers for t&e accumulator and preset, and TT, D4 and 4 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&on in )igure *+.5. Memory bitsare normally indicated it& a forard slas& folloed by a bit number )n. T&e first

    e!ample is from an input cardI: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 simplifyt&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 +

  • 8/13/2019 Plc Memory III.3

    5/11

    Teknik Elektro Universitas Muhammadiyah Yogyakarta

    Figure 14.5 it Le"el 'ddressing

    ntire ords can be addressed as s&on in )igure *+.6. T&ese "alues illnormally be assumed to be /s compliment, but some functions may assume ot&erise.

    T&e first e!ample s&os 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 to e!amples are morecomple! and t&ey access t&e accumulator and preset "alues for a timer. = as used for bit memory to indicate it is an integer. T&e first to 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 alays need to be stored in memory, t&ey can be define

    literally )igure *+.? s&os an e!ample of to different data "alues. T&e first is an

    integer, t&e second is a real number.

  • 8/13/2019 Plc Memory III.3

    6/11

    Teknik Elektro Universitas Muhammadiyah Yogyakarta

    0ometimes e ill ant to refer to an array of "alues, as s&on 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 alloing a "ariable in a data address, as s&on

    in )igure *+.2. T&e indirect "ariable part of t&e address is s&on beteen brac%ets =B=

    and ==. f a PLC is loo%ing at an address and it finds an indirect address it ill loo% in t&especified memory location, and put t&at number in place of t&e indirect address. Consider

    t&e first e!ample beloI:000)N:2/, if t&e "alue in t&e integer memory locationN:2 is

    +5, t&en t&e address becomesI:000)45. T&e ot&er e!amples are "ery similar. T&is type oftec&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. ndirect 'ddressing

    !pressions allo addresses and functions to be typed in and interpreted &en t&eprogram 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 !pression Data @alues

    PLC MEMORY 6

  • 8/13/2019 Plc Memory III.3

    7/11

    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 loer cost PLCs.)igure *+.** s&os 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 memoryN:0. T&e ne!t mo"e functionill copy t&e "alue fromN:0 to N:1. T&e t&ird statement ill add integers "alue in

    N:0 andN:1 and store t&e results inN:2.

    Figure 14.11 'n !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. !amples of bitaddresses are s&on in )igure *+.*/. T&e single blac%ened bit is in t&e t&ird ord!3:2and 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 ?

  • 8/13/2019 Plc Memory III.3

    8/11

    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 allos some poerful tools. 8ecall t&at by defaulttimers 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. !amples of t&ese are s&on 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 ando"erritten.

    Consider t&e simple ladder logic e!ample in )igure *+.*+. t s&os 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 7

  • 8/13/2019 Plc Memory III.3

    9/11

    Teknik Elektro Universitas Muhammadiyah Yogyakarta

    Figure 14.13 !amples of Timer and Counter 'ddresses

    Figure 14.14 Door Lig&t !ample

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

    0tatus memory allos a program to c&ec% t&e PLC operation, and also ma%e some

    c&anges. ' selected list of status bits is s&on in )igure *+.*5 for 'llen-radley

    Micrologic and PLC-5 PLCs. More complete lists are a"ailable in t&e manuals. )ore!ample t&e first four bits S2:0) 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 turnedon - 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 2

  • 8/13/2019 Plc Memory III.3

    10/11

    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 allos a time to be set in S2:28 so t&at if t&e PLC scan time is too long t&e PLCill gi"e a fault condition - t&is is "ery important for dangerous processes. 3&en a fault

    occurs t&e program number in S2:2 ill run. )or e!ample, if you &a"e a di"ide by (erofault, you can run a program t&at reco"ers from t&e error, if t&ere is no program t&e PLCill &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 ladderlogic. #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 on 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 ofparticular bits and ords ill be described later &en discussing specific functions.

    PLC MEMORY *

  • 8/13/2019 Plc Memory III.3

    11/11

    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 numberst&at can store data "alues from -1/?67 to 1/?6?. 3&en decimal fractions are supplied

    t&ey are rounded to t&e nearest number. T&ese "alues are normally stored in 4?:!! bydefault, but ne bloc%s of integer memory are often created in ot&er locations suc& as

    N:. nteger memory can also be used for bits.

    %loating Point Memory

    )loating point memory is a"ailable in neer and &ig&er cost PLCs, it is nota"ailable on t&e Micrologi!. T&is memory stores real numbers in + ords, it& ? digits

    of accuracy o"er a range from >-*.*?5+2++e-17 to >-1.+/7/1?e17. )loating point

    memory is stored in )7:!! by default, but ot&er floating point numbers can be stored inot&er locations. it le"el access is not permitted or useful for t&ese numbers.

    E. #UMMARYo 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, PD Control PD, 0)C 0tatus 0C.

    o n memory locations a =>= indicates a bit, =.= indicates a ord.o ndirect addresses ill substitute memory "alues beteen =B=, ==.

    o )iles are li%e arrays and are indicated it& =A=.

    o !pressions allo e9uations to be typed in.

    o Literal "alues for binary and &e!adecimal "alues are folloed by! and+.

    PLC MEMORY **