this is my code about "light" ,wrong or right???
procedure TFormMain.BBCNClick(Sender: TObject);
var
dwResult : DWORD;
dwResult1 : DWORD;
// Light : Byte;
Light : Array[1..2] of Byte;
AllLight : SmallInt;
begin
//BCN灯开关
if FSUIPC_Read($0280, 2, @Light, dwResult) and FSUIPC_Read($0D0C, 2, @AllLight, dwResult1)then begin
if FSUIPC_Process(dwResult) and FSUIPC_Process(dwResult1) then begin
if ByteToBool(Light[1]) then begin//这个变量将来要跟单片机的状态相连
Light[1]:=0;
end else begin
Light[1]:=1;
end;
end;
end;
AllLight:=2;//1=Nav, 2=Bcn, 4=Land, 8=Taxi, 16=Strobe,
//32=Panel, 64=Recognition, 128=Wing, 256=Logo, 512=Cabin
//$0D0C(see also $0280, $0281 and $028C)
if FSUIPC_Write($0280, 2, @Light, dwResult) and FSUIPC_Write($0D0C, 2, @AllLight, dwResult1)then begin
if FSUIPC_Process(dwResult1) then begin
//for i:=1 to 2 do cLight:=0;
//cLight[1] := 1;
//cLight[2] := 1;
//cLight[3] := 1;
end else begin
// Unable to "Process"
BBCN.Caption := 'Processing: ' + ResultText[dwResult];
end;
end else begin
// Unable to "Read"
BBCN.Caption := 'Reading: ' + ResultText[dwResult];
end;
end;