[simpits-tech] Now.. back to bascic with EPICprog.

Mark Doran simpits-tech@simpits.org
Fri, 6 Dec 2002 22:00:24 -0800


Actually I think it is mostly an EPL question because for Falcon4,
Martin "Pegasus" Schmitt has done most of the hard work for us...and the
required technique is a little different from FS2k owing to rather less
robust support for EPIC (or any other like controllers frankly) in
Falcon4.

Here's what I'm doing and a little of my EPL code to show you the basic
idea...

Go to Martin's site http://www.xflight.de/f16/index_e.htm and grab a
copy of the F4Reader program (under "simulator->communications->EPIC).
This gem of a program reads the Falcon shared memory area and transmits
the data values and light output bits to EPIC via pigeon holes or
qprocs.  Pigeon holes would be my recommendation if you are planning to
use lots of the bits.

Martin's site has some descriptions of the older EPL syntax for
programming with his F4Reader utility.  It's worth reading to see how
pigeon holes in particular work at all.  For syntax in writing code
however, I would also recommend that you get hold of the v53 compiler
from Ralph Robinson and instead use the newer device/output syntax.  The
example below follows that.

There are two sides to set up.  Martin's utility configuration and then
the EPL coding.

For Martin's program, it uses an ini file.  By way of example I'll
demonstrate what I've done for the leftmost column of the caution
annunciator panel.

Here's the fragment of the ini file:

-- f4reader.ini fragment

[CautionLights]
FlcsFault=3,0,0b00000001
ElecSys=3,0,0b00000010
ProbeHeat=3,0,0b00000100
Cadc=3,0,0b00001000
StoresConfig=3,0,0b00010000
AftNotEng=3,0,0b00100000
FwdFuelLow=3,0,0b01000000
AftFuelLow=3,0,0b10000000

-- end ini fragment

You can edit this info by hand but the F4reader user interface can be
used to set all this up too and it's quite intuitive.  What you see is
that I am placing these 8 light output bits into pigeon hole number 3 in
byte number 0 and the bit within that byte is named using the labels
that F4reader provides.  The "1" in the binary (0b<pattern>) numbers
show the particular bit that the given lamp bit is placed into within
the 8 bit byte. The symbolic names F4reader provides of course
correspond to the Falcon4 warning lamp names.

Now to use these in EPL you make a device structure with an output
definition.  In my code, I make a separate device structure for each
physical panel in the F-16 so the annunciator panel gets its own.  (It's
sort of unusual in that it only has output bits...most have inputs and
outputs)

I'll paste all the relevant code here although in my source it's spread
over several different files -- I may miss something out but I'll try
not to!

-- epl fragments

#define OUTPUT 2 

definemodule(0, OUTPUT, 0, 8)

device(dCaution)
{
  // INPUTS

  // None on this panel

  // OUTPUTS
  // each "output" entry may have only 8 bits so caution panel
  // actually uses four of the structures like the one below
  // since it has 32 lamps in reality

  output(Col0, 0, 8) {  // Symbolic name Col0 -> Mod 0, Row 8
    oFlcsFault     = 0b00000001;
    oElecSys       = 0b00000010;
    oProbeHeat     = 0b00000100;
    oCadc          = 0b00001000;
    oStoresConfig  = 0b00010000;
    oAtfNotEngaged = 0b00100000;
    oFwdFuelLow    = 0b01000000;
    oAftFuelLow    = 0b10000000;
  };

  // other three columns would go here...

};

// Caution Annunciator lamp panel
// Mod 0, rows 8-11 in our cockpit wiring scheme
// Arranged by columns mapped to bytes since the lights are arranged in
four
// columns of 8 lamps on the physical parts.

// F4reader ini above will put named bits in the eColumn0 element of the
PH

#define CAUTIONS 3

ph pCautionPanel(CAUTIONS) {  PH # is 3 in this case
  // elements
  byte eColumn0;
  byte eColumn1;
  byte eColumn2;
  byte eColumn3;

  // PH code
  call(set_cautions_by_ph);
};

void set_cautions_by_ph(void)
{
  // Set the lamps, writing the bit pattern in the PH byte to the output
row

  dCaution.Col0 = pCautionPanel.eColumn0;

  // if you add the other three columns, set those here just the same
way
}

-- fragments end

Now when Falcon4 runs, the F4reader pumps data into the pigeon holes
that you have defined and each time the EPIC USB sees any data bit
change in a 32 bit wide pigeon hole, it calls the PH code, in this case
set_cautions_by_ph().  The routine sets the 8 EPIC output module bits
that are dCaution.Col0 to the value pattern place into the 0 byte of the
pigeon hole.  Provided you have the right lamps on the annunciator wired
to the mod/row/bit combinations on the EPIC output module, your lamps
will now follow the values (on/off) in the F4 shared memory.  Voila!

If you've done any programming, particularly C or C++, this starts to
look a lot more intuitive than the older syntax.  It's worth using the
newer syntax now since that's what the tools that Ralph and Steve are
writing for EPIC USB will support longer term.

Long message I know but I hope it's enough to give you some ideas.  You
are welcome to send me email if you have more questions.  The above is
cut right out of my own EPL code which I've tested so I know it can work
like this.

Cheers,

Mark.

> -----Original Message-----
> From: simpits-tech-admin@simpits.org [mailto:simpits-tech-
> admin@simpits.org] On Behalf Of Marc Teichtahl (mteichta)
> Sent: Thursday, December 05, 2002 4:59 AM
> To: simpits-tech@simpits.org
> Subject: RE: [simpits-tech] Now.. back to bascic with EPICprog.
> 
> Frank,
> 
> This is not a question of EPL in a strict sense. You will need to
learn
> how to pull the required information from Falcon and send it to the
> EPIC. If you look at http://www.epicmapper.com in the support sections
> it will show you a system overview for MS FS2k2. The principles wont
> vary that much with Falcon.
> 
> On the EPL side focus on NQW and DEFQPROC as they are your "friend".
> 
> -----Original Message-----
> From: Frank Riedel [mailto:frank@rezultat.dk]
> Sent: Wednesday, December 04, 2002 11:27 PM
> To: simpits-tech@simpits.org
> Subject: [simpits-tech] Now.. back to bascic with EPICprog.
> 
> 
> Hi all !
> Now that i got my EPICsystem i must learn somthing about
> getting the FalconSP software communication with the EPIC
> system so that i can get som lights on in my pit.
> 
> I read alot about EPL and i think that will be noprob.
> But i need som info hint/tips and tricks about getting
> warnings lights and all other hooked up with EPIC...
> ...so guys now you must help a man to his next level in
> building pits ;o)
> 
> Frank
> 
> 
> _______________________________________________
> Simpits-tech mailing list
> Simpits-tech@simpits.org
> http://www.simpits.org/mailman/listinfo/simpits-tech
> To unsubscribe, please see the instructions at the bottom of the above
> page.  Thanks!
> _______________________________________________
> Simpits-tech mailing list
> Simpits-tech@simpits.org
> http://www.simpits.org/mailman/listinfo/simpits-tech
> To unsubscribe, please see the instructions at the bottom of the above
> page.  Thanks!