Communications services
3.7 SNMP
Communication
106
Function Manual, 05/2021, A5E03735815-AJ
Transfer the data record B071
H
in the startup OB (OB100) to CPU 1516-3 PN/DP with the
WRREC instruction (write data record).
In the following program code, the data record B071
H
is transferred with the WRREC
instruction in a REPEAT UNTIL loop.
ORGANIZATION_BLOCK "Startup"
TITLE = "Complete Restart"
{ S7_Optimized_Access := 'TRUE' }
VERSION : 0.1
BEGIN
REPEAT
"WRREC_DB_1"
(REQ := "Deactivate SNMP".snmp_deactivate,
//Transfer data record
INDEX:=16#B071,
//Data record number for SNMP deactivation
ID:="Local~PROFINET_interface_1",
//any integrated PROFINET Interface
DONE => "Deactivate SNMP".snmp_done,
ERROR => "Deactivate SNMP".snmp_error,
STATUS => "Deactivate SNMP".snmp_status,
RECORD := "Deactivate SNMP".snmp_record)
//Data record
UNTIL "Deactivate SNMP".snmp_done OR "Deactivate SNMP".snmp_error
END_REPEAT;
END_ORGANIZATION_BLOCK
Using program code
You will find the full program code here.
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. "Editor").
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")
Re-enabling SNMP
With small changes, you can use the program code used above to enable SNMP.
In the user program, assign the "Deactivate SNMP".snmp_record.SNMPControl tag the value
"1":
"Deactivate SNMP".snmp_record.SNMPControl := 1;
SNMP will then be enabled again the next time the CPU is started.
Summary of Contents for SIMATIC ET 200AL
Page 2: ......
Page 143: ......
Page 218: ......
Page 250: ......
Page 296: ......
Page 337: ......
Page 365: ......
Page 392: ......
Page 419: ......
Page 451: ......
Page 483: ......
Page 597: ......
Page 648: ......
Page 702: ......
Page 739: ......
Page 781: ......
Page 804: ......
Page 828: ......
Page 853: ......
Page 880: ......
Page 906: ......
Page 996: ...Diagnostics ...
Page 1121: ......
Page 1565: ......