Avionics interfacing

Gables VHF COM

přidáno: 18. 9. 2013 13:38, autor: Pavel Brodský

   This article includes basic description of VHF COM interfacing. I would like to say that the principle is quite similar to the VHF NAV interfacing which is described in a great detail in another article in this section so I will just mention the differences here.


Encoders differences
The main difference in encoders is their number and their logic. There are only four encoders in COM radio but there were seven of them in NAV radio which could sound strange because the range of COM VHF band is much greater than NAV. The encoders are here quite different: The whole parf of the frequency must be coded by two encoders (range 118 - 136 means 19 steps). Each encoder has 4 or 5 outputs at each time which together gives 9 outputs. This is not sufficient for 19 steps so Gabels did it in the way that two outputs on each encoder are active at each time. It means 4 active switches for the whole part of frequency at any time which gives you quite high number of combinations available. Due to the fact that more than one switch is active on each encoder (and each encoder has only one common ground input) there are diodes behind each output. If the diodes were missing the switch would electrically connect the two outputs together which would cause false readings. There are 18 diodes on each side of COM radio + 2 diodes on the frequency switch giving together 38 diodes in each COM radio.


Frequency selector differences
In the NAV radio a standard turn two position switch was used which was capable of switching lot of channels independently so we could switch all the common grounds for all the encoders at each time. In COM radio there is unfortunately only standard two position switch capable of switching only two channels at a time. It means that I had to connect both "sides" of frequencies to the USB card, connect the frequency selector as a simple switch to the joystick card and use software to determine the active frequency. Due to that both active and standby frequencies are decoded at my computer (but only the active is being sent to FSX via Simconnect). The other switching channel of frequency selector is used for light bulbs switching.

Software interfacing
As I have said the software can see all the encoders all the time so both frequencies are known. Because of that the script is twice as long as it would be in NAV instrument where only the active frequency was sent to PC. Also note that I had to combine multiple conditions to determine the frequency set as the whole part is coded by combination of 4 switches, the decimal part is combination of 2 switches and only the last number (zero, two, five, or seven) is coded by single switches). 

My VBScript for HIDMacros

