Summary
Retrieve a datablock value from a S7 PLC. This function is available via the taskpane as well as directly via the cell “=GETS7DATABLOCK(…)”
When connecting to a datablock in a S7-1200 or 1500 CPU, make sure the “Optimized block access” is disabled, see Disable optimized block access.
Return Value
The function returns the requested datablock value. If the datatype is a BIT, the funtion returns ‘FALSE’ when bit is ‘0’ and ‘TRUE’ when bit is ‘1’.
Arguments
cpuType – Specifies the cpu type of the PLC you want to connect with, must be a string with the CPU type in following format: ‘S7-1200’, ‘S71200’, ‘1200’.
ip – Specifies the ip address of the PLC.
rackNo – Specifies the rack number of the PLC, must be an integer between 0 and 99.
slotNo – Specifies the slot number of the PLC, must be an integer between 0 and 99.
dbNo – Specifies the datablock number, must be an integer between 0 and 9999.
dataType – Specifies the datatype of the requested data. The available datatypes depend on the chosen CPU type.
startAddress – Specifies the start address of the requested data, must be an integer between 0 and 9999.
bitNo – Specifies the bit number if the requested datatype is ‘BIT’, must be an integer between 0 and 7.
Example
