Top Banner

of 17

PRO1_13E [읽기 전용] [호환 모드]

Jun 02, 2018

Download

Documents

Nguyen Anh Tu
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
  • 8/10/2019 PRO1_13E [ ] [ ]

    1/17

    Contents Page

    Overview of the Organization Blocks ...................................................................................... 2

    Startup OBs ........................................................................................................................................ 3

    Interrupting the Cyclic Program ....................................................................................... 4

    Time-of-Day Interrupt (OB10) ........................................................................................................... 5

    Cyclic Interrupt (OB35) ...................................................................................................................... 6

    ar ware n errup ................................................................................................................

    Time-Delay Interrupt (OB20) .............................................................................................................. 8

    Diagnostic Interrupt, Asynchronous Error Interrupt (OB81...87) ....................................................... 9

    Asynchronous Error OBs .................................................................................................................. 10

    Synchronous Errors .......................................................................................................................... 11

    System Functions for Controlling Interrupt OBs ............................................................................... 12Start Information of OBs .................................................................................................................. 13

    xerc se: e erm ng e ype o ar up n ..........................................................................

    Exercise: Setting the System Time ................................................................................................... 15

    Exercise: Creating a Flashing Light with Cyclic Interrupt .................................................................. 16

    Exercise: Writing a Program for a Time-of-Day Interrupt ................................................................. 17

    Training Centerfor Automation and Drives

    ST-7PRO1Organization BlocksPage 1

  • 8/10/2019 PRO1_13E [ ] [ ]

    2/17

    Startup A startup program is carried out before the cyclic program execution after a powerrecovery, or a c ange o opera ng mo e roug e s mo e se ec or or y

    the PG).

    OB 100 to OB 102 are available for this.In these blocks you can, for example, preset the communications connections.

    Cyclic Program The program that is to be continuously executed is stored in the OrganizationExecution Block OB 1. After the user program has been completely executed in OB 1, a new

    cycle begins with the updating of the process images and the processing of the firststatement in OB 1. The scan cycle time and the response time of the system is aresu o ese opera ons.The response time is the total of the executing time of the CPUs operating systemand the time it takes to execute all of the user program.The response time, that is, how quickly an output can be switched dependent on aninput signal, is equal to scan cycle time x 2.

    Periodic Program With periodic program execution, you can interrupt the cyclic program executionExecution at fixed intervals. With cyclic interrupts, an OB 30 to OB 37 organization block is

    executed after a preset timing code has run out, every 100 ms for example. Control- , , .

    With time-of-day interrupts, an OB is executed at a specific time, for example everyday at 17:00 hours (5:00 p.m.), to save the data.

    Event-driven The hardware interrupt can be used to quickly respond to a process event. AfterProgram the event occurs, the cycle is immediately interrupted and an interrupt programExecution is carried out.

    The time-delay interrupt reponds after a delayed time period to a process event.With the error OBs you can determine how the system is to behave, for example, ifthe backup battery fails.

    Training Centerfor Automation and Drives

    ST-7PRO1Organization BlocksPage 2

  • 8/10/2019 PRO1_13E [ ] [ ]

    3/17

    Start Organization blocks are started exclusively by the operating system. There arevar ous s ar ng even s a ea o a s ar o e assoc a e organ za on oc s nthe corresponding priority class.

    Organization blocks can contain a normal control program, and also a declarationtable.

    Priorities Every OB program execution can be interrupted by a higher priority event (OB) atcommand boundaries. Priorities are graduated from 0-27, whereby 0 has the lowestpriority and 26 has the highest priority.

    ,other in the sequence they are recognized.

    Startup The S7-300 has the complete restart type of startup. With it, the process imagesand the non-retentive timers, counters and bit memories are deleted. Programexecution in OB 1 starts with the first statement.

    The S7-400 also has the restart type of startup. All data (bit memories, timers,counters, process images) are retained. Program execution resumes from the pointwhere the interruption occurred.

    a comp e e res ar , s execu e an w a res ar , s execu e .

    Cold Restart The 318-2 and 417-4 CPUs also have the cold restart type of startup. You canspecify this additional type of startup for a power failure. It is made with the HWConfiguration when you assign parameters to the CPU.With a cold restart, all bit memories, timers, counters and the process images aredeleted. The data blocks retain their preset values and the program resumes withthe first statement in OB 1 after the OB 102 startup block is executed.

    Training Centerfor Automation and Drives

    ST-7PRO1Organization BlocksPage 3

  • 8/10/2019 PRO1_13E [ ] [ ]

    4/17

  • 8/10/2019 PRO1_13E [ ] [ ]

    5/17

    Time-of-Day Time-of-day interrupts are used for executing a certain program called in OB 10n errup s e er once on y a a cer a n me or per o ca y once a m nu e, our y, a y,

    weekly, monthly, yearly) starting at that time.

    You configure time-of-day interrupts with the "HW Config" tool. To select when andhow OB10 is to be activated choose the menu options CPU -> Object Properties ->-> Time-of-Day Interrupts" tab.

    "Active" If you check the "Active" checkbox, the time-of-day interrupt OB is executed onevery complete restart of the CPU.

    Note Time-of-day interrupts can also be controlled by system functions at run time. Thefollowing system functions are available:

    SFC 28 "SET_TINT" Set starting date, time and period SFC 29 "CAN_TINT" Cancel time-of-day interrupt SFC 30 "ACT_TINT" Activate time-of-day interrupt " " - -

    Training Centerfor Automation and Drives

    ST-7PRO1Organization BlocksPage 5

    _ .

    S7-400 There are up to eight different time-of-day interrupt OBs (OB 10 to 17) for the S7-400 PLC.

  • 8/10/2019 PRO1_13E [ ] [ ]

    6/17

    Cyclic Interrupt Cyclic (watchdog) interrupts are used for executing blocks at fixed intervals. Thecyc c n errup or e - s .The default call interval for OB 35 is 100ms. You can change this to a value within

    the permitted range from 1ms to 1 minute.

    Starting Time When you activate a time-controlled interrupt, you specify the interval in relation tothe "starting time". The starting time begins every time the CPU mode changes fromSTOP to RUN.

    execution. The operating system calls OB35 at the specified time. If OB35 is stillactive at this time, the operating system calls OB80 (cyclic interrupt error OB).

    Note Cyclic interrupts cannot be controlled by system functions at run time.

    S7-400 There are up to nine different cyclic interrupt OBs (OB30 to 38) for the S7-400 PLC.

    Training Centerfor Automation and Drives

    ST-7PRO1Organization BlocksPage 6

  • 8/10/2019 PRO1_13E [ ] [ ]

    7/17

    Hardware Interrupt The program in a hardware interrupt OB (OB40) is executed as soon as a certaineven occurs.

    Hardware interrupts can be triggered by various module-specific signals:

    For parameter-assignable signal modules (DI, DO, AI, AO) you use the"HW Config" tool to specify the signal that is to trigger a hardware interrupt.

    In the case of CPs and FMs, you specify the interrupt characteristics usingthe configuration software for the module concerned.

    Example In the example above, suitable limit values have been configured for an analog inputmo u e. e measure va ue excee s e m , s ca e .

    This has the same effect as including a comparison operation in OB1 which causesan FB or FC to be called when the upper limit is reached. However, if you use OB40you don't need to write a program in another block.

    You can use the program in OB40 for interrupt generation or for process control.

    S7-400 There are up to eight different hardware interrupt OBs (OB40 to 47) for theS7-400 PLC.

    Training Centerfor Automation and Drives

    ST-7PRO1Organization BlocksPage 7

  • 8/10/2019 PRO1_13E [ ] [ ]

    8/17

    Time-Delay The program in a time-delay OB (OB20) is executed with a specified delayn errup a er a cer a n even as occurre .

    OB20 can only be activated by calling system function SFC32 (SRT_DINT). SFC32

    is also used for setting the delay time.

    SFC 32 OB_NR = Number of the OB to be executed with a time delay.

    DTIME = Delay time (1 to 60000ms)

    SIGN = User-specified signal for starting the time-delay interrupt OB

    = -_ ,delay interrupt OB (See on-line help for meanings of errornumbers).

    Note Apart from SFC32, the following SFCs are also available for dealing with time-delayinterrupts:

    SFC33 (CAN_DINT) = Cancel time-delay interrupt SFC34 (QRY_DINT) = Query time-delay interrupt.

    S7-400 There are up to four different time-delay interrupt OBs (OB20 to 23) for theS7-400 PLC.

    Training Centerfor Automation and Drives

    ST-7PRO1Organization BlocksPage 8

  • 8/10/2019 PRO1_13E [ ] [ ]

    9/17

    Asynchronous Asynchronous errors are faults in the functionality of the PLC. They occurrrors async ronous y o e execu on o e program an canno e race o a par cu ar

    point in the program (e.g. a diagnostic interrupt from a module).

    Response If a fault is detected in RUN mode and the relevant error OB has been programmed,it is called and the program in it is executed. This program could, for example,contain:

    instructions for switching on a siren

    instructions for data backup, followed by a STOP instruction

    a program for recording the frequency with which the fault occurs, withoutcausing the CPU to go into STOP mode.

    Note If the error OB for a particular fault is not present, the CPU automatically goes intoSTOP mode.

    Example Asynchronous error interrupt OB82 is called in the following situations, for example:

    Wire break on a module with diagnostic capability

    Failure of the power supply to an analog input module

    Measuring range of an analog input module exceeded, etc.

    Training Centerfor Automation and Drives

    ST-7PRO1Organization BlocksPage 9

  • 8/10/2019 PRO1_13E [ ] [ ]

    10/17

    Priorit The error OBs called in res onse to as nchronous errors are executed immediatelbecause they have the highest priority of all interrupt and error OBs:

    Priority 26 if the error occurs while an OB with lower priority (

  • 8/10/2019 PRO1_13E [ ] [ ]

    11/17

    Synchronous These errors can be traced to a particular point in the program if the error occurred

    rrors ur ng execu on o a par cu ar s a emen . e error s ca e n response o

    synchronous errors are executed as part of the program, with the same priority as the

    block that was being executed when the error was detected.

    Training Centerfor Automation and Drives

    ST-7PRO1Organization BlocksPage 11

  • 8/10/2019 PRO1_13E [ ] [ ]

    12/17

    OB's You will find a complete list and a description of the error OBs in the online help: or- e p - on en s - e p on oc s - e p on

    Organization Blocks.

    SFC's The system functions and their uses, how to call them and assign parameters tothem are discussed in an advanced programming course.

    Training Centerfor Automation and Drives

    ST-7PRO1Organization BlocksPage 12

  • 8/10/2019 PRO1_13E [ ] [ ]

    13/17

    Start Information You have a uniform system start information in the local data stack when the OB isca e y e opera ng sys em. e s ar n orma on as a eng o y es an savailable after the start of OB execution.

    Access to The STEP 7 software makes a standard declaration table available for theStart Information symbolic access to start information (example for OB 81).

    Note You can change or supplement the standard declaration table.The meanings of the variables are explained to you in the online help or in theStandard and System Functions manual.

    Training Centerfor Automation and Drives

    ST-7PRO1Organization BlocksPage 13

    In the example, the variable OB8_FLT_ID contains an identifier, if and which backup

    battery has failed.

  • 8/10/2019 PRO1_13E [ ] [ ]

    14/17

    Task: The S7-300 only has the one startup OB 100. If you want to respond accordingly ine program o e ype o s ar up, you ave o eva ua e e s ar n orma on n

    100. The operating system enters the following identifiers in the variable

    OB100_STRTUP:

    B#16#81 = manual complete restart B#16#82 = automatic complete restart.

    You are to write a program for the OB 100 so that the output Q 8.4 or Q4.4 is set fora manual complete restart and the output Q8.5 or Q 4.5 is set for an automaticcomp e e res ar .

    Example of an evaluation of a manual complete restart

    L OB100_STRTUP //Load startup identifierL B#16#81 //Load hexanumber 81==I //Compare for sameness= Q 8.4 //Display type of startup

    a o o: . pen e oc rom e program o e - a on y a on(Project "My Project")

    2. Supplement the program in OB 100.

    3. Download the block in the CPU and test your program.

    Training Centerfor Automation and Drives

    ST-7PRO1Organization BlocksPage 14

  • 8/10/2019 PRO1_13E [ ] [ ]

    15/17

    Task To set the correct system time of the S7 CPU.

    What to Do 1. Select the menu options PLC -> Set Date and Time (SIMATIC Manager or

    Program Editor).

    2. Enter the correct date and the exact time in the dialog box.

    Training Centerfor Automation and Drives

    ST-7PRO1Organization BlocksPage 15

  • 8/10/2019 PRO1_13E [ ] [ ]

    16/17

    Task You would like to use a flashing frequency of 3 Hz. This frequency is unfortunatelyno ava a e n e as ng requency memory.Set up a flashing frequency in the bit memory M35.0 with the help of a cyclic

    interrupt.

    Note Use the S7 program of the HW-Station "My Station" in the project "My Project".

    Training Centerfor Automation and Drives

    ST-7PRO1Organization BlocksPage 16

  • 8/10/2019 PRO1_13E [ ] [ ]

    17/17

    Task As of today, the horn on the conveyor model is always to switch on at the end of thecourse as your ra ner .The acoustic message is to be acknowledged using an empty input on the

    simulator.

    Note Use the S7 program of the HW-Station "My Station" in the project "My Project".

    Result You will be woken in time to go home.

    T i i C t ST 7PRO1