Jump to content
The simFlight Network Forums

programming radio box


Recommended Posts

hi, i am writing codes for radio control box. i am using following ofsets. 

        private Offset<int> com1offset = new Offset<int>("com1", 0x05C4);
        private Offset<int> com1stbyoffset = new Offset<int>("com1stby", 0x05CC);
        private Offset<int> com2offset = new Offset<int>("com2", 0x05C8);
        private Offset<int> com2stbyoffset = new Offset<int>("com2stby", 0x05D0);
        private Offset<short> nav1offset = new Offset<short>("nav1", 0x0350);
        private Offset<short> nav1stbyoffset = new Offset<short>("nav1stby", 0x311E);
        private Offset<short> nav2offset = new Offset<short>("nav2", 0x0352);
        private Offset<short> nav2stbyoffset = new Offset<short>("nav2stby", 0x3120);

com offsets are ok. it returns  9 digits value like 132850000. i am cutting last 3 digits and splitting rest characters like following.

 132     850   000
  mhz   khz   delete

but nav offsets returns different value. it showing 110.50 in msfs2020 but returns 4176. What am i doing wrong in?
(Sorry for my poor English)

Link to comment
Share on other sites

The NAV offsets are stored in hexadecimal, not decimal like the COM offsets.

To convert the value, you must convert it to a string using hexadecimal format. Then you need to add the 1 at the front and the decimal point in the middle...

string nav1String = nav1offset.Value.ToString("X4"); // Convert to hex - exactly 4 digits
nav1String = "1" + nav1String.Substring(0, 2) + "." + nav1String.Substring(2, 2);

 In your example you got the value 4176. In hexadecimal this is 1050. Which represents the frequency 110.50

Paul

  • Like 1
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.