曝光台 注意防骗
网曝天猫店富美金盛家居专营店坑蒙拐骗欺诈消费者
software simulation synced with your switches sometimes requires special code. I
place this code in my rotaries.hpl file since once I write a routine, I can duplicate it
whenever I come across another switch with the same behavior. Below is the code
for a switch on my HSI that controls selection of navigation modes. This code
excerpt comes from my rotary.hpl file that is the only other file that contains
procedures tied to buttons.
4.3.2.6.1 This code supports a 4-position rotary switch. since I use diodes on this
rotary, I only need 3 bits since I can check for bits 1 and 2 being active to represent
position 3. In Falcon4, this rotary switch rolls over from position 4 to position 1 and
has no reverse direction command. I can make the Falcon4 virtual switch go
backward by sending the forward command 3 times (ILSRoate3). To force the
Falcon4 virtual switch to behave like my real-life switch, I have to track the last
position of the real switch and then send the forward command three times for a
reversal, unless I'm in position 4.
byte ILSPos;
32
byte Last_ILSPos = 1;
:ILSRotate
{keyhit(I);Last_ILSPos = ILSPos;}//Increment virtual switch once
:ILSRotate3
{keyhit(I);keyhit(I);keyhit(I);Last_ILSPos = ILSPos;}
//to make virtual switch go backward, increment it 3 times
:ILSPos1
{jump (ILSRotate3);}
:ILSPos2
{if (Last_ILSPos == 1) jump ILSRotate;if (Last_ILSPos ==3) jump ILSRotate3;}//don’t forget to track
last position
:ILSPos3
{if (Last_ILSPos == 2) jump ILSRotate;if (Last_ILSPos ==4) jump ILSRotate3;}
:ILSPos4
{jump (ILSRotate);}
// Check to see which button was pushed
void Instru_Mode.TCN_ILS.On(void){jump (CheckILSRotary);}
void Instru_Mode.TCN_ILS.Off(void){}
void Instru_Mode.TCN.On(void){jump (CheckILSRotary);}
void Instru_Mode.TCN.Off(void){}
void Instru_Mode.NAV_ILS.On(void){jump (CheckILSRotary);}
void Instru_Mode.NAV_ILS.Off(void){}
//----------------------Start Check Rotary Procedure----------
:CheckILSRotary{
ILSPos = 0; //----Counter-----
// Set a variable based on which button was pushed
if (Instru_Mode.TCN_ILS) {ILSPos = 1;} //If TCN_ILS is active add 1 to ILSPos
if (Instru_Mode.TCN) {ILSPos += 2;}
if (Instru_Mode.NAV_ILS) {ILSPos = 4;}
if(ILSPos==Last_ILSPos) jump RETURN;// If nothing happened do nothing
// Jump to the correct Simulator Routine
if(ILSPos == 1) jump ILSPos1;
if(ILSPos == 2) jump ILSPos2;
if(ILSPos == 3) jump ILSPos3;
if(ILSPos == 4) jump ILSPos4;}
//-----------------End ILS Rotary Procedure--------------------
4.3.2.7 Special procedures: Pigeonholes
Most of you may not have to use pigeonholes, but unless you use commercially
available software, you’ll probably need some special software to send data from
your software simulator to EPIC so you can control output devices like lights,
buzzers, motion control and gauges. By using pigeonholes, I can pass data back
and forth between my software simulator (Falcon4 SP3 for me) and my simulator
hardware panels using EPIC USB. Below is a code excerpt of my pigeonholes
code that controls two of my eyebrow lights. This code requires a companion
routine to send data to the pigeonhole, I use C++ to write the companion code.
//---------------------Pigeon Hole 1------------------------
byte F4SharedMem_lightBits; //Temporary data store
byte F4SharedMem_lightBits2; //Temporary data store
byte F4SharedMem_lightBits3; //Temporary data store
byte F4SharedMem_HSIBits; //Temporary data store
byte F4SharedMem_GearBits; //Temporary data store
int checkBits
33
ph Falcon4SharedMem (0) //Define the Pigeon Hole as a 16 bit word;
//will only really need 1
{
byte F4share1; //First PH store
byte F4share2; //Second PH store
byte F4share3; //Second PH store
byte F4share4; //Second PH store
F4SharedMem_lightBits = Falcon4SharedMem.F4share1; //transfer data
F4SharedMem_lightBits2 = Falcon4SharedMem.F4share2; //transfer data
F4SharedMem_lightBits3 = Falcon4SharedMem.F4share3; //transfer data
F4SharedMem_HSIBits = Falcon4SharedMem.F4share4; //transfer data
call (dataXfer);
};
:dataXfer
//Eye Brow Master Caution
LeftEye_Lgts.Lamps2.Master_Cau_Lamp=off;
checkBits = F4SharedMem_lightBits & 0x1;
if (checkBits == 0x1){LeftEye_Lgts.Lamps2.Master_Cau_Lamp=on;}
//Eye Brow Engine Fire
RightEye_Lgts.Lamps1.EngineFire_Lamp=off;
checkBits = F4SharedMem_lightBits & 0x20;
if (checkBits == 0x20){RightEye_Lgts.Lamps1.EngineFire_Lamp=on;}
};
If the appropriate bits in the pigeonhole are on “1”, then EPIC will turn the
appropriate light on.
中国航空网 www.aero.cn
航空翻译 www.aviation.cn
本文链接地址:
航空资料18(10)