|
我有s7-300 siemens840d source,请哪位高手解释其内容及为什么这么编?
[复制链接]
bhg—db
//Achtung: Parameter BHGIn und BHGOut im FB 1 beachten
//Please note FB 1-parmeter BHGIn, BHGOut
DATA_BLOCK "strdat" //strdat - ist Anwender DB, is User DB
VERSION : 0.0
STRUCT
disp : STRING [32 ] := 'sunrise ';
//disp ist Datum fuer Bedienhandgeraet
//disp is data for the handheld unit
END_STRUCT ;
BEGIN
END_DATA_BLOCK
DB120_GUD
DATA_BLOCK DB 120 //Anwender DB
STRUCT
SPDL : STRING [32 ] := 'SPINDLE';
ARM : STRING [32 ] := 'ARM';
MAZ : STRING [32 ] := 'MAGAZINE';
MAZV : STRING [32 ] := 'MAZ_CAPACITY';
TXX : STRING [32 ] := 'T_CODE';
SM19 : STRING [32 ] := 'VATC_M19';
ATCX : STRING [32 ] := 'VATC_X';
ATCY : STRING [32 ] := 'VATC_Y';
ATCZ : STRING [32 ] := 'VATC_Z';
PWD : STRING [32 ] := 'SERVICE_PWD';
MCSX: STRING [32 ] := 'MACHINE_X';
MCSY: STRING [32 ] := 'MACHINE_Y';
MCSZ: STRING [32 ] := 'MACHINE_Z';
WCSX: STRING [32 ] := 'RELATIVE_X';
WCSY: STRING [32 ] := 'RELATIVE_Y';
WCSZ: STRING [32 ] := 'RELATIVE_Z';
RCX: STRING [32 ] := 'RC_X';
RCY: STRING [32 ] := 'RC_Y';
RCZ: STRING [32 ] := 'RC_Z';
NSP :
STRUCT
SYNTAX_ID:BYTE;
bereich_u_einheit:byte;
spalte:word;
zeile:word;
bausteintyp:byte;
ZEILENANZAHL:BYTE;
typ:byte;
laenge:byte;
END_STRUCT;
NARM :
STRUCT
SYNTAX_ID:BYTE;
bereich_u_einheit:byte;
spalte:word;
zeile:word;
bausteintyp:byte;
ZEILENANZAHL:BYTE;
typ:byte;
laenge:byte;
END_STRUCT;
NMAZ :
STRUCT
SYNTAX_ID:BYTE;
bereich_u_einheit:byte;
spalte:word;
zeile:word;
bausteintyp:byte;
ZEILENANZAHL:BYTE;
typ:byte;
laenge:byte;
END_STRUCT;
NMAZV :
STRUCT
SYNTAX_ID:BYTE;
bereich_u_einheit:byte;
spalte:word;
zeile:word;
bausteintyp:byte;
ZEILENANZAHL:BYTE;
typ:byte;
laenge:byte;
END_STRUCT;
NTXX :
STRUCT
SYNTAX_ID:BYTE;
bereich_u_einheit:byte;
spalte:word;
zeile:word;
bausteintyp:byte;
ZEILENANZAHL:BYTE;
typ:byte;
laenge:byte;
END_STRUCT;
ASP :
STRUCT
SYNTAX_ID:BYTE;
bereich_u_einheit:byte;
spalte:word;
zeile:word;
bausteintyp:byte;
ZEILENANZAHL:BYTE;
typ:byte;
laenge:byte;
END_STRUCT;
AX :
STRUCT
SYNTAX_ID:BYTE;
bereich_u_einheit:byte;
spalte:word;
zeile:word;
bausteintyp:byte;
ZEILENANZAHL:BYTE;
typ:byte;
laenge:byte;
END_STRUCT;
AY :
STRUCT
SYNTAX_ID:BYTE;
bereich_u_einheit:byte;
spalte:word;
zeile:word;
bausteintyp:byte;
ZEILENANZAHL:BYTE;
typ:byte;
laenge:byte;
END_STRUCT;
AZ :
STRUCT
SYNTAX_ID:BYTE;
bereich_u_einheit:byte;
spalte:word;
zeile:word;
bausteintyp:byte;
ZEILENANZAHL:BYTE;
typ:byte;
laenge:byte;
END_STRUCT;
NPWD :
STRUCT
SYNTAX_ID:BYTE;
bereich_u_einheit:byte;
spalte:word;
zeile:word;
bausteintyp:byte;
ZEILENANZAHL:BYTE;
typ:byte;
laenge:byte;
END_STRUCT;
MX :
STRUCT
SYNTAX_ID:BYTE;
bereich_u_einheit:byte;
spalte:word;
zeile:word;
bausteintyp:byte;
ZEILENANZAHL:BYTE;
typ:byte;
laenge:byte;
END_STRUCT;
MY:
STRUCT
SYNTAX_ID:BYTE;
bereich_u_einheit:byte;
spalte:word;
zeile:word;
bausteintyp:byte;
ZEILENANZAHL:BYTE;
typ:byte;
laenge:byte;
END_STRUCT;
MZ :
STRUCT
SYNTAX_ID:BYTE;
bereich_u_einheit:byte;
spalte:word;
zeile:word;
bausteintyp:byte;
ZEILENANZAHL:BYTE;
typ:byte;
laenge:byte;
END_STRUCT;
WX :
STRUCT
SYNTAX_ID:BYTE;
bereich_u_einheit:byte;
spalte:word;
zeile:word;
bausteintyp:byte;
ZEILENANZAHL:BYTE;
typ:byte;
laenge:byte;
END_STRUCT;
WY :
STRUCT
SYNTAX_ID:BYTE;
bereich_u_einheit:byte;
spalte:word;
zeile:word;
bausteintyp:byte;
ZEILENANZAHL:BYTE;
typ:byte;
laenge:byte;
END_STRUCT;
WZ :
STRUCT
SYNTAX_ID:BYTE;
bereich_u_einheit:byte;
spalte:word;
zeile:word;
bausteintyp:byte;
ZEILENANZAHL:BYTE;
typ:byte;
laenge:byte;
END_STRUCT;
CX :
STRUCT
SYNTAX_ID:BYTE;
bereich_u_einheit:byte;
spalte:word;
zeile:word;
bausteintyp:byte;
ZEILENANZAHL:BYTE;
typ:byte;
laenge:byte;
END_STRUCT;
CY :
STRUCT
SYNTAX_ID:BYTE;
bereich_u_einheit:byte;
spalte:word;
zeile:word;
bausteintyp:byte;
ZEILENANZAHL:BYTE;
typ:byte;
laenge:byte;
END_STRUCT;
CZ :
STRUCT
SYNTAX_ID:BYTE;
bereich_u_einheit:byte;
spalte:word;
zeile:word;
bausteintyp:byte;
ZEILENANZAHL:BYTE;
typ:byte;
laenge:byte;
END_STRUCT;
END_STRUCT;
BEGIN
END_DATA_BLOCK
gpob840d
//840D
ORGANIZATION_BLOCK OB 1
VERSION: 2.0
VAR_TEMP
OB1_EV_CLASS : BYTE;
OB1_SCAN_1 : BYTE;
OB1_PRIORITY : BYTE;
OB1_OB_NUMBR : BYTE;
OB1_RESERVED_1 : BYTE;
OB1_RESERVED_2 : BYTE;
OB1_PREV_CYCLE : INT;
OB1_MIN_CYCLE : INT;
OB1_MAX_CYCLE : INT;
OB1_DATE_TIME : DATE_AND_TIME;
END_VAR
BEGIN
CALL FC 2;
//HIER ANWENDERPROGRAMM EINFUEGEN
//Insert Userprogram from here
END_ORGANIZATION_BLOCK
//*************************************************************
ORGANIZATION_BLOCK OB 100
VERSION: 2.3
VAR_TEMP
OB100_EV_CLASS : BYTE;
OB100_STRTUP : BYTE;
OB100_PRIORITY : BYTE;
OB100_OB_NUMBR : BYTE;
OB100_RESERVED_1 : BYTE;
OB100_RESERVED_2 : BYTE;
OB100_STOP : WORD;
OB100_RESERVED_3 : WORD;
OB100_RESERVED_4 : WORD;
OB100_DATE_TIME : DATE_AND_TIME;
END_VAR
BEGIN
Call fb 1, db 7(
MCPNum :=1,
MCP1In :=P#E0.0,
MCP1Out :=P#A0.0,
MCP1StatSend :=P#A8.0,
MCP1StatRec :=P#A12.0,
MCP1BusAdr :=6,
MCP1Timeout :=S5T#700MS,
MCP1Cycl :=S5T#200MS,
NCCyclTimeout :=S5T#200MS,
NCRunupTimeout :=S5T#50S);
//HIER ANWENDERPROGRAMM EINFUEGEN
//Insert Userprogram from here
END_ORGANIZATION_BLOCK
//*************************************************************
ORGANIZATION_BLOCK OB 40
VERSION: 3.2
VAR_TEMP
OB40_EV_CLASS : BYTE;
OB40_STRT_INF : BYTE;
OB40_PRIORITY : BYTE;
OB40_OB_NUMBR : BYTE;
OB40_RESERVED_1 : BYTE;
OB40_MDL_ID : BYTE;
OB40_MDL_ADDR : INT;
OB40_POINT_ADDR : DWORD;
OB40_DATE_TIME : DATE_AND_TIME;
//Belegung durch das Grundprogramm
//data for the Basicprogram
GP_IRFromNCK : BOOL; //Interrupt from NCK
GP_TM : BOOL; //Toolmanagment
GP_InPosition : ARRAY [1..31] OF BOOL; //InPos Signal from FC15,16,18
GP_AuxFunction : ARRAY [1..10] OF BOOL; //Auxilary functions
GP_FMBlock : ARRAY [1..10] OF BOOL; //not used
//HIER ANWENDER-Lokaldaten EINFUEGEN
//Insert User-data from here
END_VAR
BEGIN
CALL FC 3;
//HIER ANWENDERPROGRAMM EINFUEGEN
//Insert Userprogram from here
END_ORGANIZATION_BLOCK
|
|