Step 7 SNMP auf CPU 317F-2PN/DP deaktivieren (Simatic Manager)

Gamexter

Level-2
Beiträge
9
Reaktionspunkte
0
Zuviel Werbung?
-> Hier kostenlos registrieren
Hallo! Ich möchte die SNMP deaktivieren auf der CPU 317F-2PN/DP.

Ich befolge das vollständige Verfahren Schritt für Schritt anhand des unten aufgeführten Produktinformationsblatts.

Aber es wirft zurück Übersetzungsfehler, auch wenn es nur in den Quellen liegt und aufgrund dessen bin ich nicht in der Lage zu importieren/erzeugen Blöcke aus der Quelle.

Besonders wichtig ist, dass bei der Erstellung des Datenblocks "SNMP deaktivieren" die Variable snmp_record.Version/ snmp_record. "Version" nicht zur Verfügung steht.

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;

BEGIN
snmp_record.BlockID := 16#F003;
snmp_record.BlockLenght := 16#0008;
snmp_record."Version" := 16#0001;
END_DATA_BLOCK

ORGANIZATION_BLOCK "COMPLETE RESTART"
TITLE = "Complete Restart"
{ S7_Optimized_Access := 'FALSE' }
VERSION : 0.1
VAR_TEMP
OB100_EV_CLASS : Byte; // 16#13, Event class 1
OB100_STRTUP : Byte; // 16#81/82/83/84 Method of startup
OB100_PRIORITY : Byte; // Priority of OB Execution
OB100_OB_NUMBR : Byte; // 100 (Organization block 100, OB100)
OB100_RESERVED_1 : Byte; // Reserved for system
OB100_RESERVED_2 : Byte; // Reserved for system
OB100_STOP : Word; // Event that caused CPU to stop (16#4xxx)
OB100_STRT_INFO : DWord; // Information on how system started
OB100_DATE_TIME : Date_And_Time; // Date and time OB100 started
END_VAR


BEGIN
"Deactivate SNMP".snmp_deactivate := 1; //Set WRREC Request
"Deactivate SNMP".snmp_record.SNMP_control := 16#0; //act=1 ; deact= 0
REPEAT
//Write data record
"WRREC_DB_1"(REQ := "Deactivate SNMP".snmp_deactivate,//Transfer data record
ID := 2046,//integrated profinet interface
INDEX := -20367,//Data record number for snmp deactivation
LEN := 12,
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

Fehler:
1706512746551.png
 
Der SCL-Quelltext ist für TIA.
Für Simatic Manager (Step7 classic V5.x) musst du so schreiben:
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; //"Version"
Subversion : BYTE;
Reserved : WORD;
SNMP_control : DWORD;
END_STRUCT;
snmp_done : BOOL;
snmp_error : BOOL;
snmp_status : DWORD;
END_STRUCT;
BEGIN
snmp_record.BlockID := 16#F003;
snmp_record.BlockLenght := 16#0008;
snmp_record._Version := 16#0001;
END_DATA_BLOCK

ORGANIZATION_BLOCK "COMPLETE RESTART"
TITLE = 'Complete Restart'
//{ S7_Optimized_Access := 'FALSE' }
VERSION : '0.1'
VAR_TEMP
OB100_EV_CLASS : BYTE; // 16#13, Event class 1
OB100_STRTUP : BYTE; // 16#81/82/83/84 Method of startup
OB100_PRIORITY : BYTE; // Priority of OB Execution
OB100_OB_NUMBR : BYTE; // 100 (Organization block 100, OB100)
OB100_RESERVED_1 : BYTE; // Reserved for system
OB100_RESERVED_2 : BYTE; // Reserved for system
OB100_STOP : WORD; // Event that caused CPU to stop (16#4xxx)
OB100_STRT_INFO : DWORD; // Information on how system started
OB100_DATE_TIME : DATE_AND_TIME; // Date and time OB100 started
END_VAR
BEGIN
"Deactivate SNMP".snmp_deactivate := 1; //Set WRREC Request
"Deactivate SNMP".snmp_record.SNMP_control := 16#0; //act=1 ; deact= 0
REPEAT
//Write data record
  WRREC."WRREC_DB_1"(REQ := "Deactivate SNMP".snmp_deactivate,//Transfer data record
    ID := 2046,//integrated profinet interface
    INDEX := -20367,//Data record number for snmp deactivation
    LEN := 12,
    RECORD := "Deactivate SNMP".snmp_record);//Data record
  "Deactivate SNMP".snmp_done := "WRREC_DB_1".DONE;
  "Deactivate SNMP".snmp_error := "WRREC_DB_1".ERROR;
  "Deactivate SNMP".snmp_status := "WRREC_DB_1".STATUS;
UNTIL "Deactivate SNMP".snmp_done OR "Deactivate SNMP".snmp_error
END_REPEAT;
END_ORGANIZATION_BLOCK
Vorher in der Symboltabelle die Symbole für die Bausteine z.B. so anlegen:
Code:
Symboltabelle:
WRREC_DB_1       DB 53    SFB 53   
Deactivate SNMP  DB 150   DB 150   
COMPLETE RESTART OB 100    OB 100
 
Zuviel Werbung?
-> Hier kostenlos registrieren
Nimm das mal raus
S7_Optimized_Access := 'FALSE' }

