If ((GetInBit(90,0) = 1) and (GetOEMDro(2200) = 0) and (MotorturnCW=1)) then
SetOEMDro(2201) = GetOEMDro(2201) +1
End If
If ((GetInBit(90,0) = 1) and (GetOEMDro(2200) = 0) and (MotorturnCCW=1)) then
SetOEMDro(2201) = GetOEMDro(2201) -1
End If
If (GetInBit(90,0) = 1) then
SetOEMDro(2200) = 1
Else
SetOEMDro(2200) = 0
End If
something like this should work, not tested just written down,
but i think you have to find a criteria to "reference" OemDRO(2200)
Thomas