S7-PCI315:Read State

From IBHsoftec Wiki English
Jump to: navigation, search

Read current state with SFC1011

The state of the internal battery of S7-PCI315, the existence of a SD card and the current power source can be read with a special SFC. A Library for STEP®7 can be found in the installation folder.

Read State SFC

CALL SFC 1011

ENABLE_ADC  := TRUE //INPUT BOOL
RET_VAL  := MW 0 //RESULT INT
STATUS  := MW 2 //OUTPUT WORD
VOLTAGE  := MW 4 //OUTPUT WORD
SERIAL_NUMBER  := MD 6 //OUTPUT DWORD
DEVICE_NUMBER  := MD 10 //OUTPUT DWORD


Parameter Type of data Description
ENABLE_ADC BOOL Start of battery voltage measurement with a positive edge. The measurement should not be done too frequently, because every measurement requires a litte amount of energy from the battery.
RET_VAL INT Always 0
STATUS WORD Bit 0 = 1 if Micro-SD card is inserted
Bit 1 = 1 if the PLC has been started without program
Bit 2 = 1 if the PLC program has been loaded from the battery buffered SRAM
Bit 3 = 1 if the PLC programm has been loaded from internal flash
Bit 4 = 1 if the PLC programm has been loaded from the Micro-SD card
Bit 5 = 1 if power supply from the PC is detected
Bit 6 = 1 if an external 24V power supply is detected
Bit 7 = 1 if the PCI bus is active
Bit 8 = 1 if battery voltage measurement is completed
VOLTAGE WORD Analog value of battery voltage, valid for one cycle when the measurement has been completed
SERIAL_NUMBER DWORD Serial number of the card
DEVICE_NUMBER DWORD Order number of the card


Status word

If successful the BR of the status word is set, OR, STA and /FC are zero.

If failed the BR, OR, STA and /FC of the status word are zero.