Notes to Programmers
If one uses the EPC9 acquisition board to acquire data in a user program, one has to be
very aware that the EPC9 is controlled through its AD/DA-board as well. Thus, every
time E9Screen has to talk to the EPC9, it will unconditionally make use of the AD/DA-
board. Yet, when E9Screen is not the front application (Windows programmers call it
"focus") and the "Enable Background" option is not selected, then E9Screen gets active
only when it receives a command through the "batch control" handshaking. Therefore,
the "Enable Background" option in the EPC9 drop-down menu must be off.
One other problem spot is to define when to open the message file. This file is created by
E9Screen. Therefore it cannot and should not be opened before E9Screen is running.
Thus, the user program has to delete any message file it finds upon starting. That file
may still be left around from a previous session. A good option is to create an empty
command file in the directory where E9Screen is located and to wait for the message file
to appear in the E9Screen directory. At that moment one can start E9Screen and enable
the option "Enable Batch Control" in the EPC9 drop-down menu. The message file will
then be created and the user program can now open it for reading and sharing.
The first response E9Screen writes to the message file is "Started". Thereafter the user can
proceed to send commands to E9Screen and read back the response.
It is advisable to write to the command file in an analogous way as it is done in the
example code below. In principle, one should proceed as follows:
1. Write a minus sign ("-") to the first byte of the command file. This prevents E9Screen
from interpreting anything in the file while the user programs writes to it. Please, recall
that some operating systems are multitasking. This means that both programs, E9Screen
as well as the user program, run concurrently. Thus, E9Screen may attempt to read from
the message file while the user program is writing to it!
2. Write the remaining of the first text line. The first text line must be the signature
number. The sample code below writes the negative value of the signature to achieve:
- a negative sign is placed in the first byte of the file;
- the signature value is written; and
- the final, positive signature can be obtained by replacing the negative sign with a
plus ("+").
3. Write to following text lines the required instructions, one instruction per text line.
4. Finally, replace the negative sign in the first byte of the file with a plus ("+"). This will
signal to E9Screen to proceed to read and interpret the command file.
5. Monitor the content of the message file. Do not interpret the content of the message
file, as long as the first byte is a minus sign ("-") or the signature value in the first line is
the one used in writing the last command.
Controlling E9Screen
EPC9 Installation
91
Need help?
Do you have a question about the EPC 9 and is the answer not in the manual?