• Which the release of FS2020 we see an explosition of activity on the forun and of course we are very happy to see this. But having all questions about FS2020 in one forum becomes a bit messy. So therefore we would like to ask you all to use the following guidelines when posting your questions:

    • Tag FS2020 specific questions with the MSFS2020 tag.
    • Questions about making 3D assets can be posted in the 3D asset design forum. Either post them in the subforum of the modelling tool you use or in the general forum if they are general.
    • Questions about aircraft design can be posted in the Aircraft design forum
    • Questions about airport design can be posted in the FS2020 airport design forum. Once airport development tools have been updated for FS2020 you can post tool speciifc questions in the subforums of those tools as well of course.
    • Questions about terrain design can be posted in the FS2020 terrain design forum.
    • Questions about SimConnect can be posted in the SimConnect forum.

    Any other question that is not specific to an aspect of development or tool can be posted in the General chat forum.

    By following these guidelines we make sure that the forums remain easy to read for everybody and also that the right people can find your post to answer it.

MSFS20 COM Frequencies

Messages
6
Country
portugal
Hello everyone,

First of all, I apologize If this subject has been brought before, but I couldn't find anything on it.

This week I've been working on a prototype that uses SimConnect to change the COM1 frequencies. Eventually the idea is to have a micro-controller displaying the "in-game" frequencies into a display and reading inputs to send to the simulator and change the frequency.

During the work on this prototype I've found a issue with SimConnect. MSFS supports increments of 25 KHz, so theoretically on the display that I would have in the micro-controller, I would need 6 digits to display the COM1 frequency.

Now, the issue is, while reading the data from MSFS through SimConnect I've found that the unit used ("Frequency BCD16") does not support a 6 digit frequency. Example: 119.000 and 119.005 are both read with the same BCD16 value as through SimConnect and when converted it displays 119.000. The problem is not the conversion, because the BCD16 value is the same.

My question is If I'm missing something or If SimConnect can't really read frequencies ending with XXX.XX5?

Thanks,
André
 
In SDK documentation in section Simulation Variables there is settable variable COM SPACING MODE to look at and switch between 25kHz and 8.33kHz
And as WarpD say, look at the table Frequency for available options.
 
Thanks you both, but I think I need to further explain my problem.

To get COM1 standby frequency through SimConnect, I'm using the the following Var:

COM STANDBY FREQUENCY:indexFrequency BCD16

This variable returns in the form of "Frequency BCD16" and the problem I'm encountering is that, for example, both 119.000 and 119.005 returns the same "Frequency BCD16" value, thus making it impossible to convert any frequencies that end with "XXX.XX5".

My question was If it was supposed to return the same value for both frequencies through this Var and If so, what would be the best alternative to request the current COM1 standby frequency to have the frequencies that end with "XXX.XX5".
 
It works fine or I don't understand you question.
C++:
...
SimConnect_AddToDataDefinition(hSimConnect, DEFINITION_ID_AP, "COM STANDBY FREQUENCY:1", "MHz");
SimConnect_AddToDataDefinition(hSimConnect, DEFINITION_ID_AP, "COM STANDBY FREQUENCY:2", "MHz");
...
printf("COM1 standby freq: %7.3f MHz\n", pSomeData->com1_freq_standby);
printf("COM2 standby freq: %7.3f MHz\n", pSomeData->com2_freq_standby);
Screenshot 2020-10-14 202656.png
 
Prepar3DGuy, thanks a lot, I've fixed it now.

My problem was the 4th argument here:

C++:
...
SimConnect_AddToDataDefinition(hSimConnect, DEFINITION_ID_AP, "COM STANDBY FREQUENCY:1", "MHz");
...

Everything is working as intended now with your code, thanks again!
 
Last edited:
Yeah... that "4th argument" is what I was telling you to change... to ask for it in a different unit.

From the SDK:
C++:
SimConnect_AddToDataDefinition
The SimConnect_AddToDataDefinition function is used to add a Flight Simulator simulation variable name to a client defined object definition.

Syntax
HRESULT SimConnect_AddToDataDefinition(
  HANDLE  hSimConnect,
  SIMCONNECT_DATA_DEFINITION_ID  DefineID,
  const char*  DatumName,
  const char*  UnitsName,
  SIMCONNECT_DATATYPE  DatumType = SIMCONNECT_DATATYPE_FLOAT64,
  float  fEpsilon = 0,
  DWORD  DatumID = SIMCONNECT_UNUSED
);


Parameters
hSimConnect
  [in]  Handle to a SimConnect object.
DefineID
  [in]  Specifies the ID of the client defined data definition.
DatumName
  [in]  Specifies the name of the Flight Simulator simulation variable. See the Simulation Variables document for a table of variable names. If an index is required then it should be appended to the variable name following a colon, see the example for DEFINITION_2 below. Indexes are numbered from 1 (not zero). Simulation variable names are not case-sensitive (so can be entered in upper or lower case).
UnitsName
  [in]  Specifies the units of the variable. See the Simulation Variables document for a table of acceptable unit names. It is possible to specify different units to receive the data in, from those specified in the Simulation Variables document. See DEFINITION_2 below for an example. The alternative units must come under the same heading (such as Angular Velocity, or Volume, as specified in the Units of Measurement section of the Simulation Variables document). For strings and structures enter "NULL" for this parameter.
DatumType
  [in, optional]  One member of the SIMCONNECT_DATATYPE enumeration type. This parameter is used to determine what datatype should be used to return the data. The default is SIMCONNECT_DATATYPE_FLOAT64. Note that the structure data types are legitimate parameters here.
fEpsilon
  [in, optional]  If data is requested only when it changes (see the flags parameter of SimConnect_RequestDataOnSimObject), a change will only be reported if it is greater than the value of this parameter (not greater than or equal to). The default is zero, so even the tiniest change will initiate the transmission of data. Set this value appropriately so insignificant changes are not transmitted. This can be used with integer data, the floating point fEpsilon value is first truncated to its integer component before the comparison is made (for example, an fEpsilon value of 2.9 truncates to 2, so a data change of 2 will not trigger a transmission, and a change of 3 will do so).
DatumID
  [in, optional]  Specifies a client defined datum ID. The default is zero. Use this to identify the data received if the data is being returned in tagged format (see the flags parameter of SimConnect_RequestDataOnSimObject). There is no need to specify datum IDs if the data is not being returned in tagged format.


Return Values
The function returns an HRESULT. Possible values include, but are not limited to, those in the following table.
 
Thanks, but I thought COM frequencies only returned BCD16 as units, hence why at first I didn't fully understood what you meant. But thanks a lot for the help, now I know that COM frequencies can be returned in other units.
 
Almost all variables can be returned in different units. That's the reason you can specific the units. The FSX and P3D SDK documentation regarding SimConnect is an ideal place to read up on and understand what SimConnect can offer.
 
Thank you. I've already bookmarked the P3D documentation as is far more complete and easier to understand, at least from my perspective.
 
Last edited:
Back
Top