


  +--------------------------------------------------------------------------+
                                                                            
                                                                            
                                   IM 308-C                                 
                                                                            
  --------------------------------------------------------------------------
                                                                            
                                                                            
                            Demo program for the                            
                         standard function blocks                           
                                                                            
                      SIMATIC S5 <===> IM 308-C link                        
                                                                            
                                                                            
  +--------------------------------------------------------------------------+



  Issue: 7.96

  Doc. No.: R624-382938-5-T023




  Contents
  ========

  1       General  .....................................................  2

  2       Device configuration .........................................  3

  3       Input/output assignments .....................................  4

  4       Marker area assignment .......................................  6

  5       Data area assignment .........................................  6

  6       Block allocation .............................................  7

  7       Switch-on and power-up .......................................  7

  8       Cyclic operation .............................................  7
  8.1     Direct parameterization ......................................  8
  8.2     Indirect parameterization .................................... 10






                                 -- Page 2 --



  1       General
  ===============

  The demo program described below is on the floppy disk you received and
  can be loaded in its entirety into the memory of the programmable controller (PLC)
  for the purposes of testing the IM 308-C. It shows how the function block
  FB 192 (IM308C) can be used. Direct and indirect parameterization of the
  FB 192 are illustrated in the demo program. All the blocks required for an
  executable program are available. The floppy disk also places a fully featured
  programm framework at the disposal of the user.
                         
  Direct or indirect parameterization of function block FB 192 (IM308C) is selected
  at a digital input of the simulator. Other digital inputs provide the means of
  triggering specific functions. Errors, if any occur, are indicated at the
  digital outputs.

  The demo program allows you to select the function of your choice for indirect
  parameterization of function block FB 192 (IM308C). The function default settings
  of direct parameterization are listed below:


  +--------------------------------------------------------------------------+
  FCT Meaning                 IM number, station number, global control   
                                                                          
  ---+------------------------+---------------------------------------------
  WO  Write Outputs           IMST = KY 0,1 (IM No. = 0, Station No. = 1) 
                                                                          
  ---+------------------------+---------------------------------------------
  RO  Read Outputs            IMST = KY 0,1 (IM No. = 0, Station No. = 1) 
                                                                          
  ---+------------------------+---------------------------------------------
  RI  Read Inputs             IMST = KY 0,1 (IM No. = 0, Station No. = 1) 
                                                                          
  ---+------------------------+---------------------------------------------
  MD  Read Master Diagnostics IMST = KY 0,0 (IM No. = 0)                  
  ---+------------------------+---------------------------------------------
  SD  Read Slave Diagnostics  IMST = KY 0,1 (IM No. = 0, Station No. = 1) 
  ---+------------------------+---------------------------------------------
  GC  Global Control Command  IMST = KY 0,0 (IM No. = 0)                  
      FREEZE                  GCGR = KM 0000 1000 0000 0001               
  ---+------------------------+---------------------------------------------
  GC  Global Control Command  IMST = KY 0,0 (IM No. = 0)                  
      UNFREEZE                GCGR = KM 0000 0100 0000 0001               
  ---+------------------------+---------------------------------------------
  GC  Global Control Command  IMST = KY 0,0 (IM No. = 0)                  
      SYNC                    GCGR = KM 0010 0000 0000 0001               
  ---+------------------------+---------------------------------------------
  GC  Global Control Command  IMST = KY 0,0 (IM No. = 0)                  
      UNSYNC                  GCGR = KM 0001 0000 0000 0001               
  +--------------------------------------------------------------------------+






                                 -- Page 3 --



  2       Device configuration
  ============================

  The device you can use to run the demo program for the IM 308-C are
  as follows:

      *   AG S5-115U, AG S5-135U or AG S5-155U programmable controllers (PLC)
      *   730/740/750/770 programming unit (PG)
      *   IM 308-C ET 200 master interface (address: F800)
      *   slave (station number = 1)
      *   digital input module (e.g. 6ES5 430-4UA12)
      *   digital output module (e.g. 6ES5 451-4UA12)
      *   digital input/output simulator (e.g. 6ES5 788-0LA12)


  Settings
  --------


  Enter 1 as the station number for the slave connected to the IM 308-C.
  The IM number of the IM 308-C is 0. The start address of the 
  IM 308-C ist F800h.






                                 -- Page 4 --



  3       Input/output assignments
  ================================

  The program is set up in such a way that it can be easily customized to suit
  diverse input/output assignments. Note that the demo program works exclusively
  with markers. These markers are assignments to the inputs and outputs used in
  organizational block OB 1. In the demo program the I/Os are the word
  IW 4, the input byte IB6, the output word QW 8 and the output byte QB 10.


  +-------------------------------------------------------------------------+
  Imput  Input   Puls    direct                      indirect         
         image   Marker  parameterization            Parameterization 
  -------+---------+--------+----------------------------+-----------------
   I 4.0  F  4.0   F 12.0 WO Write Output             -                
   I 4.1  F  4.1   F 12.1 RO Read Outputs             -                
   I 4.2  F  4.2   F 12.2 RI Read Inputs              -                
   I 4.3  F  4.3   F 12.3 MD Read Master Diagnostics  -                
   I 4.4  F  4.4   F 12.4 SD Read Slave Diagnostics   -                
   I 4.5  F  4.5   F 12.5 WS Write Slave Channel      -                
   I 4.6  F  4.6   F 12.6 RS Read Slace Channel       -                
   I 4.7  F  4.7   F 12.7 GC Global Control Command                    
                          FREEZE (Group_Select = 1)   -                
  -------+---------+--------+----------------------------+-----------------
   I 5.0  F  5.0   F 13.0 GC Global Control Command                    
                          UNFREEZE (Group_Select = 1) -                
   I 5.1  F  5.1   F 13.1 GC Global Control Command                    
                          SYNC (Group_Select = 1) -                    
   I 5.2  F  5.2   F 13.2 GC Global Control Command                    
                          UNSYNC (Group_Select = 1)   -                
   I 5.3  F  5.3   F 13.3 -                           -                
   I 5.4  F  5.4   F 13.4 -                           -                
   I 5.5  F  5.5   F 13.5 -                           -                
   I 5.6  F  5.6   F 13.6 -                           -                
   I 5.7  F  5.7   F 13.7 -                           -                
  -------+---------+--------+----------------------------+-----------------
   I 6.0  F  6.0   F 14.0 Acknowledge error           Acknowledge error
   I 6.1  F  6.1   F 14.1 -                           -                
   I 6.2  F  6.2   F 14.2 -                           FB 192 call      
   I 6.3  F  6.3   F 14.3 => "0" direct parameter     => "1" indirect  
   I 6.4  F  6.4   F 14.4 -                           -                
   I 6.5  F  6.5   F 14.5 -                           -                
   I 6.6  F  6.6   F 14.6 -                           -                
   I 6.7  F  6.7   F 14.7 -                           -                
  +-------------------------------------------------------------------------+






                                 -- Page 5 --



  +-------------------------------------------------------------------------+
  Output  Output   Meaning                                               
          image                                                           
  --------+---------+------------------------------------------------------
   Q  8.0  F 16.0  Error in: WO Write Outputs                            
   Q  8.1  F 16.1  Error in: RO Read Outputs                             
   Q  8.2  F 16.2  Error in: RI Read Inputs                              
   Q  8.3  F 16.3  Error in: MD Read Master Diagnostics                  
   Q  8.4  F 16.4  Error in: SD Read Slave Diagnostics                   
   Q  8.5  F 16.5  Error in: WS Write Slave Channel                      
   Q  8.6  F 16.6  Error in: RS Read Slave Channel                       
   Q  8.7  F 16.7  Error in: GC Global Command                           
  --------+---------+------------------------------------------------------
   Q  9.0  F 17.0  Bit 0 of the ERR parameter                            
   Q  9.1  F 17.1  Bit 1 of the ERR parameter                            
   Q  9.2  F 17.2  Bit 2 of the ERR paraneter                            
   Q  9.3  F 17.3  Bit 3 of the ERR parameter                            
   Q  9.4  F 17.4  Bit 4 of the ERR parameter                            
   Q  9.5  F 17.5  Bit 5 of the ERR parameter (error in configuration)   
   Q  9.6  F 17.6  Bit 6 of the ERR parameter (retry call)               
   Q  9.7  F 17.7  Bit 7 of the ERR parameter (group erroe bit)          
  ---------+---------+------------------------------------------------------
   Q 10.0  F 18.0  Error in: XX switchover to indirect parameterization  
   Q 10.1  F 18.1  -                                                     
   Q 10.2  F 18.2  -                                                     
   Q 10.3  F 18.3  -                                                     
   Q 10.4  F 18.4  -                                                     
   Q 10.5  F 18.5  -                                                     
   Q 10.6  F 18.6  -                                                     
   Q 10.7  F 18.7  -                                                     
  +-------------------------------------------------------------------------+






                                 -- Page 6 --



  4       Marker area assignment
  ==============================

  FW 4    Marker for input word IW 4
  FY 6    Marker for input byte IB 6
  FW 8    Edge marker for input word IW 4
  FY 10   Edge marker for input byte IB 6
  FW 12   Pulse marker for input word IW 4
  FY 14   Pulse marker for input byte IB 6
  FW 16   Marker for output word QW 8
  FY 18   Marker for output byte QB 6

  FW 20   ERR parameter of the functon block call




  5       Data area assignment
  ============================

  DB 10   Output bytes            (FCT = WO)
  DB 11   Output bytes            (FCT = RO)
  DB 12   Input bytes             (FCT = RI)
  DB 13   Master diagnostic data  (FCT = MD)
  DB 14   Slave diagnotic data    (FCT = SD)
  DB 15   Slave channel data      (FCT = WS)
  DB 16   Slave channel data      (FCT = RS)


  DB 192  Parameter data block for indirect parameterization:
  
  +-----------------------------+
   DW     Para-  Recommended 
          meter  data format 
  +-------+-------+-------------
   DW 1   DPAD   KH          
   DW 2   IMST   KY          
   DW 3   FCT    KC          
   DW 4   GCGR   KM          
   DW 5   TYP    KY          
   DW 6   STAD   KF          
   DW 7   LENG   KF          
   DW 8   ERR    KY          
  +-----------------------------+






                                 -- Page 7 --



  6       Block allocation
  ========================

  FB 92   Example for direct parameterization with FB 192 (IM308C)
  FB 93   Example for indirect parameterization with FB 192 (IM308C)
  FB 192  Standard function block IM308C

  OB 1    Cyclic program




  7       Switch-on and power -up
  ===============================

  After resetting the programmable controller, load the entire file into the application
  memory of the CPU and reboot. If all the simulator inputs are set to "0" when the
  programmable controller reboots, no outputs should be set when the
  programmable controller has powered up. If output Q 9.7 (group error bit) is set,
  an error has occured during power-up. Read the ERR parameter (FW 20) of the 
  FB 192 (IM308C) to ascertain the precise cause off the error. The low byte of
  the ERR parameter (error number) is output in QB 9.




  8       Cyclic operation
  ========================

  Input I 6.3 enables you to toggle between direct and indirect parameterization
  of FB 192 (IM308C). If the signal state of input I 6.3 is "0", FB 92 ist
  invoked for direkt parameterization. If the signal of input I 6.3 is "1", the
  FB 93 is processed for indirect parameterization. Select direct parameterization
  (I 6.3 = "0") for the first test, because in this mode the commands can be issued
  by means of the switches on the simualtor.

  Direct parameterization

  In direct parameterization of the FB 192 function block, the target function ist
  specified in the KC format in the FCT parameter. A slave station is selected 
  in the IMST parameter. A global command (GC) is specified in the GCGR
  parameter. The functions programmed in function block FB 92 can be triggered
  by means of the switches of the simulator.





                                 -- Page 8 --



  Indirect parameterization

  In the case of indirect parameterization, the target function, the slave station
  and a global command are all defined as entries in the parameter data block.
  These entries must be written into DB 192 with the STEU VAR function of
  the programming unit. The rising edge of input I 6.2 triggers execution of the
  function entered in this way in the parameter data block.

  Error messages

  If an error occurs when standard function block FB 192 is called, group error
  output Q 9.7 is set. Read output byte QB 9 (error number) to ascertain the
  cause of the errror. Clear the error and reset the error indicator by means of
  input I 6.0. No further functions can be triggered until group error output Q 9.7
  has been resct.



  8.1     Direct parameterization
  -------------------------------


  WO Write Outputs (I 4.0)

  This function transfers outputs from DB 10 data blocks to slave station
  No. 1. Standard function block FB 192 is called with LENG = -1 (joker length).
  Following the call, then standard function block enters the number of bytes
  transferred in marker byte FY 20.

  RO Read Outputs (I 4.1)

  This function reads outputs from slave station No. 1 and writes the information to
  data block DB 11. Standard function block FB 192 ist called with
  LENG = -1 (joker length). Following the the call, the standard function block enters
  the number of bytes transferred in marker byte FY 20.

  RI Read Inputs (I 4.2)

  This function reads inputs from slave station No. 1 and writes the information to
  data block DB 12. Standard function block FB 192 called with
  LENG = -1 (joker length). Following the call, standard function block enters
  the number of bytes transferred in marker byte FY 20.





                                 -- Page 9 --



  MD Read Master Diagnostics (I 4.3)

  This function reads the master diagnostics of IM 0 (IMST = KY 0,1) and writes the
  information to data block DB 13. Standard function block FB 192 called with
  LENG = -1 (joker length). Following the call, standard funktion block enters
  the number of bytes transferred in marker byte FY 20.

  SD Read Slave Diagnostics (I 4.4)

  This function reads the slave diagnostics of slave station 1 and writes the
  information to data block DB 14. Standard function block FB 192 is called with
  LENG = -1 (joker length). Following the call, standard function block enters
  the number of bytes transferred in marker byte FY 20.

  WS Write Slave Channel (I 4.5)

  This function transfers the data of the slave channel from data block DB 15 to
  slave station 1. Standard function block FB 192 ist called with
  LENG = -1 (joker length). Following the call, the standrad function block enters
  the number of bytes transferred in marker byte FY 20.

  RS Read Slave Channel (I 4.6)

  The function reads the slave channel of slave station 1. Standard function block
  FB 192 is called with LENG = -1 (joker length). Following the call, the standard
  function block enters the number of bytes transferred in marker byte FY 20.

  GC Global Commands (I 4.7, I 5.0, I 5.1, I 5.2)

  These functions execute certain global commands. The command executed
  depends on the input: FREEZE (I 4.7), UNFREEZE )I 5.0), SYNC (I 5.1) and
  UNSYNC )I 5.2). In each case, the global command is executed for
  Group_Select = KM 0000 0001.





                                 -- Page 10 --



  8.2     Indirect parameterization
  ---------------------------------

  To select indirect parameterization for the FB 192 function block, set input
  I 6.3 to signal state "1". In the demo program, the function block itself is invoked
  by the rising edge at input I 6.2. If parameterization is indirect (FCT = XX), the
  FB 192 standard function block takes the module parameters from the parameter
  data block. Note that the parameter data block must be opened with the A DB
  command before the function block is called. In the demo program the DB 192 is
  the parameter data block. Use the STEU VAR function of the programming unit
  to make the appropiate entries in the parameter data block for the purposes 
  of the demo program.






  Copyright 1996 by Siemens Aktiengesellschaft, Berlin and Munich

