//西门子的400H的CPU的读取缓存区大小是不同的很多同学拿着就抄反而有问题,这里我修改为414-5H //CPU的指示灯读取的第一部分 由于字数限制请看第二部分
//Copyright (C) Siemens AG 1999. All Rights Reserved. Confidential
//**************************************************************************************
// 修改版本用于414-5H 20160515 EBC-LW
//**************************************************************************************
FUNCTION_BLOCK LED_H
TITLE = 'LED_H'
{ // List of system attributes
//S7_tasklist:= 'OB80,OB100'; // Block is called if there is a time error and at a warm restart
S7_m_c:= 'true'; // Block can be controlled and monitored
S7_alarm_ui:= '1' // Setting for PCS 7 message dialog ('0'=standard message dialog)
}
AUTHOR: LOGGY
NAME: LED_H
VERSION: '0.01'
FAMILY: CS2PA
KNOW_HOW_PROTECT
//**************************************************************************************
// Declaration Section: Block Parameters
//**************************************************************************************
//System attributes for parameters
(*
S7_sampletime:='true'
S7_dynamic:='true'
S7_edit:='true'
S7_link:='true'
S7_param:='true'
S7_visible:='true'
S7_contact:='true'
S7_m_c:='true'
S7_shortcut:=''
S7_string_0:=''
S7_string_1:=''
S7_unit:=''
S7_server:='alarm_archiv'
S7_a_type:='alarm_8p'
*)
VAR_INPUT
EV_ID {
S7_visible:='false';
S7_link:='false';
S7_param :='false'; // Parameter cannot be set in CFC
S7_server:='alarm_archiv'; // Message no. assigned by server
S7_a_type:='alarm_8p' // Block signals with ALARM_8P
}:DWORD := 0; // Message ID
RUNUPCYC{
S7_visible:='false';
S7_link:='false'
} :INT := 3; // Number of run up cycles
REQ {S7_string_0:='No_req'; S7_string_1:='Req'}: BOOL:=1;
SSL_ID : WORD := W#16#0074;
INDEX : WORD := W#16#0;
END_VAR
VAR_OUTPUT
LENTHDR : WORD;
N_DR{
S7_m_c:='true'} : WORD;
LED_ID1{
// S7_m_c:='true';
S7_visible :='false'} : WORD;
LED_ID2{
// S7_m_c:='true';
S7_visible :='false'} : WORD;
LED_ID3{
// S7_m_c:='true';
S7_visible :='false'} : WORD;
LED_ID4{
// S7_m_c:='true';
S7_visible :='false'} : WORD;
LED_ID5{
// S7_m_c:='true';
S7_visible :='false'} : WORD;
LED_ID6{
// S7_m_c:='true';
S7_visible :='false'} : WORD;
LED_ID7{
// S7_m_c:='true';
S7_visible :='false'} : WORD;
LED_ID8{
// S7_m_c:='true';
S7_visible :='false'} : WORD;
LED_ID9{
// S7_m_c:='true';
S7_visible :='false'} : WORD;
LED_ID10{
// S7_m_c:='true';
S7_visible :='false'} : WORD;
LED_ID11{
// S7_m_c:='true';
S7_visible :='false'} : WORD;
LED_ID12{
// S7_m_c:='true';
S7_visible :='false'} : WORD;
LED_ID13{
// S7_m_c:='true';
S7_visible :='false'} : WORD;
LED_ID14{
// S7_m_c:='true';
S7_visible :='false'} : WORD;
LED_ID15{
// S7_m_c:='true';
S7_visible :='false'} : WORD;
LED_ID16{
// S7_m_c:='true';
S7_visible :='false'} : WORD;
LED_ID17{
// S7_m_c:='true';
S7_visible :='false'} : WORD;
LED_ID18{
// S7_m_c:='true';
S7_visible :='false'} : WORD;
LED_ID19{
// S7_m_c:='true';
S7_visible :='false'} : WORD;
LED_ID20{
// S7_m_c:='true';
S7_visible :='false'} : WORD;
LED_ID21{
// S7_m_c:='true';
S7_visible :='false'} : WORD;
LED_ID22{
// S7_m_c:='true';
S7_visible :='false'} : WORD;
LED_ID23{
S7_m_c:='true';
S7_visible :='false'} : WORD;
LED_ID24{
// S7_m_c:='true';
S7_visible :='false'} : WORD;
LED_ID25{
// S7_m_c:='true';
S7_visible :='false'} : WORD;
LED_ID26{
// S7_m_c:='true';
S7_visible :='false'} : WORD;
LED_ID27{
// S7_m_c:='true';
S7_visible :='false'} : WORD;
LED_ID28{
// S7_m_c:='true';
S7_visible :='false'} : WORD;
LED_ID29{
// S7_m_c:='true';
S7_visible :='false'} : WORD;
LED_ID30{
// S7_m_c:='true';
S7_visible :='false'} : WORD;
LED_ON
{
S7_m_c:='true'
} : DWORD;
LED_BLINK
{
S7_m_c:='true'
} : DWORD;
BUSY {S7_visible :='false'}: BOOL;
R0_RUN {S7_m_c:='true'} : BOOL;
R1_RUN {S7_m_c:='true'} : BOOL;
R0_MAST {S7_m_c:='true'} : BOOL;
R1_MAST {S7_m_c:='true'} : BOOL;
// IFM1_OK {S7_m_c:='true'} : BOOL;
// IFM2_OK {S7_m_c:='true'} : BOOL;
CPU_FAILURE
{
S7_m_c:='true'
} : BOOL;
CPU_FAULT
{
S7_m_c:='true'
} : BOOL;
QMSG_ERR {
S7_visible:='false';
S7_dynamic:='true'} : BOOL := 0; // ALARM_8P: Error output
MSG_STAT {
S7_visible:='false';
S7_dynamic:='true'} : WORD := 0; // Message: STATUS output
MSG_ACK {
S7_visible:='false';
S7_dynamic:='true'} : WORD := 0; // Message: ACK_STATE output
END_VAR
VAR_IN_OUT
// Freely assignable auxiliary values of ALARM_8P
AUX_PR01 {S7_visible := 'false'} : ANY; // Auxiliary value 1
AUX_PR02 {S7_visible := 'false'} : ANY; // Auxiliary value 2
AUX_PR03 {S7_visible := 'false'} : ANY; // Auxiliary value 3
AUX_PR04 {S7_visible := 'false'} : ANY; // Auxiliary value 4
AUX_PR05 {S7_visible := 'false'} : ANY; // Auxiliary value 5
AUX_PR06 {S7_visible := 'false'} : ANY; // Auxiliary value 6
AUX_PR07 {S7_visible := 'false'} : ANY; // Auxiliary value 7
AUX_PR08 {S7_visible := 'false'} : ANY; // Auxiliary value 8
AUX_PR09 {S7_visible := 'false'} : ANY; // Auxiliary value 9
AUX_PR10 {S7_visible := 'false'} : ANY; // Auxiliary value 10
END_VAR
//**************************************************************************************
// Declaration Section: Static Variables
//**************************************************************************************
VAR
DR : ARRAY[1..30] OF STRUCT
CPU_LED_ID : WORD;
LED_ON : BYTE;
LED_BLINK : BYTE;
END_STRUCT;
SZL_HEADER : STRUCT
LENTHDR : WORD;
N_DR : WORD;
END_STRUCT;
sbRESTART :BOOL := TRUE; // Initial start memory bit
siRUNUPCNT :INT := 0; // Counter for RUNUPCYC execution