• 热门标签

当前位置: 主页 > 航空资料 > 国外资料 >

时间:2010-08-18 09:13来源:蓝天飞行翻译 作者:admin
曝光台 注意防骗 网曝天猫店富美金盛家居专营店坑蒙拐骗欺诈消费者

needs to know:
<name>.epl //my main EPIC EPL file
EPICHID.INC //contains global definitions
mydevices.hpl //explains assignments of analogs and modrows
devices.hpl //explains my hardware devices (physical)
procedures.hpl //explains how procedures tie to devices
4.3.2.1 Main EPIC Project File: <name>.epl
When you create an EPIC Project using EPICenter, it will create the project with a
default name or the <name> you choose. We’ll use <name> as the project name in
this document. One of the files created when you start a project will be <name>.epl,
the main EPIC EPL file for your Project. In <name>.epl, you’ll need to tell the
EPICenter compiler about all the other EPL files you want to include in your EPIC
project. We use the “#include” command to include other EPIC code in our
projects:
#include <EPICHID.INC> //the < > mean “/EPIC/Include” directory
26
#include "mydevices.hpl" //the ” “ mean “/EPIC/Projects/<name>” directory
#include "devices.hpl"
#include " procedures.hpl"
An EPIC EPL program needs to include some or all of the following items to operate
properly. The placement of these items (into separate files) is somewhat arbitrary;
however, you should maintain this order in your EPL Project or you may receive
errors when you compile the Project. The key to a good EPIC Project is including
all of these definitions and code blocks in a set of files (like the ones I discussed
above) that you can manage as your Project grows to thousands of lines of code.
module definitions
flag declarations
variable declarations
button definitions
procedure blocks
I also include in my <name>.epl file the definitions of my modules. Using the
“definemodule” command, we tell the compiler that we have a module attached to
EPIC. The order that the define module statements are encountered will determine
the relative numbering of the modules (the first module defined is module 0; the
second is module 1; etc..) The syntax for the define module command is:
Definemodule|defmod(module<name>,moduletype,StartRow,NumberRows)
The module types are 0=high priority scan; 1=low priority scan; 2=output module;
and 3=seven segment display. To ease the burden on our memory, we can
“#define” the module types and simply use the names from that point on:
#define FASTSCAN 0
#define SLOWSCAN 1
#define OUTPUT 2
#define 7SEGDISP 3
To make life even easier, the EPICHID.INC file already defines these along with
other information so if you “#include” it in your Project, you don’t have to define
them again. Take a look inside the EPICHID.INC file to see what other goodies it
has for you, it’s in your “/EPIC/include” directory. With the module types defined we
can now write:
definemodule (FirstModule,FASTSCAN,0,5)
This statement defines a module named “FirstModule” that is a “high priority scan”
type module with rows staring at 0 and going through row 5. Keep in mind that you
can only have 16 rows as Fastscan rows, so use Fastscan wisely.
27
There is another unique part of the <name>.EPL file we need to discuss since it
also has a special purpose. But first, I need to introduce procedure blocks.
Procedure blocks are the “meat” of an EPL program, since this is where the work
actually gets done. Procedure blocks begin with a label that is followed by the curly
bracket “{“. Other procedure calls, functions, etc, fall within the initial curly bracket
and a closing curly bracket “}”. Statements between the curly brackets are
executed in the order they are encountered, and each statement must end with a
semi-colon (“;”). A “return” is assumed at the end of the procedure block and
therefore not required (the closing curly bracket “}” serves this function). If a
procedure block calls another procedure block, execution continues with the called
procedure block until a closing curly brace is encountered (then execution returns to
the previous procedure block). It is also possible for a procedure block to recurse
by calling itself. Comments and blank lines can be interspersed as desired
throughout the procedure block and will be ignored by the compiler. The following
is an example of a procedure block:
:This_is_a_Label
//This is a comment line
{ //This is the first line of the procedure block
keyhit(g); //Function statement
//Blank line
} //This is the last line of the procedure block
 
中国航空网 www.aero.cn
航空翻译 www.aviation.cn
本文链接地址:航空资料18(7)