I am trying to write an entire COM1 frequency to the sim (prepar3d)
I know i have to do this in BCD format.
I have a function to convert to BCD
Code: Select all
function decimal_to_bcd16(frequency)
local returnbcd = 0
for i = 0, 3 do
returnbcd = returnbcd + (math.floor(frequency % 10) << (i * 4))
frequency = frequency / 10
end
return returnbcd
end
Code: Select all
y = math.floor(decimal_to_bcd16(119.60))
fsx_event("COM_RADIO_SET",y)