读取LED状态需要调用SFC 51“RDSYSST” ,使用SSL-ID16#74可以读取全部的LED,检索号设置为0,HCPU在读取LED时,SFC返回60个字节的信息。每个LED返回3个字节的信息结构如下:
每个LED都有一个ID加以区分,LED的ID同图1中检索号一致,如INTF(内部错误)对应ID就是16#2,如有3个字节数据值为:
Byte1: 16#2
Byte2: 16#1
Byte3: 16#0
其解释为ID为2的INTF灯被点亮,没有闪烁。
BEGIN
xReq:=FALSE;
IF NOT xBusy THEN
SZL_ID:=W#16#0074;
INDEX:=W#16#0;
xReq:=TRUE;
iErrCode:=RDSYSST(REQ :=xReq
,SZL_ID := SZL_ID
,INDEX := INDEX
,BUSY := xBusy
,SZL_HEADER :=SZL_HEADER
,DR := DR_ModuleLED
);
//LEDs on/off
INTF.On:= (DR_ModuleLED[3]= B#16#1);
EXTF.On:= (DR_ModuleLED[7] = B#16#1);
RUN.On:= (DR_ModuleLED[11]= B#16#1);
STOP.On:= (DR_ModuleLED[15]= B#16#1);
FRCE.On:= (DR_ModuleLED[19]= B#16#1);
BUS1F.On:= (DR_ModuleLED[23]= B#16#1);
BUS2F.On:= (DR_ModuleLED[27]= B#16#1);
REDF.On:= (DR_ModuleLED[31]= B#16#1);
MSTR.On:= (DR_ModuleLED[35]= B#16#1);
RACK0.On:= (DR_ModuleLED[39]= B#16#1);
RACK1.On:= (DR_ModuleLED[43]= B#16#1);
IFM1F.On:= (DR_ModuleLED[47]= B#16#1);
IFM2F.On:= (DR_ModuleLED[51]= B#16#1);
MAINT.On:= (DR_ModuleLED[55]= B#16#1);
BUS5F.On:= (DR_ModuleLED[59]= B#16#1);
// flashing 0.5Hz
INTF.Blink05:= (DR_ModuleLED[4] = B#16#2);
EXTF.Blink05:= (DR_ModuleLED[8] = B#16#2);
RUN.Blink05:= (DR_ModuleLED[12]= B#16#2);
STOP.Blink05:= (DR_ModuleLED[16]= B#16#2);
FRCE.Blink05:= (DR_ModuleLED[20]= B#16#2);
BUS1F.Blink05:= (DR_ModuleLED[24]= B#16#2);
BUS2F.Blink05:= (DR_ModuleLED[28]= B#16#2);
REDF.Blink05:= (DR_ModuleLED[32]= B#16#2);
MSTR.Blink05:= (DR_ModuleLED[36]= B#16#2);
RACK0.Blink05:= (DR_ModuleLED[40]= B#16#2);
RACK1.Blink05:= (DR_ModuleLED[44]= B#16#2);
IFM1F.Blink05:= (DR_ModuleLED[48]= B#16#2);
IFM2F.Blink05:= (DR_ModuleLED[52]= B#16#2);
MAINT.Blink05:= (DR_ModuleLED[56]= B#16#2);
BUS5F.Blink05:= (DR_ModuleLED[60]= B#16#2);
//flashing 2Hz
INTF.Blink2:= (DR_ModuleLED[4] = B#16#1);
EXTF.Blink2:= (DR_ModuleLED[8] = B#16#1);
RUN.Blink2:= (DR_ModuleLED[12]= B#16#1);
STOP.Blink2:= (DR_ModuleLED[16]= B#16#1);
FRCE.Blink2:= (DR_ModuleLED[20]= B#16#1);
BUS1F.Blink2:= (DR_ModuleLED[24]= B#16#1);
BUS2F.Blink2:= (DR_ModuleLED[28]= B#16#1);
REDF.Blink2:= (DR_ModuleLED[32]= B#16#1);
MSTR.Blink2:= (DR_ModuleLED[36]= B#16#1);
RACK0.Blink2:= (DR_ModuleLED[40]= B#16#1);
RACK1.Blink2:= (DR_ModuleLED[44]= B#16#1);
IFM1F.Blink2:= (DR_ModuleLED[48]= B#16#1);
IFM2F.Blink2:= (DR_ModuleLED[52]= B#16#1);
MAINT.Blink2:= (DR_ModuleLED[56]= B#16#1);
BUS5F.Blink2:= (DR_ModuleLED[60]= B#16#1);
END_IF;