Jump to content
The simFlight Network Forums

Problem with reading offset 0x034E


Dominik

Recommended Posts

Hello, I'm trying to read the offset 0x034E - COM1 frequency, using lua, Here is the code

while 1 do
file = io.open("test.txt", "w")

ppp = ipc.readUW(0x034E)

file:write(ppp, "\n")

file:close()

ipc.sleep(50)
end

The loop writes the value of this offset to the file. The value of this offset is 6194, com1 frequency is set to 118.050 

It reads this value wrong and I don't know where I went wrong. Please help.

Dominik.

 

Link to comment
Share on other sites

1 hour ago, Dominik said:

I think I found a solution to the problem, I have to use

string.format("%04X", value)

Yes - the offset is in BCD format, so you need to look at the hex representation, as it says in the offset status documentation:

Quote
COM1 frequency, 4 digits in BCD format. A frequency of 123.45 is represented by 0x2345. The leading 1 is assumed.

 

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use. Guidelines Privacy Policy We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.