Page 1
______________ Preface SIMATIC S7-300 SIMATIC S7-300 SM331;AI 8x12 Bit Getting Started Part 2: Voltage and PT100 ______________ Prerequisites ______________ Task SIMATIC Mechanical setup of the ______________ example station S7-300 SM331;AI 8x12 Bit Getting Started ______________ Electric connection Part 2: Voltage and PT100...
Page 2
Trademarks All names identified by ® are registered trademarks of the Siemens AG. The remaining trademarks in this publication may be trademarks whose use by third parties for their own purposes could violate the rights of the owner.
Table of contents Preface ..............................1-1 General information ........................1-1 Prerequisites............................2-1 Basics............................2-1 Task................................ 3-1 Example of an application......................3-1 Mechanical setup of the example station ....................4-1 Assembling the example station ....................4-1 Mounting of the analog module....................4-3 4.2.1 General information ........................
Page 4
Table of contents STEP 7 user program ......................6-17 6.3.1 Tasks of the user program ....................... 6-17 6.3.2 Creating a user program ......................6-18 Testing the user program........................7-1 Downloading the system data and user program ..............7-1 Visualizing the sensor values..................... 7-3 Analog value representation ......................
Preface General information Purpose of the Getting Started manual The Getting Started guide gives you a complete overview of the commissioning of analog module SM331. It supports you when installing and parameterizing the hardware of a voltage measuring transducer and a PT100 resistance thermometer. In addition, you will receive an introduction for configuring the analog module with the SIMATIC S7 manager.
Page 6
Preface 1.1 General information SM331;AI 8x12 Bit Getting Started Part 2: Voltage and PT100 Getting Started, 11/2006, A5E00264161-02...
Prerequisites Basics Basic knowledge No special knowledge of the field of automation technology is required in order to understand the Getting Started guide. As the configuration of the analog module is done with the STEP7 software, proficiency in STEP7 would be advantageous. Further information on STEP7 can be found in the electronic manuals that are supplied with STEP7.
Page 8
6ES7307-1EA00-0AA0 (incl. power supply jumper) CPU 315-2 DP 6ES7315-2AG10-0AB0 MICRO MEMORY CARD, NFLASH, 128KBYTES 6ES7953-8LG00-0AA0 SIMATIC S7-300, MOUNTING RAIL L=530MM 6ES7390-1AF30-0AA0 Programming device (PD) with MPI interface and MPI cable depending on the configuration PC with suitable interface card If you would like to carry out the example station using SIMATIC TOP connect, you will need...
Page 9
Prerequisites 2.1 Basics Note "Getting Started" only describes the handling of PT100 standard voltage measuring transducers and resistance thermometers. If you wish to use other transducers, you will need to wire and configure an SM331 differently. The following tools and materials will also be needed: General tools and materials Quantity Item...
Page 10
Prerequisites 2.1 Basics SM331;AI 8x12 Bit Getting Started Part 2: Voltage and PT100 Getting Started, 11/2006, A5E00264161-02...
Task Example of an application Overview The Getting Started manual leads you all the way through an example application during which you will connect the following four sensors: ● A pressure sensor, which is connected to a voltage measuring transducer (±5V). ●...
Page 12
Task 3.1 Example of an application In the following sections you will be introduced to: ● Mechanical setup of the example station – General mounting instructions for S7-300 modules – Configuration of the SM331 for the two selected measurement transducer types ●...
Prerequisites Before you can use analog input module SM331, you need a basic setup of general SIMATIC S7-300 components. The order of the assembly takes place from left to right: ● Power supply PS307 ●...
Page 14
Mechanical setup of the example station 4.1 Assembling the example station Instructions (without SM331) Step Graphic Description Screw on the mounting rail (screw size: M6) so that at least 40 mm space remains above and below the rail. When mounting it on a grounded metallic panel or on a grounded device mounting panel made of steel sheet, make sure you have a low impedance connection between the mounting rail and the mounting surface.
Mechanical setup of the example station 4.2 Mounting of the analog module Step Graphic Description Connect the bus connector (delivered with the SM331) to the left connector on the back of the CPU Mounting the CPU: : Hang the CPU on to the top end of the rail •...
Mechanical setup of the example station 4.2 Mounting of the analog module 4.2.2 Components of the SM331 with conventional connecting plug Overview A functional analog module consists of the following components: ● Module SM331 (in our example 6ES7331-7KF02-0AB0) ● 20-pin front connector There are two different types of front connectors: –...
Mechanical setup of the example station 4.2 Mounting of the analog module 4.2.3 SM331 with the SIMATIC TOP connect system cabling Overview The SIMATIC TOP connect system cables for the SM331 module consist of the following components ● Front connector module (order number 6ES7921-3AF00-0AA0) ●...
Mechanical setup of the example station 4.2 Mounting of the analog module 4.2.4 Features of the analog module Features The module is a universal analog module that can be used with the most commonly used applications. The desired measuring mode should be set up directly on the module with the measuring range modules.
Mechanical setup of the example station 4.2 Mounting of the analog module 4.2.5 Measuring range modules Connection Module SM331 has 4 measuring range modules (one measuring range module per channel group). You can plug each measuring range module into 4 different positions (A, B, C, or D). The position enables you to specify the transducer to be connected to the respective channel group.
Page 20
Mechanical setup of the example station 4.2 Mounting of the analog module In our example task, a sensor with a ±5V voltage measuring transducer is connected to channel group CH0,1 at input 0. For connecting the three type PT100 resistance thermometers, you need a complete channel group (CH2,3/CH4,5/CH6,7) for each PT100.
Mechanical setup of the example station 4.2 Mounting of the analog module 4.2.6 Mounting the SM331 module Mounting the SM331 After you have prepared the analog module accordingly, mount it to the rail as well. Mounting the SM331 module Step Graphic Description Mounting the SM331:...
Mechanical setup of the example station 4.2 Mounting of the analog module 4.2.7 Mounting the TOP connect terminal block Procedure The TOP connect system cables need a system-specific terminal block. Step Graphic Description Connect the terminal block to the shielded support element.
Electric connection Wiring the power supply and the CPU Overview Warning You might get an electrical shock if power supply module PS307 is turned on or the power cord is connected to the main power supply. Always switch off power before you start wiring the S7-300. Figure 5-1 Wiring the power supply and the CPU SM331;AI 8x12 Bit Getting Started Part 2: Voltage and PT100...
Page 24
Electric connection 5.1 Wiring the power supply and the CPU The example station requires a power supply. The wiring is done as follows: Wiring the power supply and the CPU Step Graphic Description Open the front panel covers of the power supply module and CPU.
Electric connection 5.2 Wiring of the analog module Wiring of the analog module 5.2.1 Shielded lines for analog signals General information The wiring of analog module SM331 is independent of the type of the analog measuring transducer. Cables You should use shielded and twisted-pair lines for analog signals. This reduces the effect of interference.
Electric connection 5.2 Wiring of the analog module 5.2.3 Wiring principle of the resistance thermometer (PT100) Options There are three options for wiring the resistance thermometer: ● Four-wire connection ● Three-wire connection ● Two-wire connection For a 4-wire and 3-wire connection, the module provides a constant current via terminals Ic+ and Ic-, which compensates for the voltage drop of the measuring lines.
Page 27
Electric connection 5.2 Wiring of the analog module 3-Wire Connection of a Resistance Thermometer For a 3-wire connection, you must generally place a jumper between M- and Ic-. When connecting, ensure that connected lines Ic+ and M+ are connected directly to the resistance thermometer.
Electric connection 5.2 Wiring of the analog module 5.2.4 Connecting the analog module in the conventional manner General information This section encompasses the wiring of the analog modules to individual lines in the conventional manner. The type of connection using TOP connect system cables can be found in the corresponding section.
Page 29
Electric connection 5.2 Wiring of the analog module Procedure The required wiring tasks are explained below step-by-step: SM331 Front connector wiring Step Graphic wiring Comments Open the front door of the SM331 The terminals are printed on the front door Remove 6 mm of the insulation from the ends of the wires that go into the front connector.
Electric connection 5.2 Wiring of the analog module 5.2.5 Wiring the connection terminals Overview In our example, a terminal strip replaces the connections of the voltage sensor or of the resistance thermometer. The voltages are specified using a calibration device; the resistance thermometer is simulated by a potentiometer.
Page 31
Electric connection 5.2 Wiring of the analog module PT100 resistance thermometers If you want to connect a PT100, then you must also wire the terminals to the resistance thermometers as explained in the corresponding section. In our example station, a terminal strip replaces the terminals of the resistance thermometer. The desired resistance value is set using a potentiometer.
Electric connection 5.2 Wiring of the analog module 5.2.6 Wiring the analog module using the system cables of TOP connect Overview Using the SIMATIC TOP connect system cables, route the sensor-specific wiring from the analog module to the TOP connect terminal block. Figure 5-9 TOP connect connection Terminal block 1...
Page 33
Electric connection 5.2 Wiring of the analog module The following table describes the individual tasks of the wiring for the connection to terminal block 1 step-by-step. The connection of terminal block 2 is done in the same manner. SM331 Front connector wiring Step Graphic wiring...
Page 34
Electric connection 5.2 Wiring of the analog module Wiring the SM331 TOP connect terminals Step Graphic wiring Comments Terminal block 1 and 2: For a requirement of up to 4A of current, the power supply of the module Terminal Y: Power supply of the module can be routed across the terminal blocks.
Electric connection 5.2 Wiring of the analog module Note If you need electrical isolation between the CPU and the analog module, you must supply the analog module with a separate power supply. 5.2.7 Wiring of a PT100 wiring The figure clarifies the connection of a PT100 with a 4-wire connection. The cables are wired together inside the PT100 itself.
Electric connection 5.2 Wiring of the analog module 5.2.8 Checking the wiring Procedure If you want to test your wiring, switch the power supply on. Do not forget to set the CPU to STOP (see the red circle). Figure 5-11 Successful wiring, CPU in STOP position If a red LED is lit, an error has occurred in the wiring.
Configuration of the SIMATIC Manager Creating a new STEP 7 project 6.1.1 Create a new project "New Project..." wizard Use SIMATIC Manager STEP7 V5.2 or later for configuring the new CPU 315-2 DP. Start the SIMATIC Manager by clicking the "SIMATIC Manager" icon on your Windows Desktop and create a new project with the "New Project"...
Page 38
Configuration of the SIMATIC Manager 6.1 Creating a new STEP 7 project A project wizard introduction window will appear. The wizard guides you through the procedure for creating a project. Figure 6-2 "New Project" wizard, start The following must be specified during the creation procedure: ●...
Configuration of the SIMATIC Manager 6.1 Creating a new STEP 7 project 6.1.2 CPU selection Procedure Choose CPU 315-2DP for the example project. (You can also use our example for a different CPU. Then select the corresponding CPU.) Figure 6-3 "New Project"...
Configuration of the SIMATIC Manager 6.1 Creating a new STEP 7 project 6.1.3 Defining the basic user program Procedure Choose the configuring language STL and select the following organization blocks (OBs): ● OB1 cyclically executed block ● OB40 hardware interrupt ●...
Configuration of the SIMATIC Manager 6.1 Creating a new STEP 7 project 6.1.4 Assigning the project name Procedure Select the “Project name” text box and overwrite the existing name in it with "Getting Started S7 SM331". Figure 6-5 "New Project" wizard: Naming the project name Click "Finish".
Configuration of the SIMATIC Manager 6.1 Creating a new STEP 7 project 6.1.5 Result S7 project is created Result The wizard has created the "Getting Started S7-SM331" project. You can see the inserted organization blocks in the right window. Figure 6-6 "New Project"...
Configuration of the SIMATIC Manager 6.2 Configuring the hardware configuration Configuring the hardware configuration 6.2.1 Creating the hardware configuration Requirement The STEP 7 wizard has created a basic S7 project. You also need complete hardware configuration in order to create the system data for the CPU. Procedure You can create the hardware configuration of the example station with SIMATIC Manager.
Configuration of the SIMATIC Manager 6.2 Configuring the hardware configuration 6.2.2 Adding SIMATIC components Procedure First select a power supply module from the hardware catalog. If the hardware catalog is not visible, open it with the shortcut key combination Ctrl+K or by clicking the catalog icon (blue arrow).
Page 45
Configuration of the SIMATIC Manager 6.2 Configuring the hardware configuration Inserting an analog module There are many SM331 analog modules. For this project we use an SM331, AI8x12 bit with order number 6ES7 331-7KF02-0AB0. The order number is displayed at the bottom of the hardware catalog (see blue arrow). In the right window, click on the SM331 AI8x12Bit and drag it to the first free field in slot 4 (see red arrow) in the configuration table.
Configuration of the SIMATIC Manager 6.2 Configuring the hardware configuration 6.2.3 Configuring the analog module Overview The SIMATIC Manager inserts the analog module with the default settings. You can now modify the parameters to change the sensor types, diagnostics, and interrupt capabilities. Functionalities of the example station The table shows which parameters have to be set for our example station.
Page 47
Configuration of the SIMATIC Manager 6.2 Configuring the hardware configuration Calling up the configuration Double-click on slot 4 that has the SM331 in it. Select the "Inputs" tab. Configure the following functions: ● Diagnostic interrupt enabled ● Hardware interrupt enabled ●...
Page 48
Configuration of the SIMATIC Manager 6.2 Configuring the hardware configuration Explanation of the settings of the SM331 Diagnostic interrupt: If the diagnostic interrupt is enabled, diagnostic OB86 is called up when the ground or the power supply is missing. Hardware interrupt: If the parameter "Hardware interrupt when limit value exceeded"...
Configuration of the SIMATIC Manager 6.2 Configuring the hardware configuration 6.2.4 Power-up test Procedure For testing, do a power-up test and download the system data. Step Graphic Description Erase your Micro Memory Card with a Power PG or a PC with external programming device: In SIMATIC Manager, select "File ->...
Page 50
Configuration of the SIMATIC Manager 6.2 Configuring the hardware configuration Downloading hardware configuration Load the hardware configuration into the CPU with HW Config. Figure 6-11 Download the CPU hardware configuration (1) SM331;AI 8x12 Bit Getting Started Part 2: Voltage and PT100 6-14 Getting Started, 11/2006, A5E00264161-02...
Page 51
Configuration of the SIMATIC Manager 6.2 Configuring the hardware configuration Click the "Load to module" icon (see the red circle). When the dialog window "Select target module" appears, click OK (see the red arrow). Figure 6-12 Download the CPU hardware configuration (2) The dialog window "Select target address"...
Page 52
Configuration of the SIMATIC Manager 6.2 Configuring the hardware configuration Starting the CPU Switch the CPU to RUN. If you have performed the hardware configuration correctly, two green LEDs (RUN and DC5V) should be lit on the CPU. Figure 6-13 CPU in error free state If the RUN LED does not light up, there is an error.
Configuration of the SIMATIC Manager 6.3 STEP 7 user program STEP 7 user program 6.3.1 Tasks of the user program Overview The example user program ● stores sensor values in a data block and ● saves the status information regarding the hardware interrupts in a marker word. The status information is acknowledged by means of a bit.
Configuration of the SIMATIC Manager 6.3 STEP 7 user program 6.3.2 Creating a user program Procedure There are two ways to create a user program. ● If you know how to program STEP7 STL, then you can create and program the necessary blocks and functions in the blocks folder.
Page 55
Configuration of the SIMATIC Manager 6.3 STEP 7 user program Importing a source file You can import the source file into SIMATIC Manager as follows: ● Right click the "Sources" folder. ● Select "Insert new Object > External Source...". Figure 6-14 Importing an external source SM331;AI 8x12 Bit Getting Started Part 2: Voltage and PT100 6-19...
Page 56
Configuration of the SIMATIC Manager 6.3 STEP 7 user program In the "Insert external source" dialog, browse for the source file, which you have already downloaded and saved on your hard disk. Select source file GSSM331T2DE.AWL (see red arrow). Figure 6-15 Importing an external source SM331;AI 8x12 Bit Getting Started Part 2: Voltage and PT100 6-20...
Page 57
Configuration of the SIMATIC Manager 6.3 STEP 7 user program Click "Open". SIMATIC Manager has read the source file. In the right window you can see the source file inserted. Figure 6-16 Storing the source file SM331;AI 8x12 Bit Getting Started Part 2: Voltage and PT100 6-21 Getting Started, 11/2006, A5E00264161-02...
Page 58
Configuration of the SIMATIC Manager 6.3 STEP 7 user program Compiling the source code In order to create an executable STEP7 program, you must compile the STL source file. Double-click on the source file in the source folder (see red arrow). The source code editor will be called up.
Page 59
Configuration of the SIMATIC Manager 6.3 STEP 7 user program After the source code is loaded, start the compilation. Press shortcut key combination Ctrl+K or select "File > Compile". The compilation will start immediately. Figure 6-18 Compiling STL source files SM331;AI 8x12 Bit Getting Started Part 2: Voltage and PT100 6-23 Getting Started, 11/2006, A5E00264161-02...
Page 60
Configuration of the SIMATIC Manager 6.3 STEP 7 user program In the event of warning or error messages, check the source. Figure 6-19 Source code editor, messages after compilation SM331;AI 8x12 Bit Getting Started Part 2: Voltage and PT100 6-24 Getting Started, 11/2006, A5E00264161-02...
Page 61
Configuration of the SIMATIC Manager 6.3 STEP 7 user program Close the source editor. After compiling the STL source without errors, the following blocks should appear in the block folder: OB1, OB40, OB82, FC1, DB1, and DB2 Figure 6-20 Generated blocks See also Source code of the user program (Page A-1) SM331;AI 8x12 Bit Getting Started Part 2: Voltage and PT100...
Page 62
Configuration of the SIMATIC Manager 6.3 STEP 7 user program SM331;AI 8x12 Bit Getting Started Part 2: Voltage and PT100 6-26 Getting Started, 11/2006, A5E00264161-02...
Testing the user program Downloading the system data and user program Procedure The hardware and software are now ready. The next step is to download the system data and the user program into the automation system. To do this, proceed as follows: Downloading the system data and user program Step Graphic...
Page 64
Testing the user program 7.1 Downloading the system data and user program Smart Label The labeling strips for the modules were created with Siemens S7 Smart Label (order no: 2XV9 450-1SL01-0YX0). A labeling strip in its actual size: Figure 7-1 S7-SmartLabel labeling strip for the example SM331;AI 8x12 Bit Getting Started Part 2: Voltage and PT100...
Testing the user program 7.2 Visualizing the sensor values Visualizing the sensor values Procedure In order to visualize the sensor values, insert a variable table as follows into the project. To do this, select from the context menu of the blocks folder: Insert new object >...
Page 66
Testing the user program 7.2 Visualizing the sensor values Complete the newly created variable table as follows: : Figure 7-2 Variable table Control_Display In this area you can monitor the channel values. In this area you can monitor and control the status signals. In this area you can see the analog values.
Page 67
Testing the user program 7.2 Visualizing the sensor values Monitoring values In order to monitor values, open the online view of the controller by clicking the eye glasses icon. Now you can monitor the values in the data blocks and markers. Figure 7-3 Online view of the variable table SM331;AI 8x12 Bit Getting Started Part 2: Voltage and PT100...
Page 68
Testing the user program 7.2 Visualizing the sensor values Peculiarity in monitoring the values While monitoring the values you will surely notice that the channel values are different from the analog values. The reason for this is that the analog module only supports the "Word" binary format (16 bits).
Testing the user program 7.3 Analog value representation Analog value representation 7.3.1 Introduction Introduction Analog input modules convert the analog process signal into a digital format (16-bit word). If you want to display analog process values, you must convert the digital values of the module into decimal values.
Testing the user program 7.3 Analog value representation 7.3.3 Display of analog value of a ±10V voltage measuring transducer Analog value display in the ±10V voltage measuring range Analog value Voltage Area of application Remark representation measuring range Decimal Hexadecim 32767 7FFF 11.851V...
Testing the user program 7.3 Analog value representation 7.3.5 Analog value display of a standard PT100 Analog value display for a standard PT100 resistance thermometer Analog value Voltage Area of application Remark representation measuring range Decimal Hexadecim 32.767 7FFF > 1,000°C Overflow From the hex value 16#2711 on, the sensor value is above the overload range and is no longer valid.
Testing the user program 7.3 Analog value representation 7.3.6 Effect of the PT100 wiring on the analog value display Overview The PT 100 wiring significantly influences the measured value acquisition. The connecting cables from the SM331 module to the PT100 thermometer have a resistance that is independent of the conducting material, the length, and the cable cross-section.
Page 73
Testing the user program 7.3 Analog value representation Note The cable resistance does not rise along with the temperature. It remains constant. If you are measuring high temperatures, the inaccuracy is reduced by a percentage value. SM331;AI 8x12 Bit Getting Started Part 2: Voltage and PT100 Getting Started, 11/2006, A5E00264161-02...
Page 74
Testing the user program 7.3 Analog value representation SM331;AI 8x12 Bit Getting Started Part 2: Voltage and PT100 7-12 Getting Started, 11/2006, A5E00264161-02...
Diagnostic interrupt Initiating the diagnostic interrupt General information Diagnostic interrupts enable the user program to react to hardware errors. Modules must have diagnostic capabilities in order to also be able to generate diagnostic interrupts. In OB82, you program the reactions to diagnostic interrupts. Diagnostic interrupt Analog input module SM331 AI8x12bit has diagnostic capabilities.
Page 76
Diagnostic interrupt 8.1 Initiating the diagnostic interrupt The cause of the error can be determined "online" by requesting the hardware status. . In order to determine the state of module "online", proceed as follows: ● In the hardware configuration, click on the SM331 ●...
Diagnostic interrupt 8.2 General diagnostic message General diagnostic message Diagnostic interrupt tab On the Diagnostic Interrupt tab, you will find information about the reported error. Any interrupts that occur are not channel dependent and apply to the entire module. Figure 8-2 Diagnostics for SM331 SM331;AI 8x12 Bit Getting Started Part 2: Voltage and PT100 Getting Started, 11/2006, A5E00264161-02...
Diagnostic interrupt 8.3 Channel-linked diagnostic messages Channel-linked diagnostic messages 8.3.1 Types of diagnostic messages Channel-linked diagnostic messages There are five types of channel-linked diagnostic messages: ● Configuration / programming error ● Common mode error ● Wire break ● Underflow ● Overflow Note This only shows you the channel-linked diagnostics for measuring modes of 2 or 4-wire current transducers.
Diagnostic interrupt 8.3 Channel-linked diagnostic messages 8.3.4 Wire breakage (only for the PT100 measuring mode) Meaning If the measuring mode is set to voltage, there is no way to check a wire breakage. You also cannot select it in SIMATIC Manager. In PT100 measuring mode, a wire breakage is detected and reported.
Diagnostic interrupt 8.3 Channel-linked diagnostic messages 8.3.5 Underflow Meaning The two measuring modes, voltage and PT100, can initiate the diagnostic message "Analog input measuring range/lower limit value undershot". Voltage Figure 8-4 Left: Diagnostic display in the underflow range/Right: Variable table We have connected the 2 channels in parallel in order to retain the diagnostic capability of the channel group.
Diagnostic interrupt 8.3 Channel-linked diagnostic messages 8.3.6 Overflow Meaning In the two measuring modes, voltage and PT100, the diagnostic message "Analog input measuring range/upper limit value exceeded" can be initiated. "Voltage" measuring mode Figure 8-6 Left: Diagnostic message with overflow / Right: Variable table PT100 measuring mode Figure 8-7 Left: Diagnostic message with overflow / Right: Variable table...
Page 82
Diagnostic interrupt 8.3 Channel-linked diagnostic messages SM331;AI 8x12 Bit Getting Started Part 2: Voltage and PT100 Getting Started, 11/2006, A5E00264161-02...
Hardware interrupt Hardware interrupt Overview A special feature of the SM331 AI8x12bit is the capability to also trigger hardware interrupts. The two channels, 0 and 2, can be correspondingly configured. Defining the limit values for hardware interrupts: For the PT100 resistance thermometer, you must define the limit values in °C and not in °F or K.
Page 84
Hardware interrupt 9.1 Hardware interrupt OB40 hardware interrupt Hardware interrupts generally trigger alarm organization blocks in the CPU. In our example, OB40 is called up. In the STEP 7 program, OB40 is used for hardware interrupts. Depending on the CPU, several hardware interrupts can be configured.
Page 85
Hardware interrupt 9.1 Hardware interrupt Simulation of a hardware interrupt If you provide channel 0 with 4V using a calibration device, you will receive the binary value 0000 0001 0000 0000 in MW100. This means that OB40 was called up and the upper limit of >4V has been exceeded in channel 0.
Page 86
Hardware interrupt 9.1 Hardware interrupt SM331;AI 8x12 Bit Getting Started Part 2: Voltage and PT100 Getting Started, 11/2006, A5E00264161-02...
Appendix Source code of the user program Overview In this section, you can get a quick overview of the functions of the user program for the example station. A flowchart shows you the rough outline of the program structure. You will find the complete program in detail in the STL source code.
Page 88
Appendix A.1 Source code of the user program Variable description Variables Description DB1.DBW 0 Channel 0 Display of analog value DB1.DBW 2 Channel 1 Display of analog value DB1.DBW 4 Channel 2 Display of analog value DB1.DBW 6 Channel 3 Display of analog value DB1.DBW 8 Channel 4 Display of analog value DB1.DBW 10...
Page 89
Appendix A.1 Source code of the user program DATA_BLOCK DB 2 TITLE =process values VERSION : 0.1 STRUCT SE_1 : REAL ; //Voltage Transducer SE_2 : REAL ; //PT100 (4) SE_3 : REAL ; //PT100 (3) SE_4 : REAL ; //PT100 (2) END_STRUCT ;...
Page 90
Appendix A.1 Source code of the user program #Factor; #Offset; #MeasuredValue; NETWORK TITLE =Analog value display monitoring W#16#0; #Status; #RawValue; #OverFlow; >=I m_of; #RawValue; #OverRange; >=I m_or; #Raw# Value; UnderFlow; <=I m_uf; #RawValue; #UnderRange; <=I m_ur; end; m_of: L W#16#800; #Status;...
Page 91
Appendix A.1 Source code of the user program m_ur: L W#16#100; #Status; end; end: NOP END_FUNCTION ORGANIZATION_BLOCK OB 1 TITLE = "Main Program Sweep (Cycle)" VERSION : 0.1 VAR_TEMP OB1_EV_CLASS : BYTE ; //Bits 0-3 = 1 (Coming event), Bits 4-7 = 1 (Event class 1) OB1_SCAN_1 : BYTE ;...
Page 92
Appendix A.1 Source code of the user program PEW 264; DB1.DBW // Channel 5 -> Data block PEW 266; DB1.DBW // Channel 6 -> Data block PEW 268; DB1.DBW // Channel 7 -> Data block PEW 270; DB1.DBW NETWORK TITLE =Converting the analog value display -> measured value // Channel 1 : Voltage measuring transducer 1 to 5V CALL FC RawValue...
Page 93
Appendix A.1 Source code of the user program OverFlow := 10001, OverRange := 8501, UnderRange := -2001, UnderFlow := -2431, MeasuredValue := DB2.DBD Status := FW 30); // Channel 4 : PT 100 CALL FC RawValue := DB1.DBW Factor := 1.000000e-001, Offset := 0.000000e+000, OverFlow...
Page 94
Appendix A.1 Source code of the user program OB40_POINT_ADDR : DWORD ; //Interrupt status of the module OB40_DATE_TIME : DATE_AND_TIME ; //Date and time OB40 started END_VAR BEGIN NETWORK TITLE = #OB40_IO_FLAG; //OB40_IO_FLAG : 16#54 = input module 104; : 16#55 = output module #OB40_MDL_ADDR;...
Page 95
Appendix A.1 Source code of the user program OB82_BCKUP_BATT_FLT : BOOL; //Backup battery is in fault OB82_RESERVED_2 : BOOL; //Reserved for system OB82_RACK_FLT : BOOL; //Rack fault, only for bus interface module OB82_PROC_FLT : BOOL; //Processor fault OB82_EPROM_FLT : BOOL; //EPROM fault OB82_RAM_FLT : BOOL;...
Page 96
Appendix A.1 Source code of the user program SM331;AI 8x12 Bit Getting Started Part 2: Voltage and PT100 A-10 Getting Started, 11/2006, A5E00264161-02...
Index " "New Project..." wizard, 6-1 Calling up "Voltage" measuring mode, 8-7 Configuration, 6-11 Hardware configuration, 6-7 Check Mains voltage, 5-2 Checking, 6-13 Adding Common mode error, 8-4 SIMATIC components, 6-8 compile Adding SIMATIC components, 6-8 source code, 6-22 Analog module Complete Connecting, 5-6 Variable table, 7-4...
Page 98
Index Creating STEP 7 project, 6-1 Hardware and software User Program, 6-18 The hardware and software required for the analog module, 2-1 Hardware catalog Opening, 6-8 Defining Hardware configuration Defining the basic user program, 6-4 Calling up, 6-7 Defining the basic user program configuration, 6-7 Defining, 6-4 Load, 6-14...
Page 100
Index STEP 7 project Creating, 6-1 Values STEP 7 user program, 6-17 Monitor, 7-5 Tasks, 6-17 Variable table STL, 6-4 Complete, 7-4 STL source code, A-2 Visualize Structure Sensor values, 7-3 User Program, 6-17 Voltage, 8-6 System data and user program Voltage measurement, 5-8 Loading into the automation system, 7-1 Voltage measuring transducer...