Using program code
You will find the full program code below.
Follow these steps to apply the program code to your project:
1. Copy the entire program code to the clipboard with Ctrl+A, Ctrl+C.
2. Open a text editor (e.g. "Notepad").
3. Paste the content of the clipboard to the text editor with Ctrl+V.
4. Save the document as an scl file, e.g. SNMP_DEACT.scl.
5. Open your project in STEP 7.
6. Import the scl file as an external source.
You will find further information on importing external sources in the STEP 7 online help.
7. Generate the startup OB and the data blocks. (right-click on the scl file, shortcut menu: "Generate blocks from source")
Reactivating SNMP
With small changes, you can use the program code to activate SNMP.
In the user program, assign the "Deactivate SNMP".snmp_record.SNMPControl tag the value "1":
"Deactivate SNMP".snmp_record.SNMP_control := 1;
SNMP will then be activated again the next time the CPU is started.
Full program code
DATA_BLOCK "WRREC_DB_1"
{InstructionName := 'WRREC';
LibVersion := '1.1';
S7_Optimized_Access := 'FALSE' }
AUTHOR : SIMATIC
FAMILY : DP
NAME : WRREC
VERSION : 1.0
WRREC
BEGIN
END_DATA_BLOCK
DATA_BLOCK "Deactivate SNMP"
{ S7_Optimized_Access := 'FALSE' }
VERSION : 0.1
STRUCT
snmp_deactivate : Bool;
snmp_record : Struct
BlockID : Word;
BlockLenght : Word;
"Version" : Byte;
Subversion : Byte;
Reserved : Word;
SNMP_control : DWord;
END_STRUCT;
snmp_done : Bool;
snmp_error : Bool;
snmp_status : DWord;
END_STRUCT;
Product information Deactivating SNMP
9
A5E46739177-AA, 02/2019