Explore below an example of reading data from a S7-300 PLC directly in Microsoft Excel using S7 Excel Connect.
In Step 7, open the S7 project belonging to the PLC. Open the hardware configuration by double clicking “Hardware”.
Once the hardware configuration is opened, determine rack and slot number. For 300 CPU’s: racknumber = 0, slotnumber = 2.
Doubleclick on “PN-IO” to determine the IP-address of the PLC.
Close the hardware configuration. In this example we will read data from a datablock. Go back to the Step 7 main window and open the S7 Program.
Open the datablock you want to read data from, in our example we will read data from DB11. In this datablock, the address column is important as we need this addresses to get the right data in Excel.
Open Excel and open the ‘S7 Excel Connect’ tab.
As we want to read data from a datablock, open the datablock taskpane by clicking “Data Block Value” in the ribbon. Fill in the right parameters.
- PLC-Type: S7-300
- IP-address: 192.168.1.40 (as configured in the Step 7 hardware configuration)
- Rack: 0
- Slot: 2
- DBNo.: 11 (we want to read from datablock 11 in our example)
- Datatype: REAL (in the Step 7 opened datablock 11, the type at address 0 is a real)
- Startaddress: 0 (as we use the address in the DB here)
Select your desired output cell in Excel and click “OK”.
If you need multiple values from the PLC, make cell references in your GETS7… formula as shown below. This will make the task easier and more dynamic.