Das dürfte verwirren:
WRREC_DB_1 müsste WRREC_DB sein und sonst vernünftige Namen geben.

Gibts den überhaupt in einer 300?

InstanzDBs sollten IMHO nicht in Quellen generiert werden.
 
Zuviel Werbung?
-> Hier kostenlos registrieren
Der SCL-Quelltext ist für TIA.
Für Simatic Manager (Step7 classic V5.x) musst du so schreiben:
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; //"Version"
Subversion : BYTE;
Reserved : WORD;
SNMP_control : DWORD;
END_STRUCT;
snmp_done : BOOL;
snmp_error : BOOL;
snmp_status : DWORD;
END_STRUCT;
BEGIN
snmp_record.BlockID := 16#F003;
snmp_record.BlockLenght := 16#0008;
snmp_record._Version := 16#0001;
END_DATA_BLOCK

ORGANIZATION_BLOCK "COMPLETE RESTART"
TITLE = 'Complete Restart'
//{ S7_Optimized_Access := 'FALSE' }
VERSION : '0.1'
VAR_TEMP
OB100_EV_CLASS : BYTE; // 16#13, Event class 1
OB100_STRTUP : BYTE; // 16#81/82/83/84 Method of startup
OB100_PRIORITY : BYTE; // Priority of OB Execution
OB100_OB_NUMBR : BYTE; // 100 (Organization block 100, OB100)
OB100_RESERVED_1 : BYTE; // Reserved for system
OB100_RESERVED_2 : BYTE; // Reserved for system
OB100_STOP : WORD; // Event that caused CPU to stop (16#4xxx)
OB100_STRT_INFO : DWORD; // Information on how system started
OB100_DATE_TIME : DATE_AND_TIME; // Date and time OB100 started
END_VAR
BEGIN
"Deactivate SNMP".snmp_deactivate := 1; //Set WRREC Request
"Deactivate SNMP".snmp_record.SNMP_control := 16#0; //act=1 ; deact= 0
REPEAT
//Write data record
  WRREC."WRREC_DB_1"(REQ := "Deactivate SNMP".snmp_deactivate,//Transfer data record
    ID := 2046,//integrated profinet interface
    INDEX := -20367,//Data record number for snmp deactivation
    LEN := 12,
    RECORD := "Deactivate SNMP".snmp_record);//Data record
  "Deactivate SNMP".snmp_done := "WRREC_DB_1".DONE;
  "Deactivate SNMP".snmp_error := "WRREC_DB_1".ERROR;
  "Deactivate SNMP".snmp_status := "WRREC_DB_1".STATUS;
UNTIL "Deactivate SNMP".snmp_done OR "Deactivate SNMP".snmp_error
END_REPEAT;
END_ORGANIZATION_BLOCK
Vorher in der Symboltabelle die Symbole für die Bausteine z.B. so anlegen:
Code:
Symboltabelle:
WRREC_DB_1       DB 53    SFB 53  
Deactivate SNMP  DB 150   DB 150  
COMPLETE RESTART OB 100    OB 100
Erstmal vielen Dank für die Rückmeldung. Ich habe den Code angepasst und die 3 Symbole in der Tabelle auch eingefügt. Jetzt sind alle Fehler weg außer der WRREC_DB_1 Instanziierungsfehler.
Symbol Tabelle:
1706523688271.png
1706523722596.png
1706523753953.png


Fehler:
1706523606204.png
 

Anhänge

  • 1706523706237.png
    1706523706237.png
    1,8 KB · Aufrufe: 3
Füge auch noch den SFB53 WRREC in den Bausteine-Ordner ein. Z.B. in irgendeinem Baustein die AWL-Zeile call SFB53 eintippen (aber nicht speichern!).
 
Also in meinem Step7 V5.5 läßt sich der SCL-Code von #2 komplett fehlerfrei übersetzen.

Lösche mal deinen DB11, und versuche nochmal das SCL-Übersetzen oder erzeuge den IDB DB11 durch eintippen der AWL-Zeile call SFB53, DB11 in einem Baustein.
 
Zurück
Oben