This code was written for the epic (R&R ELECTRONICS), with digital display module the panel that it controls is the AGT UHF Radio Panel (with digital display),- note this is not the UHF backup panel as depicted in F40-,however it will control the software (F40) and display the proper chan insync with the software, and the DED, it also accepts input to select the chan from the AGT ICP panel. This code has been tested and verified that it works with F40, it is possible to desync the simulator with the software by utilizing methods of changing the radio chan not defined in this code... see Note 4 See the end notes for further info! ;UHF RADIO DISPLAY phy digits 32-38 display module2 here see note 2! definedisplay(9,2,32,1,0,0,false,0b00000001) ;uhf comm channel definedisplay(16,2,33,1,0,0,false,0b00000001) ;uhf channel definedisplay(10,2,34,1,0,0,false,0b00000001) ;freq decimal on uhf radio .01 definedisplay(11,2,35,1,0,0,false,0b00000001) ;freq decimal on uhf radio .1 definedisplay(12,2,36,1,0,0,false,0b00000000) ;freq uhf radio 1's definedisplay(13,2,37,1,0,0,false,0b00000001) ;freq uhf radio 10's definedisplay(14,2,38,1,0,0,false,0b00000001) ;freq uhf radio 100's ;iNITIALIZE THE DISPLAY :init {setinterkey(1) setdisplay(9,1) ;the first number is the logical display number not the physical, second is the value to display setdisplay(10,5) setdisplay(11,4) setdisplay(12,3) setdisplay(13,2) setdisplay(14,1) setdisplay(16,1) ;VARIABLES var (chansel) ;selcected radio channel var (chanset,1) ;what chan is active, preset to chan 1 as F4 begins with radio on and chan1 var (lastchan) ;previous radio chan, for Guard exit prodeedure Var (uhf1,0) ;initialize values for the freq varibles var (uhf2,0) ;initialize values for the freq varibles var (uhf3,0) ;initialize values for the freq varibles var (uhf4,0) ;initialize values for the freq varibles var (uhf5,0) ;initialize values for the freq varibles ;FLAGS flag(uhfon) ;flag is used to determine it the rotary is in any postion but off ;UHF RADIO CONTROL :uhfOff {setvar (chansel,0) ;if the rotary is set to off select chan 0 call (Chancomp) ;cycle the radio, note you have to cycle to the chan, clearflag(uhfon) ; before clearing the flag or it won't turn off!!!! } :uhfpower {setflag(uhfon) ;when the rotary is turned to main enable chans of the radio setvar (chansel,1) ;radio in f40 powers up on chan 1, so set chan to 1 jump (Chancomp) ;proceedure to compare the set chan to the selected chan, utilizes variables, chanset & chansel } :uhfMAN {ifactive (240) ;if the "manual" switch is ON allow the toggles to change the freq {enablescan (232) enablescan (233) enablescan (234) enablescan (235) enablescan (236) enablescan (237) enablescan (238) enablescan (239) enablescan (246) enablescan (247) }} :UHFAUTO {disablescan (232) ;if the "manual" switch is OFF disable scanning of the toggles to change the freq! disablescan (233) disablescan (234) disablescan (235) disablescan (236) disablescan (237) disablescan (238) disablescan (239) disablescan (246) disablescan (247) } :uhfGUARD {setvar(chansel,5) ;sets the selected radio channel, special case... jump directly to the guard chan setvar(lastchan,chanset) jump (Chancomp) } :Guardoff {setvar(chansel,lastchan) ;sets the current chan (chansel variable) to the lastchan(variable), jump (Chancomp) ; before guard switch on was selected } :Chancomp {if (uhfon) ;checks flag that the radio is on {ifvar(chansel,equ,chanset) ;compare the selected chan to the actual radio chan (keeping the pit and the software in sync!) return ;if they are the same exit else jump cylchan ; not the same cycle the chan } } :cylchan {althit (y) ;send a change chan keypress to software addvar(chanset,1) ;add 1 to the channelset, tracking what chan the radio is at ifvar(chanset,GT,7) ;limits to no variable higher than 7 call resetchan delay (3) ;pause to allow the chanset to cycle/update setdisplay(16,chanset) ;display current radio chan jump (Chancomp) ;return to compare the selected chan to the set chan } :CylsetUp {setvar (chansel,7)} ;cycles up to chan 7 if less than chan 1 is selected :CylsetDn {setvar (chansel,1)} ;cycles back to chan 1 if a chan greater than chan 7 is selected :resetchan {setvar (chanset,0)} ;cycle back to chan 0 to seek the selected channel, needed for the Chancomp proceedure!! :ChanUp {addvar(chansel,1) ;used to cyl back to chan 1 if a chan greater than chan 7 is selected ifvar(chansel,GT,7) ;this limits the range of selected chan to 1-7, if a chan greater than 7 is selected it rolls back to chan 1 call CylsetDn delay(3) ;delay to allow the var to set before continuing executing jump (Chancomp) } :ChanDn {subvar(chansel,1) ;this proceedure block is used to jump back to chan chan 7 if you cycle below chan 1 ifvar(chansel,LT,1) ;this limits the range of selected chan to 1-7, if a chan lower than 1 is selected it rolls back to chan 7 call CylsetUp delay(3) jump (Chancomp) } :uhf1up {ifactive(232) ;increases the .01 freq {addvar (uhf1,1) ;enables the potential to read the variables for an actual freq, F4 only looks at chan not freq adddisplay(10,1) ;increment the display } } :uhf1dn {ifactive(233) ;decreases the .01 freq {subvar (uhf1,1) ;set the variable value, see 232 note subdisplay (10,1) ;decrement the display } } :uhf2up {ifactive(234) {addvar (uhf2,1) adddisplay(11,1) } } :uhf2dn {ifactive(235) {subvar (uhf2,1) subdisplay (11,1) } } :uhf3up {ifactive(236) {addvar (uhf3,1) adddisplay(12,1) } } :uhf3dn {ifactive(237) {subvar (uhf3,1) subdisplay (12,1) } } :uhf4up {ifactive(238) {addvar (uhf4,1) adddisplay(13,1) } } :uhf4dn {ifactive(239) {subvar (uhf4,1) subdisplay (13,1) } } :uhf5up {ifactive(246) {addvar (uhf5,1) adddisplay(14,1) } } :uhf5dn {ifactive(247) {subvar (uhf5,1) subdisplay (14,1) } } ;UHFRADIO PANEL BUTTON DEFINITIONS definebutton (232,on,uhf1up) ;defines button presses to manually set the freq .01 digits definebutton (233,on,uhf1dn) definebutton (234,on,uhf2up) ;defines button presses to manually set the freq .1 digits definebutton (235,on,uhf2dn) definebutton (236,on,uhf3up) ;defines button presses to manually set the freq 1. digits definebutton (237,on,uhf3dn) definebutton (238,on,uhf4up) ;defines button presses to manually set the freq 10. digits definebutton (239,on,uhf4dn) definebutton (246,on,uhf5up) ;defines button presses to manually set the freq 100. digits definebutton (247,on,uhf5dn) definebutton (240,on,UHFMAN) ;call to proceedure enableing manual input of freqs definebutton (240,off,UHFAUTO) ;call to proceedure disabeling manual input of freqs definebutton (241,on,UHFGuard) ;call to automatically go to the gard chan.... chan5 in F40 definebutton (241,off,Guardoff) ;call to proceedure to reset the radio back to the state prior to Guard definebutton (242,on,UHFoff) ;call to proceedure to set chan 0, which is radio off in F40 definebutton (243,on,UHFPower) ;enables all chan selections whether manual or thru the icp panel sets the radio to an "enabled"/on ;definebutton (244,on,UHFBoth) ;undefined at this time, future prg possibilities include setting the HSI or TACAN? ;definebutton (245,on,UHFADF) ;undefined at this time, " " " " " " ;ICP PANEL BUTTON DEFINITIONS definebutton(174,on,ChanUp) ;note I defined a seperate toggle for the radio chan selection, definebutton(175,on,ChanDn) ;the incres and decres ICP buttons could be defined but you would have to ;be on the COMM DED in F40 to do chan sel, the incr, decr buttons are defined to the "mode" of the ded page displayed in F40! Note 1: My cockpit utilitzes the EPIC,2 EPIC DISPLAY MODULES, EPIC 32 POINT OUTPUT MODULE ALL panels are AGT products, with actual digital displays, but remember that the code is EPIC specific so slight modification should allow it to work with yours, button definitions (XXX,on,proceedure) will be specific to the wiring, mod, row, scanbit of your pit! The software is Falcon 4.08i (4.08 with the unsupported update!) Note 2: The display module referenced in this example is number 2, physical digits 32-63, to utilize as module 1 change the 2 to a 1 second perimeter in the definedisplay command, see your epic manul for an explanation of the perimeters Note 3: I utilize variables over flags to do relative comparisons, flags work well for absolute comparisons however would entail much repetative code to make a relative comparison... i.e. flags do a true/ false comparison. To make them compare a series of possibilites against a single choice would entail a repative comparison of the choice to the possibility, or as many times as possibilities.... in other words you would have to do 7 proceedures to determine if the chan selected was the chan the radio was set to in the software, and this would only determine how many keypresses would be needed to cycle the radio chan to match the selected chan! By using a variable you can write one proceedure to do the comparison and run it (loop) until a match is made, the Chancomp and cylchan proceedures work in tandem to do this! (confused yet? ) Note 4: Because the idea of a simulator (pit) is to eliminate the keyboard/mouse from the process, by going outside the simulator (to the keyboard for example) to execute a proceedure in the software will always result in a desync of the two (pit and software) to correct this for this proceedure... turn the pit radio off, then cycle the software (either icp buttons or mouse, or however!) to chan 0, now turn the pit radio back on... it will resync the software to the pit. Note 5: Limits must be put on the variable values so that you don't lock the proceedure in a loop.... error message returned will be.... "Error reading version info" when you try to load the epic after the initial load (before the loop lock!) A testepic, dumpe epic etc. will result in the message "bad sanity check" (does Ralph have a sense of humor or what! I was doubting my own sanity till I finally figured out what was going on!) Final Comment: The effort here is to accept simulator inputs to control the radio chan selection/setting in the software, also making functional the other switches on the panel in the manner they were designed to function in the actual cockpit. Addtionally the challenge was to allow the ICP to function as it does in the actual F-16C, and keep it synced with the DED Comm info in the software. However after some thought on the matter I decided to utilize the up and down toggle of the AGT ICP (FLIR area) for chan selection, 2 reasons primarlity... 1 it has no function in the software, and 2 using the increment buttons as the actual cockpit does would mean that you would need to double check what DED display was up before being assured that you were cycling the radio channels and not another active function of the ICP. I do have plans to sync all the radios to this proceedure eventually and expand further upon it. (backup UHF, Aux Comm, etc) but for the moment it demonstrates how to cycle a linear set of choices that repeat, and sync them to the software. I realize there may be better methods as well, modify it as you see fit to your own use! Freely distrubited for personal use! Doug "Loco"Meador AGT, Advanced Graphics Technologies EPIC, EPIC 32 point output module, EPIC Display Module, R&R Electronics