Notes: Siemens

Revision: 4.10

Download this page along with the Memory Usage and Wiring Diagrams as a Microsoft Word file "Notes.doc" for best printing.  This file is included on the disks that come with the MSP and with all driver downloads.

  1. What is an MSP Driver? An MSP driver is a small ladder logic program that is added to the user program. All code is standard ladder logic. In Siemens S7-Micro PLCs it requires a few lines of logic in the main program to setup a time interrupt and the interrupt subroutine. The driver interrupt is the complete driver but in some versions it may be divided in to subroutines built form jump to label instructions.

  2. The user can import the driver into their program or they can start with our driver and build their program from it.

  3. Drivers. The following is a list of drivers in the libraries for Siemens S7-Micro PLCs. These drivers were prepared with Siemens S7-Micro/Win 32 version 2.1 programming software. The single channel input and single channel output drivers are available on the Driver Installation disks. All other drivers are available on our web site. They contain rung comments and address symbols that are viewable in the programming package and on printouts.

  4. DRIVER

    DESCRIPTION

    Msp_I

    1 Channel Input

    Msp_I_M

    2 Channel Input Multiplexed

    Msp_I_H

    1 Channel Input High-Speed Counter

    Msp_O

    1 Channel Output

    Msp_O_M

    2 Channel Output Multiplexed

    Msp_IO

    1 Channel Input, 1 Channel Output

    Msp_IO_M

    2 Channel Input Multiplexed,
    2 Channel Output Multiplexed

  5. Timing Parameters. These drivers are set up for the Delta protocol. Following are some of the key timing parameters:

  6. Input

    Protocol

    Delta

    Scan Time

    10 msec

    Full Word Bits

    16 Bits

    Delta Bits

    4 Bits

    Delta Refresh Count

    16 Scan Refresh

    ID Pulse Width

    1.2 Scans

    Data Pulse Width

    3 Scans

    Output

    Protocol

    Delta

    Scan Time

    10 msec

    Full Word Bits

    16 Bits

    Delta Bits

    4 Bits

    Delta Refresh Count

    16 Scan Refresh

    ID Pulse Width

    3 Scans

    Data Pulse Width

    3 Scans

  7. Quality Control File. Included with the files for each driver is a file of the same name with the ".sp" extension. This file contains the model and serial numbers of all hardware and software used for testing. This file also contains the setup parameters used for testing.

  8. Scan Time. The key to getting the driver to function properly is to get the I/O updated and code executed at constant time intervals.

  9. The S7-Micro executes the driver code in a time interrupt subroutine. Interrupt 0 is set to Time Interrupt 0 by setting Interrupt 0 to Event Number 10. For Time Interrupt 0 the interrupt interval is contained in SMB34. SMB34 is a single byte that can contain a value between 5 to 255 msec. Interrupt processing must be enabled with the ENI instruction.

    The driver program begins at INT 0. Inputs are updated at the beginning of the time interrupt subroutine with immediate contacts. Outputs are set at the end with immediate output coils. Input filtering for the inputs used by the MSP should be set for the minimum value possible value to allow rapid updates. The minimum filter value of 0.2 msec is also the default setting.

  10. Timing Parameters Exceptions. The drivers MSP_IO_M for the S7-Micro are the one exception to the previous timing parameters. Their scan time is 20 msec. This driver is the largest of the set and on occasion takes more than 10 msec to execute. To insure reliable operation the scan time has been incased. Note that this driver effectively has 4 channels. For any of the multiplexed drivers that are expanded to 4 or more channels the scan time should be increased.

  11. Programming S7-Micro. Programming of the single channel drivers for the S7-Micro processor are reasonably clean and understandable. Normal subroutine calls cannot be contained in an interrupt subroutine. For the multiplexed drivers subroutines are built from Jump To Label instructions. This trick makes multiplexed drivers somewhat more difficult. The ladder logic has been refined and optimized to a very high degree. In someways this may make the driver programs harder to read but it is felt that efficient use of memory and execution time are the most important factors.

  12. Programming Methods. One of the key programming methods is the use memory locations that are accessed both as registers and bits. We used the V memory for this purpose. In several cases counters are programmed by using a shift register. A seed is planted in bit zero of the shift register word. To increment the counter by one the shift resistor is shifted one bit. This allows the current value of counter to be checked by testing a single bit in ladder, which is much more efficient than a whole register compare. These programs have been extremely optimized for both minimum scan time and memory usage.

  13. High Speed Counter (HSC). The HSC driver uses less ladder logic memory. Depending on the value transmitted it may be faster or much slower than the Delta protocol. Unlike the Delta protocol the update time for the HSC protocol is not deterministic.

  14. The HSC driver uses hardware single-phase up/down counters. The HSC driver uses Mode 0 of either HSC1 or HSC2. On the models 214, 215, and 216 two (2) input channels are possible. The HSC driver will not work on the 212 models. The 212 models contain only the software counter HSC0 and do not contain hardware counters HSC1 or HSC2. On the 214 models the maximum frequency is 7 kHz each. On the 215 and 216 models the maximum frequency is 10 kHz each. See the manuals for additional information on the HSC.

    The scan time on the MSP must be set greater than the maximum scan time of the PLC. We set the MSP to a scan of 10 msec for test purposes. This allows some room for the user to add their program.

    In order to send a value of zero (0) or negative values an offset is added to the pulse count before transmission. The driver then subtracts this offset after counting the received pulses. Note the subtraction that occurs in the second rung. The value of the offset varies depending on the MSP model and scale factor in order to keep the offset to a minimum. The following table shows the offset for the different ranges. The constant in the second rung must be changed to match the configuration of the MSP.

    MSP MODEL

    SCALE FACTOR

    OFFSET

    MSP-RTD

    X1

    50

    MSP-RTD

    X10

    500

    MSP-TC

    X1

    50

    MSP-TC

    X10

    500

    All other models

    1

 


SensorPulse Corp. • P.O. Box 8886 • Michigan City, IN 46361 • Ph: (800) 447-5900 or (219) 393-7218 • Fax: (219) 393-7318

© 1998-2002 SensorPulse Corp., All Rights Reserved.
Updated July 2003