Sub COM1set
if ((HIDMacros.IsButtonPressed("COM1", 11)/(-128))+(HIDMacros.IsButtonPressed("COM1", 16)/(-128)))+(HIDMacros.IsButtonPressed("COM1", 23)/(-128))+(HIDMacros.IsButtonPressed("COM1", 24)/(-128))= 4 then
com1_wholeright_18 = 1 
end if
if ((HIDMacros.IsButtonPressed("COM1", 10)/(-128))+(HIDMacros.IsButtonPressed("COM1", 16)/(-128)))+(HIDMacros.IsButtonPressed("COM1", 23)/(-128))+(HIDMacros.IsButtonPressed("COM1", 24)/(-128))= 4 then
com1_wholeright_19 = 1 
end if
if ((HIDMacros.IsButtonPressed("COM1", 10)/(-128))+(HIDMacros.IsButtonPressed("COM1", 15)/(-128)))+(HIDMacros.IsButtonPressed("COM1", 22)/(-128))+(HIDMacros.IsButtonPressed("COM1", 24)/(-128))= 4 then
com1_wholeright_20 = 1 
end if
if ((HIDMacros.IsButtonPressed("COM1", 15)/(-128))+(HIDMacros.IsButtonPressed("COM1", 16)/(-128)))+(HIDMacros.IsButtonPressed("COM1", 22)/(-128))+(HIDMacros.IsButtonPressed("COM1", 24)/(-128))= 4 then
com1_wholeright_21 = 1 
end if
if ((HIDMacros.IsButtonPressed("COM1", 14)/(-128))+(HIDMacros.IsButtonPressed("COM1", 16)/(-128)))+(HIDMacros.IsButtonPressed("COM1", 22)/(-128))+(HIDMacros.IsButtonPressed("COM1", 24)/(-128))= 4 then
com1_wholeright_22 = 1 
end if
if ((HIDMacros.IsButtonPressed("COM1", 14)/(-128))+(HIDMacros.IsButtonPressed("COM1", 15)/(-128)))+(HIDMacros.IsButtonPressed("COM1", 22)/(-128))+(HIDMacros.IsButtonPressed("COM1", 24)/(-128))= 4 then
com1_wholeright_23 = 1 
end if
if ((HIDMacros.IsButtonPressed("COM1", 11)/(-128))+(HIDMacros.IsButtonPressed("COM1", 15)/(-128)))+(HIDMacros.IsButtonPressed("COM1", 22)/(-128))+(HIDMacros.IsButtonPressed("COM1", 24)/(-128))= 4 then
com1_wholeright_24 = 1 
end if
if ((HIDMacros.IsButtonPressed("COM1", 11)/(-128))+(HIDMacros.IsButtonPressed("COM1", 14)/(-128)))+(HIDMacros.IsButtonPressed("COM1", 22)/(-128))+(HIDMacros.IsButtonPressed("COM1", 24)/(-128))= 4 then
com1_wholeright_25 = 1 
end if
if ((HIDMacros.IsButtonPressed("COM1", 10)/(-128))+(HIDMacros.IsButtonPressed("COM1", 14)/(-128)))+(HIDMacros.IsButtonPressed("COM1", 22)/(-128))+(HIDMacros.IsButtonPressed("COM1", 24)/(-128))= 4 then
com1_wholeright_26 = 1 
end if
if ((HIDMacros.IsButtonPressed("COM1", 10)/(-128))+(HIDMacros.IsButtonPressed("COM1", 11)/(-128)))+(HIDMacros.IsButtonPressed("COM1", 22)/(-128))+(HIDMacros.IsButtonPressed("COM1", 24)/(-128))= 4 then
com1_wholeright_27 = 1 
end if
if ((HIDMacros.IsButtonPressed("COM1", 11)/(-128))+(HIDMacros.IsButtonPressed("COM1", 16)/(-128)))+(HIDMacros.IsButtonPressed("COM1", 22)/(-128))+(HIDMacros.IsButtonPressed("COM1", 24)/(-128))= 4 then
com1_wholeright_28 = 1 
end if
if ((HIDMacros.IsButtonPressed("COM1", 10)/(-128))+(HIDMacros.IsButtonPressed("COM1", 16)/(-128)))+(HIDMacros.IsButtonPressed("COM1", 22)/(-128))+(HIDMacros.IsButtonPressed("COM1", 24)/(-128))= 4 then
com1_wholeright_29 = 1 
end if
if ((HIDMacros.IsButtonPressed("COM1", 10)/(-128))+(HIDMacros.IsButtonPressed("COM1", 15)/(-128)))+(HIDMacros.IsButtonPressed("COM1", 22)/(-128))+(HIDMacros.IsButtonPressed("COM1", 23)/(-128))= 4 then
com1_wholeright_30 = 1 
end if
if ((HIDMacros.IsButtonPressed("COM1", 15)/(-128))+(HIDMacros.IsButtonPressed("COM1", 16)/(-128)))+(HIDMacros.IsButtonPressed("COM1", 22)/(-128))+(HIDMacros.IsButtonPressed("COM1", 23)/(-128))= 4 then
com1_wholeright_31 = 1 
end if
if ((HIDMacros.IsButtonPressed("COM1", 14)/(-128))+(HIDMacros.IsButtonPressed("COM1", 16)/(-128)))+(HIDMacros.IsButtonPressed("COM1", 22)/(-128))+(HIDMacros.IsButtonPressed("COM1", 23)/(-128))= 4 then
com1_wholeright_32 = 1 
end if
if ((HIDMacros.IsButtonPressed("COM1", 14)/(-128))+(HIDMacros.IsButtonPressed("COM1", 15)/(-128)))+(HIDMacros.IsButtonPressed("COM1", 22)/(-128))+(HIDMacros.IsButtonPressed("COM1", 23)/(-128))= 4 then
com1_wholeright_33 = 1 
end if
if ((HIDMacros.IsButtonPressed("COM1", 11)/(-128))+(HIDMacros.IsButtonPressed("COM1", 15)/(-128)))+(HIDMacros.IsButtonPressed("COM1", 22)/(-128))+(HIDMacros.IsButtonPressed("COM1", 23)/(-128))= 4 then
com1_wholeright_34 = 1 
end if
if ((HIDMacros.IsButtonPressed("COM1", 11)/(-128))+(HIDMacros.IsButtonPressed("COM1", 14)/(-128)))+(HIDMacros.IsButtonPressed("COM1", 22)/(-128))+(HIDMacros.IsButtonPressed("COM1", 23)/(-128))= 4 then
com1_wholeright_35 = 1 
end if
if ((HIDMacros.IsButtonPressed("COM1", 10)/(-128))+(HIDMacros.IsButtonPressed("COM1", 14)/(-128)))+(HIDMacros.IsButtonPressed("COM1", 22)/(-128))+(HIDMacros.IsButtonPressed("COM1", 23)/(-128))= 4 then
com1_wholeright_36 = 1 
end if
if (HIDMacros.IsButtonPressed("COM1", 31)/(-128))= 1 And (HIDMacros.IsButtonPressed("COM1", 32)/(-128))= 0 And (HIDMacros.IsButtonPressed("COM1", 30)/(-128))= 0 And (HIDMacros.IsButtonPressed("COM1", 27)/(-128))= 0 then
com1_decright_00 = 1 
end if
if ((HIDMacros.IsButtonPressed("COM1", 31)/(-128))+(HIDMacros.IsButtonPressed("COM1", 32)/(-128)))= 2 then
com1_decright_10 = 1 
end if
if ((HIDMacros.IsButtonPressed("COM1", 30)/(-128))+(HIDMacros.IsButtonPressed("COM1", 32)/(-128)))= 2 then
com1_decright_20 = 1 
end if
if ((HIDMacros.IsButtonPressed("COM1", 30)/(-128))+(HIDMacros.IsButtonPressed("COM1", 31)/(-128)))= 2 then
com1_decright_30 = 1 
end if
if ((HIDMacros.IsButtonPressed("COM1", 27)/(-128))+(HIDMacros.IsButtonPressed("COM1", 31)/(-128)))= 2 then
com1_decright_40 = 1 
end if
if ((HIDMacros.IsButtonPressed("COM1", 27)/(-128))+(HIDMacros.IsButtonPressed("COM1", 30)/(-128)))= 2 then
com1_decright_50 = 1 
end if
if (HIDMacros.IsButtonPressed("COM1", 30)/(-128))= 1 And (HIDMacros.IsButtonPressed("COM1", 32)/(-128))= 0 And (HIDMacros.IsButtonPressed("COM1", 31)/(-128))= 0 And (HIDMacros.IsButtonPressed("COM1", 27)/(-128))= 0 then
com1_decright_60 = 1 
end if
if (HIDMacros.IsButtonPressed("COM1", 27)/(-128))= 1 And (HIDMacros.IsButtonPressed("COM1", 31)/(-128))= 0 And (HIDMacros.IsButtonPressed("COM1", 30)/(-128))= 0 And (HIDMacros.IsButtonPressed("COM1", 32)/(-128))= 0 then
com1_decright_70 = 1 
end if
if ((HIDMacros.IsButtonPressed("COM1", 27)/(-128))+(HIDMacros.IsButtonPressed("COM1", 32)/(-128)))= 2 then
com1_decright_80 = 1 
end if
if (HIDMacros.IsButtonPressed("COM1", 32)/(-128))= 1 And (HIDMacros.IsButtonPressed("COM1", 31)/(-128))= 0 And (HIDMacros.IsButtonPressed("COM1", 30)/(-128))= 0 And (HIDMacros.IsButtonPressed("COM1", 27)/(-128))= 0 then
com1_decright_90 = 1 
end if
if ((HIDMacros.IsButtonPressed("COM1", 8)/(-128))= 1 )then
com1_lastright_0 = 1 
end if
if ((HIDMacros.IsButtonPressed("COM1", 7)/(-128))= 1 )then
com1_lastright_2 = 1 
end if
if ((HIDMacros.IsButtonPressed("COM1", 6)/(-128))= 1 )then
com1_lastright_5 = 1 
end if
if ((HIDMacros.IsButtonPressed("COM1", 3)/(-128))= 1 )then
com1_lastright_7 = 1 
end if
right_com1_frequency_whole = com1_wholeright_18 * 118 + com1_wholeright_19 * 119 + com1_wholeright_20 * 120 + com1_wholeright_21 * 121 + com1_wholeright_22 * 122 + com1_wholeright_23 * 123 + com1_wholeright_24 * 124 + com1_wholeright_25 * 125 + com1_wholeright_26 * 126 + com1_wholeright_27 * 127 + com1_wholeright_28 * 128 + com1_wholeright_29 * 129 + com1_wholeright_30 * 130 + com1_wholeright_31 * 131 + com1_wholeright_32 * 132 + com1_wholeright_33 * 133 + com1_wholeright_34 * 134 + com1_wholeright_35 * 135 + com1_wholeright_36 * 136 + 0
right_com1_frequency_decimal = com1_decright_00 * 0 + com1_decright_10 * 0.1 + com1_decright_20 * 0.2 + com1_decright_30 * 0.3 + com1_decright_40 * 0.4 + com1_decright_50 * 0.5 + com1_decright_60 * 0.6 + com1_decright_70 * 0.7 + com1_decright_80 * 0.8 + com1_decright_90 * 0.9
right_com1_frequency_last = com1_lastright_0 * 0 + com1_lastright_2 * 0.02 + com1_lastright_5 * 0.05 + com1_lastright_7 * 0.07
right_com1_freq = right_com1_frequency_whole + right_com1_frequency_decimal + right_com1_frequency_last
right_com1_active=HIDMacros.IsButtonPressed("COM1", 4)/(-128)
if ((HIDMacros.IsButtonPressed("COM1", 55)/(-128))+(HIDMacros.IsButtonPressed("COM1", 59)/(-128)))+(HIDMacros.IsButtonPressed("COM1", 64)/(-128))= 3 then
com1_wholeleft_18 = 1 
end if
if ((HIDMacros.IsButtonPressed("COM1", 55)/(-128))+(HIDMacros.IsButtonPressed("COM1", 56)/(-128)))+(HIDMacros.IsButtonPressed("COM1", 58)/(-128))+(HIDMacros.IsButtonPressed("COM1", 64)/(-128))= 4 then
com1_wholeleft_19 = 1 
end if
if ((HIDMacros.IsButtonPressed("COM1", 54)/(-128))+(HIDMacros.IsButtonPressed("COM1", 56)/(-128)))+(HIDMacros.IsButtonPressed("COM1", 58)/(-128))+(HIDMacros.IsButtonPressed("COM1", 63)/(-128))= 4 then
com1_wholeleft_20 = 1 
end if
if ((HIDMacros.IsButtonPressed("COM1", 54)/(-128))+(HIDMacros.IsButtonPressed("COM1", 56)/(-128)))+(HIDMacros.IsButtonPressed("COM1", 63)/(-128))+(HIDMacros.IsButtonPressed("COM1", 64)/(-128))= 4 then
com1_wholeleft_21 = 1 
end if
if ((HIDMacros.IsButtonPressed("COM1", 54)/(-128))+(HIDMacros.IsButtonPressed("COM1", 56)/(-128)))+(HIDMacros.IsButtonPressed("COM1", 62)/(-128))+(HIDMacros.IsButtonPressed("COM1", 64)/(-128))= 4 then
com1_wholeleft_22 = 1 
end if
if ((HIDMacros.IsButtonPressed("COM1", 54)/(-128))+(HIDMacros.IsButtonPressed("COM1", 56)/(-128)))+(HIDMacros.IsButtonPressed("COM1", 62)/(-128))+(HIDMacros.IsButtonPressed("COM1", 63)/(-128))= 4 then
com1_wholeleft_23 = 1 
end if
if ((HIDMacros.IsButtonPressed("COM1", 54)/(-128))+(HIDMacros.IsButtonPressed("COM1", 56)/(-128)))+(HIDMacros.IsButtonPressed("COM1", 59)/(-128))+(HIDMacros.IsButtonPressed("COM1", 63)/(-128))= 4 then
com1_wholeleft_24 = 1 
end if
if ((HIDMacros.IsButtonPressed("COM1", 54)/(-128))+(HIDMacros.IsButtonPressed("COM1", 56)/(-128)))+(HIDMacros.IsButtonPressed("COM1", 59)/(-128))+(HIDMacros.IsButtonPressed("COM1", 62)/(-128))= 4 then
com1_wholeleft_25 = 1 
end if
if ((HIDMacros.IsButtonPressed("COM1", 54)/(-128))+(HIDMacros.IsButtonPressed("COM1", 56)/(-128)))+(HIDMacros.IsButtonPressed("COM1", 58)/(-128))+(HIDMacros.IsButtonPressed("COM1", 62)/(-128))= 4 then
com1_wholeleft_26 = 1 
end if
if ((HIDMacros.IsButtonPressed("COM1", 54)/(-128))+(HIDMacros.IsButtonPressed("COM1", 56)/(-128)))+(HIDMacros.IsButtonPressed("COM1", 58)/(-128))+(HIDMacros.IsButtonPressed("COM1", 59)/(-128))= 4 then
com1_wholeleft_27 = 1 
end if
if ((HIDMacros.IsButtonPressed("COM1", 54)/(-128))+(HIDMacros.IsButtonPressed("COM1", 56)/(-128)))+(HIDMacros.IsButtonPressed("COM1", 59)/(-128))+(HIDMacros.IsButtonPressed("COM1", 64)/(-128))= 4 then
com1_wholeleft_28 = 1 
end if
if ((HIDMacros.IsButtonPressed("COM1", 54)/(-128))+(HIDMacros.IsButtonPressed("COM1", 56)/(-128)))+(HIDMacros.IsButtonPressed("COM1", 58)/(-128))+(HIDMacros.IsButtonPressed("COM1", 64)/(-128))= 4 then
com1_wholeleft_29 = 1 
end if
if ((HIDMacros.IsButtonPressed("COM1", 54)/(-128))+(HIDMacros.IsButtonPressed("COM1", 55)/(-128)))+(HIDMacros.IsButtonPressed("COM1", 58)/(-128))+(HIDMacros.IsButtonPressed("COM1", 63)/(-128))= 4 then
com1_wholeleft_30 = 1 
end if
if ((HIDMacros.IsButtonPressed("COM1", 54)/(-128))+(HIDMacros.IsButtonPressed("COM1", 55)/(-128)))+(HIDMacros.IsButtonPressed("COM1", 63)/(-128))+(HIDMacros.IsButtonPressed("COM1", 64)/(-128))= 4 then
com1_wholeleft_31 = 1 
end if
if ((HIDMacros.IsButtonPressed("COM1", 54)/(-128))+(HIDMacros.IsButtonPressed("COM1", 55)/(-128)))+(HIDMacros.IsButtonPressed("COM1", 62)/(-128))+(HIDMacros.IsButtonPressed("COM1", 64)/(-128))= 4 then
com1_wholeleft_32 = 1 
end if
if ((HIDMacros.IsButtonPressed("COM1", 54)/(-128))+(HIDMacros.IsButtonPressed("COM1", 55)/(-128)))+(HIDMacros.IsButtonPressed("COM1", 62)/(-128))+(HIDMacros.IsButtonPressed("COM1", 63)/(-128))= 4 then
com1_wholeleft_33 = 1 
end if
if ((HIDMacros.IsButtonPressed("COM1", 54)/(-128))+(HIDMacros.IsButtonPressed("COM1", 55)/(-128)))+(HIDMacros.IsButtonPressed("COM1", 59)/(-128))+(HIDMacros.IsButtonPressed("COM1", 63)/(-128))= 4 then
com1_wholeleft_34 = 1 
end if
if ((HIDMacros.IsButtonPressed("COM1", 54)/(-128))+(HIDMacros.IsButtonPressed("COM1", 55)/(-128)))+(HIDMacros.IsButtonPressed("COM1", 59)/(-128))+(HIDMacros.IsButtonPressed("COM1", 62)/(-128))= 4 then
com1_wholeleft_35 = 1 
end if
if ((HIDMacros.IsButtonPressed("COM1", 54)/(-128))+(HIDMacros.IsButtonPressed("COM1", 55)/(-128)))+(HIDMacros.IsButtonPressed("COM1", 58)/(-128))+(HIDMacros.IsButtonPressed("COM1", 62)/(-128))= 4 then
com1_wholeleft_36 = 1 
end if
if ((HIDMacros.IsButtonPressed("COM1", 42)/(-128))+(HIDMacros.IsButtonPressed("COM1", 47)/(-128))= 2) then
com1_decleft_00 = 1 
end if
if ((HIDMacros.IsButtonPressed("COM1", 47)/(-128))+(HIDMacros.IsButtonPressed("COM1", 48)/(-128))= 2) then
com1_decleft_10 = 1 
end if
if ((HIDMacros.IsButtonPressed("COM1", 46)/(-128))+(HIDMacros.IsButtonPressed("COM1", 48)/(-128))= 2) then
com1_decleft_20 = 1 
end if
if ((HIDMacros.IsButtonPressed("COM1", 46)/(-128))+(HIDMacros.IsButtonPressed("COM1", 47)/(-128))= 2) then
com1_decleft_30 = 1 
end if
if ((HIDMacros.IsButtonPressed("COM1", 43)/(-128))+(HIDMacros.IsButtonPressed("COM1", 47)/(-128))= 2) then
com1_decleft_40 = 1 
end if
if ((HIDMacros.IsButtonPressed("COM1", 43)/(-128))+(HIDMacros.IsButtonPressed("COM1", 46)/(-128))= 2) then
com1_decleft_50 = 1 
end if
if ((HIDMacros.IsButtonPressed("COM1", 42)/(-128))+(HIDMacros.IsButtonPressed("COM1", 46)/(-128))= 2) then
com1_decleft_60 = 1 
end if
if ((HIDMacros.IsButtonPressed("COM1", 42)/(-128))+(HIDMacros.IsButtonPressed("COM1", 43)/(-128))= 2) then
com1_decleft_70 = 1 
end if
if ((HIDMacros.IsButtonPressed("COM1", 43)/(-128))+(HIDMacros.IsButtonPressed("COM1", 48)/(-128))= 2) then
com1_decleft_80 = 1 
end if
if ((HIDMacros.IsButtonPressed("COM1", 42)/(-128))+(HIDMacros.IsButtonPressed("COM1", 48)/(-128))= 2) then
com1_decleft_90 = 1 
end if
if ((HIDMacros.IsButtonPressed("COM1", 40)/(-128))= 1 )then
com1_lastleft_0 = 1 
end if
if ((HIDMacros.IsButtonPressed("COM1", 39)/(-128))= 1 )then
com1_lastleft_2 = 1 
end if
if ((HIDMacros.IsButtonPressed("COM1", 38)/(-128))= 1 )then
com1_lastleft_5 = 1 
end if
if ((HIDMacros.IsButtonPressed("COM1", 35)/(-128))= 1 )then
com1_lastleft_7 = 1 
end if
left_com1_frequency_whole = com1_wholeleft_18 * 118 + com1_wholeleft_19 * 119 + com1_wholeleft_20 * 120 + com1_wholeleft_21 * 121 + com1_wholeleft_22 * 122 + com1_wholeleft_23 * 123 + com1_wholeleft_24 * 124 + com1_wholeleft_25 * 125 + com1_wholeleft_26 * 126 + com1_wholeleft_27 * 127 + com1_wholeleft_28 * 128 + com1_wholeleft_29 * 129 + com1_wholeleft_30 * 130 + com1_wholeleft_31 * 131 + com1_wholeleft_32 * 132 + com1_wholeleft_33 * 133 + com1_wholeleft_34 * 134 + com1_wholeleft_35 * 135 + com1_wholeleft_36 * 136 + 0
left_com1_frequency_decimal = com1_decleft_00 * 0 + com1_decleft_10 * 0.1 + com1_decleft_20 * 0.2 + com1_decleft_30 * 0.3 + com1_decleft_40 * 0.4 + com1_decleft_50 * 0.5 + com1_decleft_60 * 0.6 + com1_decleft_70 * 0.7 + com1_decleft_80 * 0.8 + com1_decleft_90 * 0.9
left_com1_frequency_last = com1_lastleft_0 * 0 + com1_lastleft_2 * 0.02 + com1_lastleft_5 * 0.05 + com1_lastleft_7 * 0.07
left_com1_freq = left_com1_frequency_whole + left_com1_frequency_decimal + left_com1_frequency_last
left_com1_active=HIDMacros.IsButtonPressed("COM1", 5)/(-128)
com1_result = (right_com1_freq * right_com1_active + left_com1_freq * left_com1_active)*100
HIDMacros.FSXEvent "COM_RADIO_SET", "&h"&com1_result
'HIDMacros.Debug(com1_result)
end sub


