Note:
Replace the "XX" with the number you
wrote down in the TEST128 program. Save this code (into your EPIC folder)
as (e.g) first.epl
Change to DOS mode, into your EPIC directory and type:
epl first Some info will be displayed and you will
receive an errormessage if there are any faults in your code.
Next, type: Loadepic first and when it is loaded
correctly, you can press the button and a "g" will appear. If you release
that button, a "k" will be displayed.
Congratulations, you just wrote your first program.
Now we'll take a look at the code line by line:
#define FASTSCAN 0
Replaces all instances of the word "FASTSCAN"
with 0. Whereever you write FASTSCAN in the code, the compiler replaces
it with 0. With aliases like this you get more overview over your code.
definemodule(0,FASTSCAN,0,7)
Defines a module of the following type:
0 --> Modulenumber for the module that is beeing
assigned.
Range can be from 0 to 15.
FASTSCAN --> 0 for high priority scan (for input
type modules, scanning in 20ms intervals and for a maximum of 16 rows).
Can also be 1 for low priority scan (for input type modules,
scanning in 20ms intervals and 8 rows at a time. 64 scanrows will therefore
be scanned in 160ms. With the low priority scan you are not limited with
the number of rows you scan, it just takes longer until the arey all scanned
). Input type modules are modules with which you make inputs to your EPIC
card (and your PC) in form of switches, rotary encoders and the like.
Number 2 would define your module as output module and
no. 3 as 7-segment-display.
0 --> Start with scanning at row 0.
7 --> Number of rows to scan.
:Press
{
keyhit(g)
}
The first line is the name of the procedure.
You can choose a name that makes more sense, for example trigger or releaseordonance.
This is the procedure that EPIC will go thru when you press the button
( see the definebutton statement). With the "{" you open the procedure.
Keyhit presses the button specified within the brackets.
There are also other statements than keyhit, we will look at them later.
What you need to know here is that keyhit presses the key long enough for
EPIC to recognize it and releases it again.
"}" closes the procedure. Make sure that you close all
procedures that you opened, or you will get a compiler error and when you
have a long program, these kind of faults are hard to find.
:Release
{
keyhit(k)
}
This is the procedure for the release of your
button. The structure is exactly as above, except we want to have a "k"
instead of a "g".
Definebutton(XX,on,Press)
Defines a button with the number that you got
from TEST128. The second statement tells EPIC that you want to execute
the procedure named "Press" when the button is beeing turned on (pressed).
Definebutton(XX,off,Release)
Exactly the same as above, but this time EPIC
has to execute a different procedure when the button is released (turned
off).
If you don't want EPIC to do anything when you release
your button, you don't need to write this definebutton statement and no
procedure for its release.
If you want to add comments in your file, place a ";" in
front of your comment and the compiler will ignore what's written behinde
the ";".
That's it! Simple to understand, and it really works!
Note:
Each time you reboot Windows, the EPIC buffer get's cleared.
This means that your previously loaded EPIC file is no longer present.
You need to reload your file each time you start Windows, and the easiest
way to do this is to write a small batch file that looks like this:
cd C:\epic
loadepic "Filename"
Place this batch file in your Autostart directory in the
Windows Start menu, and it will be automatically loaded each time you restart
your computer.