2nd PANDA - EPICS tutorial & workshop - December 13, 2011
Date and Location
- Location:
- PANDA XXXIX. Collaboration Meeting, KBW Seminar Room, GSI
- Time and Date:
- December 13, 2011, 11:00 - 13:00
Organizers:
- Peter Zumbruch, ITEE/KS, GSI, Germany
- Florian Feldbauer, University of Bochum, Germany
Participants:
Topic
- EPICS tutorial
- 2 hour class introduction to EPICS - Experimental Physics and Industrial Control System
Introductory talks
- EPICS (PZ)
- EPICSOverview.ppt: EPICS Overview - originally from EPICS Training at Legnaro
- Experimental Physics and Industrial Control System
- What to do with it?
- How to use it?
- How to write EPICS?
- collaboration:ENDBGCDIV
- Channel Access Introduction
- EPICS Database (PZ)
- EPICS_Database_in_one_hour_KK.ppt: Database introduction - originally from EPICS Training at Legnaro
- What is it?
- Record Types (ai, ao, bi, bo, mbbi, seq, (d)fanout, genSub)
- vdct
- sequencer vs database records
hadcon streamDevice IOC / Accessing serial ASCII device via StreamDevice/Asyn
- by-hand/telnet
- login to hadcon via telnet (twice → a/b)
$ telnet etraxXYZ
- a) open listener:
$ cat /dev/ttyS1
- b) send command:
$ echo "VERS" > /dev/ttyS1
- a) will respond:
$ RECV VERS 4.3
- via EPICS using streamDevice:
- have an installation of EPICS
- create example IOC TOP directory
$ mkdir -p <myTopDir> && cd <myTopDir>
- create example IOC
$ makeBaseApp.pl -t ioc <myApp>
$ makeBaseApp.pl -t ioc <myApp>
- extend
configure/RELEASE file for streamDevice support
add to it:
-
ASYN=$(EPICS_HOME)/modules/soft/asyn/asyn-4.9
-
STREAM=$(EPICS_HOME)/modules/soft/StreamDevice
- build streamDevice extended example IOC
$ cd <myTopDir> && make
- make protocol directory
$ mkdir -p <myApp>App/protocols && cd <myAppr>App/protocols
- create protocol file
<myProto>.proto
- header:
Terminator = LF;
LockTimeout = 5000;
ReplyTimeout = 4000;
ReadTimeout = 500;
WriteTimeout = 3000;
ExtraInput = Ignore;
- basic debug protocol function:
# Connect a stringin record to this to get
# a generic command interface.
# After processing finishes, the record contains the reply.
debug {
ExtraInput = Ignore;
out "%s";
in "%39c";
}
- create your own protocol function to get the return value of
VERS command
- up to you as string
%s or float %f
- solution to come
- create your database
- change to
Db database directory
$ cd <myTopDir>App/Db
- create
db file <myDb>.db (by hand or by using vdct:
-
stringin debug record:
record(stringin, "$(PREFIX)$(HADCON):debug)") {
field(DTYP, "stream")
field(SCAN, "Passive")
field(OUT, "@<myProto>.proto debug $(device)")
}
- create your new records
stringin, ai
- up to you as string
%%s or float %%f
- solution to come
- edit
Makefile
- add line: DB +=
<myDb>.db
- make
$ make
- edit your start-up configuration file
st.cmd
- change to
ioc database directory
$ cd iocBoot/ioc<myAppr>
- edit
st.cmd
- add correct path to protocols
epicsEnvSet("STREAM_PROTOCOL_PATH", "$(TOP)/<myAppr>App/protocols")
- add register entry
streamHadcon_registerRecordDeviceDriver pdbbase
- add asyn serial port configuration, e.g.
drvAsynSerialPortConfigure("hadcon","/dev/ttyS1",0,0,0)
asynSetOption("hadcon",0,"baud","115200")
asynSetOption("hadcon",0,"bits","8")
asynSetOption("hadcon",0,"parity","none")
asynSetOption("hadcon",0,"stop","1")
asynSetOption("hadcon",0,"clocal","Y")
asynSetOption("hadcon",0,"crtscts","N")
- add your database instance
<myDb>.db, e.g.
dbLoadRecords ("db/<myDb>.db", "HADCON=${HOSTNAME}, PREFIX=PANDA:IOC:, device=hadcon")
- optional export and the end of script your record names to a file , e.g.
dbl > ${TOP}/iocBoot/${IOC}/${HOSTNAME}.dbl
- start your ioc
$ cd iocBoot/ioc<myAppr>
$ ../../bin/<operating system>-<architecture>\<myApp> st.cmd
- use
caput, caget, camonitor, or CSS, or any other client to test it
Examples
- Have a look at the other extended tutorials and their examples of EpicsTraining
--
PeterZumbruch - 30 Nov 2011
This topic: Epics
> WebHome >
EpicsTraining > EpicsTrainingPandaTutorialDecember2011
Topic revision:
2011-11-30, PeterZumbruch

Copyright © by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding GSI Wiki?
Send feedback |
Legal notice |
Privacy Policy (german)