GABELS VHF NAV

přidáno: 2. 9. 2013 10:03, autor: Pavel Brodský   [ aktualizováno 2. 9. 2013 10:09 ]

   In this article you can read about our way of interfacing the VHF NAV radio to the FSX. I am pretty sure this method would work easily also with X-Plane with just minor changes to the script.

For full-res photos check the Photos section - Pedestal avionics album.

Gables radio
On the following picture you can see the inner structure of the NAV radio from Gabels. The radio consits of two identical halfs - left and right. Each half includes frequency drums (what you can see, the numbers), seven encoders and two rotary knobs - one for whole part and one for decimal part of frequency. When you turn the decimal knob you move the frequency drum and also the encoders. Using the frequency select switch you can determine which frequency will be active. Above the frequency drums are green light bulbs showing the active one - they are 5V.

NAV radio - hardware part is done!

Gables encoders
Here you can see a photo of one of our encoders. There are four of them for fraction part of frequency and three for whole part. On this example you can see the whole frequency encoder. Connecting this thing to your joystick card is pretty easy, the GND pin leads to your common ground, and the other pins are the buttons signal pins. When connected to (for example) Leo Bodnar card you can see this encoder in Windows as 10 buttons - only one of them is pressed at each time which determines the tuned frequency. In the radio there are much more encoders then what you need so we have used only: this one for whole part, two of them for decimal part - first number, and one special for decimal part - last number (which is five or zero). The exact wiring depends on your joystick card - just keep it simple, you only need individual button press combinations for each possible frequency, the rest is the matter of software. When working with the encoders pay special attention to them, they are fragile! Do not apply great force on them. Good thing is that they are very well heat resistant so soldering the wires on contacts is easy, the material surrounding the contact doesn't melt.

