Coding the COMM Radio and Using a Swap
Button
![]()
![]() |
This shows you how to code a
COMM radio for FS2000. We also goes into detail on how to add a functioning
Swap button for a dual Active/Standby frequency display While at first this may seem daunting, it is quite easy, and you can always leave out the Swap functionality for now if you wish |
|
|
|
|
The
EPL Header:
A typical EPL file will start with something like what you see on the right. It loads macros such as a #Divide function, and enables the use of Peter Dowson's EPIC.VXD |
EPL
HEADER #include EPICVXD.INC #include MACROS.HPL #define FASTSCAN 0 #define SLOWSCAN 1 #define OUTPUT 2 definemodule(0, FASTSCAN, 0, 3) definemodule(0, SLOWSCAN, 4, 3) definemodule(0, OUTPUT, 0, 8) definemodule(1, SLOWSCAN, 0,16) |
|
|
Start
by defining the display numbers which will be addressed later on in the
EPL code. My numbers will vary from yours, as the physical wiring will
be different for each sim project.
|
#define
C1_STB_LO 48 #define C1_STB_HI 50 #define C1_ACT_LO 52 #define C1_ACT_HI 54 |
|
|
Flag
COM1_FLAG will be used to track the status of the SWAP button later on. |
Flag(COM1_FLAG, False) | |
|
These
are the variables you will need to make the COMM1 radio and swap functions
work correctly.
|
Var16(Remdr) var16(Temp16) var(Temp) var(temp8) var(Result) var(var_VHF1stby_d, 0) var(var_VHF1stby_h, 18) var(var_VHF1act_d) var(var_VHF1act_h) var(var_VHF1tmp_d) var(var_VHF1tmp_h) word(wrd_VHF1) |
|
|
Now we define the
displays and their behavior. This is really saying: "The Display
called C1_STB_LO is on Module #2, begins at Digit #48 and contains 2 digits.
The 0b11111111 merely turns on and off the decimal point.
Now, if you want EPIC to automaticaly update your displays, you have to write the following. DefinePH enables (in this case) a routine called COMM_DISP to be called every time the value in PH1 changes. Pigeon hole #1 contains the value for COMM1
|
||
|
Now it gets ugly. This is the routine that swaps the active and standby displays. It utilizes the MAKEDEC16, which is in the macro file EPICVXD.Inc. If your EPICVXD.Inc file doesn't contain the MAKEDEC etc facilities, you do not have an up-to-date version. Make sure your EPICVXD.Inc file is up to date, otherwise your compiler will fail on these facilities
Even uglier is this routine called when the rotary knob is turned to tune the radio. I should add that you can call your variables anything you want. It will be easier if you develop your own naming standard and exercise strict adherence to the standard when you write your own EPL code.
Remember this? It's called by DefinePH way up at the top. Pretty simple but remember your display numbers will vary from mine, so document what each display in your EPIC setup represents!
Almost done. Now we're at the bottom of the EPL file. Buttons 148 and 149 aren't COMM-related, they are just the button numbers that happen to be wired up to my COMM radio. Your numbers will vary.
Button 149 is the integrated rotary pushbutton to toggle if I'm tuning the high digits or the low digits. Example: in 123.00, 123 are the high digits, and 00 are the low digits
This is the rotary control routine. COM1_FREQ is called when it goes on & off.
|
||
|
That's it for the EPL file. The only thing left is to modify your FS2000.CFG file to use the SetBCDPOVx facility. Since I used SetBCDPOV5, we'll use that for an example: Here's my FS2000.CFG that allows the SWAP facility:
That's it! This is a very complicated undertaking, but if you really want the authenticity of the big airliners, you will need the SWAP button. |
||