Код:
fixBTN : UDINT;

if btn1 and not btn2 and not btn3 and not btn4 then
  fixBTN := 1;
end_if
if not btn1 and btn2 and not btn3 and not btn4 then
  fixBTN := 2;
end_if
if not btn1 and not btn2 and btn3 and not btn4 then
  fixBTN := 3;
end_if
if not btn1 and not btn2 and not btn3 and btn4 then
  fixBTN := 4;
end_if