encoder of NAV radio

Joystick cards
I have chosen the MJ16 joystick cards manufactured by my friend in "micro" version which are the smallest joystick cards I have ever seen. You can find many information about them on google, they are not commercial product, people make them at home. They are cheap, easy and reliable. You can also use the Leo Bodnar cards which are similar and I think that the BU0836A could fit into the Gables unit. The Bodnar's BBI32 is too big and you would have to mount it outside of the radio box which I don't like.

On the following picture you can see some versions of the MJ16. We have used the smaller one:

MJ16 joystick cards build by my friend for our project. The smaller version will be used, one card in each NAV/COM radio

What to do if you connect multiple same units to your computer and you don't know which is which? Easy task for Windows register editing. I use the USBView utility (freeware, google it) which can display information about everything connected to your USB. Simply run the utility and then connect your joystick card - you will see which device has just appeared. Write down the manufacturer and products IDs - they are there every time, even if you made the card at home - part of USB protocol. Run your registry editor (Start -> Run -> regedit -> enter) and navigate to Joystics -> OEM. Here you can find the folder if your card (look for similar numbers as which you have seen in USBView. By editing the OEMName you can rename your joystick card to anything you wish. The name will stay there even when you connect the card to other USB port. 

 obrázek spíš pro mě, až zas nebudu vědět jak to přejmenovat...

