Home > Libraries > ID 0044 > Detail
 
  Linear access to external eeprom
 
 
  Step7-MicroWin: [V4.0.3.08 (V4.0+SP3)]
  CPU:   [all CPU22x]
  Operating system:    --
  Other:   [Firmware >=2.0, Eeprom 64kB or 256kB]
Author:     Damir Krdzalic Homepage:    http://www.damir.com
Created:   18.04.2006 License:   Freeware
Update:   Price:  
Views:   153 Downloads:   59
 
This library enables the random access (read/write) to the external eeprom (within a predefined eprom area space).



The recipe wizard and data logger don`t support linear (variable independent) access,
larger variable types (>32Bit e.g. Strings) or large areas (e.g. backup whole V-Memory).
This library takes this limits away.
However, the S7-200 currently don`t support a file system for the external eeprom,
so this library offers only a virtual random access.


Read_ext_Eprom



Parameter Variable Type Explication
EN [BOOL] enable Function, should be always TRUE(1)
Start [BOOL] trigger for program execution, activated by rising edge (0 -> 1)
Eprom [DINT] Source position, offset in external eprom (depend on config) 0..256kB where to read from
(e.g. 12000 = 12000th Byte)
CPU [DINT] Target destination, offset in CPU V-memory where to store the values
(e.g. 100 = VB100; 2000 = VB2000)
N [DINT] Number of bytes to copy
RCPx [BYTE] Parametrized recipe configuration number (0..3)
Memory [BOOL] edge recognition memory flag
Done [BOOL] function executed successfuly
Error [BOOL] function execution failed
Status [BYTE] on error shows the error-code



Write_ext_Eprom



Parameter Variable Type Explication
EN [BOOL] enable Function, should be always TRUE(1)
Start [BOOL] trigger for program execution, activated by rising edge (0 -> 1)
CPU [DINT] Source position, offset in CPU V-memory where to read from
(e.g. 100 = VB100; 2000 = VB2000)
Eprom [DINT] Target destination, offset in external eprom (depend on config) 0..256kB
(e.g. 12000 = 12000th Byte)
N [DINT] Number of bytes to copy
RCPx [BYTE] Parametrized recipe configuration number (0..3)
Memory [BOOL] edge recognition memory flag
Done [BOOL] function executed successfuly
Error [BOOL] function execution failed
Status [BYTE] on error shows the error-code



Status codes

Code Message Solution
1 Error while reading external eeprom
  • check if "Eprom"(+"N") exceeds parametrized eeprom space (recipe wizard)

  • check if "Wizard"+100 (Bytes) is within V-Memory space
  • 2 Error while copy from CPU to Wizard
  • check if "CPU"(+"N") exceeds the V-Memory space of CPU

  • check if "Wizard"+100 (Bytes) is within V-Memory space
  • 4 Error partial storing to external eeprom
  • check if "Eprom"(+"N") exceeds parametrized eeprom space (recipe wizard)

  • check if "Wizard"+100 (Bytes) is within V-Memory space
  • 8 Error while copy from CPU to Wizard
  • check if "CPU"(+"N") exceeds the V-Memory space of CPU

  • check if "Wizard"+100 (Bytes) is within V-Memory space
  • 16 Error while storing to external eeprom
  • check if "Eprom"(+"N") exceeds parametrized eeprom space (recipe wizard)

  • check if "Wizard"+100 (Bytes) is within V-Memory space
  • 32 Error while copy from Wizard to CPU
  • check if "CPU"(+"N") exceeds the V-Memory space of CPU

  • check if "Wizard"+100 (Bytes) is within V-Memory space
  • 40 Error partial copy from Wizard to CPU
  • check if "CPU"(+"N") exceeds the V-Memory space of CPU

  • check if "Wizard"+100 (Bytes) is within V-Memory space
  • 255 Function already executed once
  • set "Start" to low(0) to reset the "Memory" flag



  • How it works ?
    Since the CPU could only access predefined areas at eeprom, the recipe wizard is still
    required. Next step is to create a dummy recipe configuration of 100 Byte lenght
    (25x DWORD with dummy names) and select a (desired) number of recipes.

    Example:
  • 300 recipes x 100 Bytes = 30kB (eeprom space avialable)
  • 500 recipes x 100 Bytes = 50kB
  • 1000 recipes x 100 Bytes = 100kB


  • The selected value must be always a multiply of 100 !
    Example: 12000, 15300 etc. but not 11880 or 15250.


    Instead the original RCPx_Read, RCPx_Write the library functions Read_Eprom and
    Write_Eprom would be used. The V-Memory space selected from the recipe wizard
    (100 Byte) is used as temporary memory for the library functions. The function reads
    the source in blocks up to 100 bytes from the source position to the temp memory and
    store it to the final destination.

    The read/write operations works synchron to your program (finished within same cycle),
    which could (dramaticaly) increase the cycle time for that pass (see figures below), de-
    pend on number of bytes to be copied.


    Linear scale



    Logarithmic scale




    How to configure ?

    1. Create a dummy recipe configuration with 25 DWORD elements with dummy names.


    2. Add the desired number of recipes (e.g. 100 x 25 DWORD = 10kB)


    3. Notice the selected V-Memory space and configuration number.
        You need the informations to parametrize the function calls.
        Alternate, this informations could be found at symbol table.


    4. Download the recipe configuration into CPU.


    5. Use one of the function calls above (Eprom_ext_Read and/or Eprom_ext_Write).



    Eprom partitioning
    The avialable Eprom size (64kB or 256kB) could be used in several constellations.
    You could split(share) the eprom space into multiple parts. This means unused parts
    could be used for other purposes, such as documentation files (pdf, zip etc.)
    or standard recipe and logging functionality.



    Download (6.5 KB)
    The author makes no warranty, expressed or implied, with regard to this informations and/or software. All implied warranties, including the warranties of merchantability and fitness for a particular use, are hereby excluded. Under no circumstances shall the author of this product or the author(s) of S7-200.net, be liable for any incidental or consequential damages, nor for any damages. Attachments could contain viruses, the user is repsonsible to check the downloaded files before using. The user has no claims, especialy not for error correction or support.
    Rate this entry
       
        
    1 votes
     Last Forum topics regarding this entry:
      show all topics
     Similar entries wich could interrest:
      ID 0045 Sample External eprom sample
      ID 0047 Sample Strings with external eprom
      ID 0002 Library Internal Eeprom
     
    optimized for MS Internet Explorer and 1024 x 768 resoltution
       
      © Copyright 2003-2006 S7-200.NET - all rights reserved.
    S7-200.NET and his author(s) are not liable for any incidental or consequential damages, nor for any damages caused by informations or software published on this page. Simatic, Step7-MicroWin and
    S7-200 are registered trademarks of Siemens AG in Germany and other countries. Further designated trademarks and brands are the property of their respective owners.
     
     S7-200.NET ©2003-2006
    External eprom
    linear read & write access
    + linear access
    + variables >32Bit (string)
    + backup whole V-Memory
    More...
    Yearly timer
    events by date & time
    + up top 3 configurations
    + min. Resolution = 1 min
    + unlimitted blocks
    More...
    Random event
    counter generated events
    + quality assurance
    + security applications
    + unique characteristic
    More...
    Weekly Timer
    Switch devices by clock
    + up top 3 configurations
    + overlapping configurations
    + unlimitted blocks
    More...