Getting started with EPICS

For our applications we are using the StreamDevice module, Asyn driver and the sCALC record. All these extensions are included in the synApps package. StreamDevice is a generic EPICS module, which supports sending and receiving strings via the serial port or ethernet using the Asyn driver for low-level support.

Before going any further into detail there are many helpful documentations on EPICS and the particular modules on the web:

Since we are running Scientific Linux 4 and Scientific Linux 5 on our PCs with an i386 architecture, this guide is written for such a system. Some commands or routines could differ using another OS. EPICS base, all extensions and our applications are installed in the folder /usr/Epics/. If you install EPICS or the applications in a different folder, you have to reconsider the paths named in the following commands.

Building an EPICS Application

Creating all necessary Files

This section shows you how to build a new EPICS application using the StreamDevice module called " TEST ".

First of all, you have to create a new directory for your application. In this case, the directory has the same name as the application:
[user@host]# mkdir TEST

After creating the directory the following commands have to be performed:
[user@host]# cd TEST
[user@host]# ../base-3.14.10/bin/linux-x86/makeBaseApp.pl -t example TEST
[user@host]# ../base-3.14.10/bin/linux-x86/makeBaseApp.pl -i -t example TEST
[user@host]# setenv EPICS_HOST_ARCH linux-x86
[user@host]# make
If you are using a Bourne Shell you have to use export EPICS_HOST_ARCH=linux-x86 instead of the setenv command. These commands create all necessary directories and also some example files.

As already mentioned, this guide uses the StreamDevice module. The functions for this module are defined in a protocol file (c.f. section 3). In principle there is no rule or something like this, where to store this file. We stored our protocol files in a subdirectory of the TESTApp folder. Also for using the different modules you have to create the file TESTInclude.dbd:
[user@host]# mkdir TESTApp/protocols
[user@host]# emacs TESTApp/src/TESTInclude.dbd

Your TESTInclude.dbd should look like this:
include "base.dbd"                            # EPICS-Base
include "stream.dbd"                          # StreamDevice
include "asyn.dbd"                            # Asyn driver
include "calcSupport.dbd"                     # CALC module
include "sCalcoutRecord.dbd"                  # sCALC module
registrar(drvAsynIPPortRegisterCommands)      # for configuring ethernet
registrar(drvAsynSerialPortRegisterCommands)  # for configuring serial port

Also one has to add the following lines to TESTApp/src/Makefile beneath the " \# Build the IOC support library " comment:
PROD_LIBS += stream
PROD_LIBS += asyn
PROD_LIBS += calc

Beneath the comment " \# TEST.dbd will be made up from these files: " add these lines:
TEST_DBD += TESTInclude.dbd
TEST_DBD += stream.dbd
TEST_DBD += asyn.dbd

Last but not least the file configure/RELEASE has to be amended by the lines
SSCAN=$(TOP)/../synApps/synApps_5_4_1/support/sscan/2-6-4
CALC=$(TOP)/../synApps/synApps_5_4_1/support/calc/2-7
ASYN=$(TOP)/../synApps/synApps_5_4_1/support/asyn/4-10
STREAM=$(TOP)/../synApps/synApps_5_4_1/support/stream/2-4
Is everything done, you can build your application:
[user@host]# make
[user@host]# chmod u+x iocBoot/iocTEST/st.cmd
NOTE: If you enter afterwards the command make clean, some files will be deleted, that are necessary for your EPICS application!

Since we are using StreamDevice we have to set the EPICS environment variable STREAM_PROTOCOL_PATH in iocBoot/iocTEST/envPaths:
epicsEnvSet ("STREAM_PROTOCOL_PATH", "/usr/Epics/TEST/TESTApp/protocols")

Before you can start your application you have to write your database (section 2) and your protocol file (section 3) . Also you have to configure the port of your device (section 4).

Writing the Database

Writing the Protocol File

Configuring the Asyn Driver

Contact Persons:

This topic: DCS > EPICSstartUsingStreamDev
Topic revision: revision 2
 
This site is powered by FoswikiCopyright © by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding PANDA Wiki? Send feedback
Imprint (in German)
Privacy Policy (in German)