Wiring
When connecting the encoders to the joystick card don't forget to use the frequency selector switch. You can wire your GND signal to this switch and the switch will connect the signal to only one of two sides at the time - means that you only need half as much inputs on your joystick card! Of course you could connect both sides at the same time to the card and the selector could be connected as a single switch which would bring the need of more complicated scripting to determine which side is active (actually, it would be easy one-line command). I just want to make things simple and easy, so my PC can never see what is tuned on the inactive frequency - because I don't need the PC to know it. Only the active side is connected to the joystick card. Your radio, your decision.

zapojování NAV rádia - obě desetinná místa frekvence "nadrátována"

Software interfacing
Here comes the challenge. You have the card connected to your PC and the encoders and you can make a table like:

button 1: whole part of my frequency is 108
button 2: whole part of my frequency is 109
and so far...

button 11: decimal part of my frequency is 00 or 05
button 12: decimal part of my frequency is 10 or 15
and so far...

button 21: last number of my frequency is 0
button 22: last number of my frequency is 5
that is all

Now you need something to decode your buttons and send the frequency to Flight Sim. If you are using FSX and registered version of FSUIPC you can do a LUA script to do the task. Or you can (as I did) use other utility. I have chosen HIDMacros which can recognise many joysticks with unlimited number of buttons on each of them (note that FSUIPC is limited to 32 buttons per joystick). In HIDMacros I have assigned a function to each of my buttons to call the procedure of NAV1 frequency set. The code of the procedure follows at the end of this article (VBScript).

