IOC 配置SNCSEQ:
| 1
2
3
4
5
 | EPICS_BASE = /path/to/your/build/of/epics-base
SUPPORT = ${EPICS_BASE}/../epics-modules
PVXS = ${SUPPORT}/pvxs
# 添加 SNCSEQ
SNCSEQ = ${SUPPORT}/sequencer
 | 
example工程中相关的代码:
|  1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
 | # example/iocExampleApp/src/Makefile
...
# Link in the code from our support library
iocExample_LIBS += iocExampleSupport
# To build SNL programs, SNCSEQ must be defined
# in the <top>/configure/RELEASE file
ifneq ($(SNCSEQ),)
    # Build sncExample into iocExampleSupport
    sncExample_SNCFLAGS += +r
    iocExample_DBD += sncExample.dbd
    # A .stt sequence program is *not* pre-processed:
    iocExampleSupport_SRCS += sncExample.stt
    iocExampleSupport_LIBS += seq pv
    iocExample_LIBS += seq pv
    # Build sncProgram as a standalone program
    PROD_HOST += sncProgram
    sncProgram_SNCFLAGS += +m
    # A .st sequence program *is* pre-processed:
    sncProgram_SRCS += sncProgram.st
    sncProgram_LIBS += seq pv
    sncProgram_LIBS += $(EPICS_BASE_HOST_LIBS)
endif
...
 | 
| 1
2
3
4
5
 | # The name below is derived from the name of the SNL program
# inside the source file, not from its filename. Here the
# program is called sncExample, but is compiled in both the
# sncExample.stt and sncProgram.st source files.
registrar(sncExampleRegistrar)
 | 
| 1
 | #include "../sncExample.stt"
 | 
|  1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
 | program sncExample
double v;
assign v to "{user}:aiExample";
monitor v;
ss ss1 {
    state init {
        when (delay(10)) {
            printf("sncExample: Startup delay over\n");
        } state low
    }
    state low {
        when (v > 5.0) {
            printf("sncExample: Changing to high\n");
        } state high
    }
    state high {
        when (v <= 5.0) {
            printf("sncExample: Changing to low\n");
        } state low
    }
}
 | 
修改启动脚本,在IOC启动时运行SNL程序:
| 1
2
3
4
 | ...
## Start any sequence programs
seq sncExample, "user=$(USER)"
 | 
编译:
此时查看example/dbd/iocExample.dbd,应该可以看到:
| 1
2
3
 | ...
registrar(sncExampleRegistrar)
...
 |