HOW TO IMPORT STEP7 DATABLOCKS INTO EXCEL97
Thursday, 9 October 2008Never worked with those nice guys of the "SCADA developing people" ? They need to "tag" each PLC value before using it within their SCADA and therefore they need a complete table of all interfaced values along with their type declaration and address in PLC memory. This people know a lot about SCADA but many of them do not know how to move within the Siemens S7 developing environment. In most cases, even if you can obtain a printout of the datablock along with the addresses, you can not use it for automated tags creation and you need to type manually every variable. You can easily copy the contents of a Datablock and paste it to an Excel spreadsheet. Unfortunately this operation does not allow to paste the variable addresses within the datablock. It is a minor problem if all the data belongs to the same datatype (eg. all integers or all Reals), but if you have a Datablock created using structures with mixed data types, it is a real trouble. Here comes a way to fix it: a) install a "print to file" driver in Windows b) print to file the datablock c) import the file in Excel How to install the "print to file" driver in Windows - in Windows' taskbar, select "setting" menu, then select "printers" - click on "install new printer" - select "local printer" - from the manufacturers list, select "generic" (generic/text only) - when assigning the printer port, select "file" - finish installing the printer - now in the "printer" folder, you have the "Generic/text only" printer - select "Generic/text only" printer, click with right-mouse button and select "properties" - on the "properties", select the "paper" tab - scroll all the paper sizes and select "user-defined size" - assign the largest possible values (this ensures no carriage returns when printing long Datablock vars and comments) - in "Paper source" list, assign "continuous, no page break" - click "Ok" and terminate. How to print a datablock to file - open your datablock in Step7 editor - chose "view" menu and select "data view" (this ensure address to be printed for each variable). - From the "file" menu, select "print setup" - select "Generic/text only" printer and "user defined size". - From the "file" menu, select "print" (there is no need to select the "print to file" checkbox of the dialog window). - press "Ok" ant type the name of the file to be output. - start the printing How to import the file to Excel - open the printed file with any editor - remove all the pages header and footer that the Step7 editor has added (I think there is no way to avoid them to be printed...) - save the file - open Excel and open the file - Excel displays a window where you can assign the data separators - select "fixed width" and go to next step - move the first limit to just before the variables name - leave the second limit at the beginning of the data type - add a new limit after 4 chars (this limits the data type to be displayed with four chars only) - add a new limit just before the variables comment. - go to next steps and have the file imported - from Excel spreadsheet you may have to delete the "values" column, but this is a minor problem.