Other ways how to interface
As the radio is designed to provide tuned frequency "as is", you don't have to follow my way of interfacing. You can design you own PCB to connect to the original diodes and decode the binary coded frequency from them and use your own software to set the FS frequency. Great example of this approach is on L1011 project website. This access has its own advantages - you don't have to touch the encoders and you can use many of the original wires. The disadvantage is that you have to develop your own PCB (printed circuit board) and maybe even your own software. I found it easier and faster to do it as I did.

HIDMacros code
This is my code calculating the frequency from pushed buttons. Note that I have used the FSX event function (yep, Simconnect) so this thing is not FS2004 or X-Plane compatible. If you wanted to use X-Plane the only change to the code would be not to send it as FSX event but as X-Plane dataref - see HIDMacros documentation.


Textové pole

Sub NAV1set
Dim wsh
Set wsh = CreateObject("Wscript.Shell")


wholeeight = HIDMacros.IsButtonPressed("NAV1", 25)/(-128)
wholenine = HIDMacros.IsButtonPressed("NAV1", 26)/(-128)
wholeten = HIDMacros.IsButtonPressed("NAV1", 41)/(-128)
wholeeleven = HIDMacros.IsButtonPressed("NAV1", 42)/(-128)
wholetwelve = HIDMacros.IsButtonPressed("NAV1", 43)/(-128)
wholethirteen = HIDMacros.IsButtonPressed("NAV1", 44)/(-128)
wholefourteen = HIDMacros.IsButtonPressed("NAV1", 45)/(-128)
wholefifteen = HIDMacros.IsButtonPressed("NAV1", 46)/(-128)
wholesixteen = HIDMacros.IsButtonPressed("NAV1", 47)/(-128)
wholeseventeen = HIDMacros.IsButtonPressed("NAV1", 48)/(-128)


