#! Generated by VisualDCT v2.6
#! DBDSTART
#! DBD("../../dbd/pmac.dbd")
#! DBDEND


# # \file
# # This template allows setting of variables for a 2jack CS. It requires
# # PROG10_CS_motion.pmc and an instantiation of CS_2jack.pmc with the variables 
# # shown in the image below:
# # \image html 2jack-help.png "Setup of 2 jack CS"
# # Build instructions for an example IOC are available 
# # \ref build_instructions_CS2jack "here", with a pmc file containing 
# # the CS definition available in iocs/CS2jack/defs.pmc
# % macro, __doc__, Supporting template that allows setting of variables for a 
# 2jack CS 
# % macro, P, Pv Prefix
# % macro, COORD, Co-ordinate system number
# % macro, PREC, Precision to display variables
# % macro, J1PV, Pv of real Jack1 motor, e.g. $(P):J1
# % macro, J2PV, Pv of real Jack2 motor, e.g. $(P):J2
# % macro, name, Object name and gui association name
# This associates an edm screen with the template
# % gui, $(name=), edm, 2jack.edl, 2jack=$(P)

# # This record will zero J1 and J2 when processed
record(fanout, "$(P):ZERO") {
  field(LNK1, "$(P):ZEROJ1")
  field(LNK2, "$(P):ZEROJ2")
}

record(calcout, "$(P):ZEROJ1") {
  field(CALC, "-A")
  field(INPA, "$(J1PV=$(P):J1).DRBV")
  field(OUT, "$(J1PV=$(P):J1).OFF PP")
}

record(calcout, "$(P):ZEROJ2") {
  field(CALC, "-A")
  field(INPA, "$(J2PV=$(P):J2).DRBV")
  field(OUT, "$(J2PV=$(P):J2).OFF PP")
}

substitute "VAR=&$(COORD)Q20,Q=:DIST,EGU=mm,VARIABLE_PREC=$(PREC=3)"
include "pmacVariableWrite.template"

substitute "VAR=&$(COORD)Q21,Q=:PIVOT,EGU=mm,VARIABLE_PREC=$(PREC=3)"
include "pmacVariableWrite.template"

substitute "VAR=&$(COORD)Q22,Q=:DEPTH,EGU=mm,VARIABLE_PREC=$(PREC=3)"
include "pmacVariableWrite.template"

#! Further lines contain data used by VisualDCT
#! View(0,0,1.0)
#! Record("$(P):ZERO",200,296,0,0,"$(P):ZERO")
#! Field("$(P):ZERO.LNK1",16777215,0,"$(P):ZERO.LNK1")
#! Link("$(P):ZERO.LNK1","$(P):ZEROJ1")
#! Field("$(P):ZERO.LNK2",16777215,1,"$(P):ZERO.LNK2")
#! Link("$(P):ZERO.LNK2","$(P):ZEROJ2")
#! Record("$(P):ZEROJ1",20,22,0,0,"$(P):ZEROJ1")
#! Field("$(P):ZEROJ1.INPA",16777215,1,"$(P):ZEROJ1.INPA")
#! Field("$(P):ZEROJ1.OUT",16777215,1,"$(P):ZEROJ1.OUT")
#! Record("$(P):ZEROJ2",260,22,0,1,"$(P):ZEROJ2")
#! Field("$(P):ZEROJ2.INPA",16777215,1,"$(P):ZEROJ2.INPA")
#! Field("$(P):ZEROJ2.OUT",16777215,1,"$(P):ZEROJ2.OUT")

