16,748
社区成员
发帖
与我相关
我的任务
分享
type
TPortStatus = (psxAlarm, psxNormal, psxStandby, psxError);
TPortStatusAry = array [0..7] of TPortStatus;
TInputData = array [0..2] of Byte;
procedure DecodePortStatus(const Inputs: TInputData; var Outputs: TPortStatusAry);
var
I: Integer;
xMask: Byte;
begin
xMask:= $1;
for I:= 0 to 7 do begin
if (Inputs[0] and xMask) <> 0 then
Outputs[I]:= psxAlarm
else if (Inputs[1] and xMask) <> 0 then
Outputs[I]:= psxNormal
else if (Inputs[2] and xMask) <> 0 then
Outputs[I]:= psxStandby
else Outputs[I]:= psxError;
xMask:= xMask shl 1;
end;
end;