Skip to content
View in the app

A better way to browse. Learn more.

The AVSIM Community

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

How to get the active NAV1 frequency in C++?

Featured Replies

Hi,I'm having a difficulty in C++ obtaining the NAV1 active frequency (in a native Win32 application). In my panel the frequency reads 107.20I call a SimConnect_AddToDataDefinition with the following parameters "Nav active frequency:1", "MHz" and SIMCONNECT_DATATYPE_FLOAT64 When the value returns I try to interpret pObjData->dwData as double, but I do not know how to convert that to integer?????If I convert to int (to get the whole value) I get a strange result.Note that if I use SIMCONNECT_DATATYPE_INT32 and I interpret the pObjData->dwData as int, I get the correct whole value 107, but then I miss the decimal part .20Any help would be appreciated.Nicohttp://www.nicokaan.nl

  • Commercial Member

>I call a SimConnect_AddToDataDefinition with the following>parameters "Nav active frequency:1", "MHz" and>SIMCONNECT_DATATYPE_FLOAT64I've always found it best to read it as "frequency BCD16", not MHz, with type INT32. This is the native format in FS. You'll get 0x0720 for a frequency of 107.20. The inital 1 is assumed (it is always 1).>When the value returns I try to interpret pObjData->dwData as>double, but I do not know how to convert that to integer?A DOWRD value is only 4 bytes in any case. The double is 8 bytes. If you've definitely read the 8 bytes just read is using a cast:double dFrequency = *((double *) &pObjData->dwData);RegardsPete

Win10: 22H2 19045.2728
CPU: 9900KS at 5.5GHz
Memory: 32Gb at 3800 MHz.
GPU:  RTX 24Gb Titan
2 x 2160p projectors at 25Hz onto 200 FOV curved screen

  • Author

Hi Pete,Thank you for your help. Your cast works perfectly! I was under the impression that a DWORD was 8 bytes too, but you have opened my eyes.I also did not know that we have the freedom to choose BCD16 instead of MHz; the Simconnect documentation is not very eleborate on that. But good to know.Thanks again.Nicohttp://www.nicokaan.nl

Create an account or sign in to comment

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.