decimalzero = HIDMacros.IsButtonPressed("NAV1", 14)/(-128)
decimalone = HIDMacros.IsButtonPressed("NAV1", 13)/(-128)
decimaltwo = HIDMacros.IsButtonPressed("NAV1", 10)/(-128)
decimalthree = HIDMacros.IsButtonPressed("NAV1", 9)/(-128)
decimalfour = HIDMacros.IsButtonPressed("NAV1", 12)/(-128)
decimalfive = HIDMacros.IsButtonPressed("NAV1", 11)/(-128)
decimalsix = HIDMacros.IsButtonPressed("NAV1", 17)/(-128)
decimalseven = HIDMacros.IsButtonPressed("NAV1", 18)/(-128)
decimaleight = HIDMacros.IsButtonPressed("NAV1", 19)/(-128)
decimalnine = HIDMacros.IsButtonPressed("NAV1", 20)/(-128)

lastzero = HIDMacros.IsButtonPressed("NAV1", 2)/(-128)
lastfive = HIDMacros.IsButtonPressed("NAV1", 1)/(-128)

frequencywhole = wholeeight * 108 + wholenine * 109 + wholeten * 110 + wholeeleven * 111 + wholetwelve * 112 + wholethirteen * 113 + (wholefourteen * 114) + wholefifteen * 115 + wholesixteen * 116 + wholeseventeen * 117
frequencydecimal = decimalone * 0.1 + decimaltwo * 0.2 + decimalthree * 0.3 + decimalfour * 0.4 + decimalfive * 0.5 + decimalsix * 0.6 + decimalseven * 0.7 + decimaleight * 0.8 + decimalnine * 0.9 + lastfive * 0.05
frequency = (frequencywhole + frequencydecimal)*100

HIDMacros.FSXEvent "NAV1_RADIO_SET", "&h"&frequency
'HIDMacros.Debug(frequency)
end sub

Video of my result
(sorry for the Czech-only comments)

VHF NAV video


1-2 of 2