Overview of an S7200 Program pps

3 171 0
Overview of an S7200 Program pps

Đang tải... (xem toàn văn)

Thông tin tài liệu

Overview of an S7-200 Program Step 7-Micro/WIN programming software supports the S7-200 CPUs. This programming package provides you with a set of features that enable you to enter/edit, debug, and print your program; perform program file maintenance; manipulate data in blocks, as well as communicate with your CPU and observe status of your program. Programming Languages You can program the S7-200 CPUs with either Ladder Logic (LAD) or Statement List (STL) programming instructions. Ladder Programs In LAD programs, the basic elements of logic are represented with contacts, coils, and boxes. A set of interconnected elements that make a complete circuit is called a network. A hard-wired input is represented by a symbol called a contact. A normally-open contact enables power flow when closed. A contact can also be normally closed. In this case, power flow occurs when the contact is opened. A hard-wired output is represented by a symbol called a coil. When a coil has power flow, the output is turned on. STL Programs STL program elements are represented by a set of instructions for performing the desired functions. Instead of using the graphic display as shown by ladder programs, the STL program is shown in text format. Executing Programs After you download the program to the CPU, it is executed from the first instruction through the last in a repetitive cycle, called a scan. The CPU scan consists of reading inputs, executing the user program, handling communication requests, performing internal tasks, and writing outputs. Addressing Modes When writing your program, you can use either of two modes of addressing instruction operands: direct or indirect. Direct Addressing Direct addressing specifies the memory area and the address; for example, VW790 refers to location 790 in V memory. Indirect Addressing You can address indirectly the data types I, Q, M, T, C, and V. To do this, create a pointer to the location. Use a Move Double Word (MOVD) instruction to move the address of a location (pointer) to the desired destination. Use only V memory locations or accumulator registers AC1, AC2, and AC3 as the destination address. Place an ampersand (&) at the beginning of the pointer address. Use an asterisk (*) before the destination address to indicate that the address contained in this location is to be used instead of the value. All pointers are double word values, and you can use them to access byte, word, and double word values. You cannot indirectly address bit values. In the example below, a pointer to VB200 is created, the value is accessed, and the pointer is incremented. Program Structure S7-200 programs consist of a main user program that may be followed by subroutines and/or interrupt routines. The main program is terminated by an unconditional END (MEND in STL). Subroutines are an optional part of a program; they must follow the end of the main program. Interrupt routines are also optional, and must follow the main program. You can use interrupt routines and subroutines in any order following the main program. However, if you group all subroutines following the main program and all interrupt routines immediately following the subroutines, your program structure will be easier to read and understand. Jumps and Subroutines enable transfer of control from one point in the program to another. The Jump instruction transfers control to the corresponding Label. Both the Jump and its corresponding Label must be in the same section of a program, either both in the main program or both in a subroutine or interrupt routine. You cannot jump between program sections to a corresponding Label in another section. For example, you cannot jump from the main program to a corresponding Label in a subroutine. The Subroutine is executed when it is invoked by a Call instruction. After executing the subroutine, control returns to the main program, and the instruction following the Call is then executed. You can nest subroutines to eight levels. CPU Memory The memory in the S7-200 CPUs consists of three segments: program, data, and configurable parameters. The segments are defined according to usage.  · Program memory stores the user program.  · Data memory includes a scratchpad area for the program and storage of data objects. Calculations, temporary storage, and constants reside in data memory. Additionally, data objects, such as timers, counters, high-speed counters, and analog inputs and outputs are stored in data memory.  · Configurable Parameter memory stores either the default or the modified parameters of the program setup. The configurable parameters include items such as protection level, password, station address, and retentive range information. CPU Memory Types and Ranges Accessed by: CPU Model 212 Ranges CPU Model 214 Ranges Bit (Byte.bit) V 0.0 - 1023.7 V 0.0 - 4095.7 I 0.0 - 7.7 I 0.0 - 7.7 Q 0.0 - 7.7 Q 0.0 - 7.7 M 0.0 - 15.7 M 0.0 - 31.7 SM 0.0 - 45.7 SM 0.0 - 85.7 T 0 - 63 T 0 - 127 C 0 - 63 C 0 - 127 Byte VB 0 -1023 VB 0 - 4095 IB 0 – 7 IB 0 - 7 QB 0 – 7 QB 0 - 7 MB 0 – 15 MB 0 - 31 SMB 0 – 45 SMB 0 - 85 AC 0 – 3 AC 0 - 3 Data Constants Data Constants Word VW 0 - 1022 VW 0 - 4094 T 0 – 63 T 0 - 127 C 0 – 63 C 0 - 127 IW 0 – 6 IW 0 - 6 QW 0 – 6 QW 0 - 6 MW 0 – 14 MW 0 - 30 SMW 0 – 44 SMW 0 - 84 AC 0 – 3 AC 0 - 3 AIW 0 – 30 AIW 0 - 30 AQW 0 – 30 AQW 0 - 30 Data Constants Data Constants Double Word VD 0 - 1020 VD 0 - 4092 ID 0 - 4 ID 0 - 4 QD 0 - 4 QD 0 - 4 MD 0 - 12 MD 0 - 28 SMD 0 - 42 SMD 0 - 82 AC 0 - 3 AC 0 - 3 HC 0 HC 0 - 2 Data Constants Data Constants Guidelines The guidelines listed below provide you with a checklist of the major items that you can accomplish with Step 7 - Micro/WIN. CAUTION: Always verify that your program operates correctly for your application; i.e., insure that no safety aspects have been overlooked in theprogram. • Set up a project. • Enter the application program. • Compile and debug the program. • Document the program. • Print the program and documentation. • Download the program to the CPU. • Test the program. • Set Password (if desired). • Place CPU in Run mode. • Monitor the application with Status and Chart functions. . and print your program; perform program file maintenance; manipulate data in blocks, as well as communicate with your CPU and observe status of your program. Programming Languages You can program. subroutines, your program structure will be easier to read and understand. Jumps and Subroutines enable transfer of control from one point in the program to another. The Jump instruction transfers control. Overview of an S7-200 Program Step 7-Micro/WIN programming software supports the S7-200 CPUs. This programming package provides you with a set of features that enable

Ngày đăng: 07/07/2014, 11:20

Từ khóa liên quan

Mục lục

  • Overview of an S7-200 Program

    • Addressing Modes

    • Program Structure

    • CPU Memory Types and Ranges

    • Guidelines

Tài liệu cùng người dùng

Tài liệu liên quan