Hi Steph and Kukhee,

I am not clear on how to setup my EVR substitution.
I really need to master this now. 
I want to understand how this is intended to work not just copy and paste  :-)

I am using a PMC-based EVR and following the README.
So, I am using XL05  as my example.

Here is where, I am lost  "evrXL05.substitutions"
Located on lcls-dev2 here:
/afs/slac/g/lcls/epics/modules/R3-14-12/event/event-R3-2-2-br_generaltime-2-1/evrIoc/Db

**************************************************************************************************************
First, please confirm the basics for properties/settings of trigger outputs.
Okay, all properties are inside the EPICS EVR record (er), correct?
The record name is like so, <prefixNAME>:CTRL

(1) Each trigger can have the following properties:
     (a) DELAY (in ticks), where 1 tick = 8.4 nsec (are min/max values inside the "er" record)
           min = 0 ticks,  max = 65535 ticks
     (b) WIDTH  (in ticks),  (are min/max values inside the "er" record)
           min = ? ticks,  max = ? ticks
     (c) POLARITY ?? (I don't see a macro for this in the substitution file)
           Or is Polarity only for front panel triggers in the extended delay mode?
           Shouldn't every trigger have a polarity?
     (d) STATE
(2) Extended Delay feature is only available for front panel triggers.  So, why
     are there these two templates instead of one?
     "evrWithExtDelays.db" and  "evrWithFrontPanel.db"
     Does it mean I can use front panel triggers without extended delays?
     If I need to use front panel triggers with normal triggers, then I must use
     "evrWithFrontPanel.db" ?
     If I am only, using a PMC-based EVR, what do I put for the "FP3" macro ?
      The "evrWithExtDelays.db" does not cover the case of 4 front panel
      triggers for VME?
     "Additional" properties for triggers with extended delay:
        (a) Clock prescaler  (What does this mean and how do I use it?)
        (b) Pulse width in ticks
        (c) Delay in ticks
        (d) Polarity
(3) What values do FP0 ... FP3 take on?  What do the values mean?
      I don't understand the numbers that are filled in for  "evrXL05.substitutions"
(4) There are most likely a lot more properties in that "er" record. I only want to
      understand how to use the ones needed by the user (IOC engineer, and operator)

In the scenarios, below I am only referring to one PMC-based EVR.
Hence, I hope $CARD is just equal zero
So, my scenarios/questions are as follows:

=========================================================================
Scenario #1: 
I only have 3 triggers coming out of the front and I don't add an RTM
to pick up the remaining triggers.
Here is an example, where I have installed the evr card into a linux-based PC:
In this scenario, I want to trigger three independent cameras, where FP = Front Panel trigger:
FP-0: camera 1
FP-1: camera 2
FP-2: camera 3
How must I modify  "evrXL05.substitutions" ?
Also, explain extended delays versus non-extended delays as well
=========================================================

========================================================
Scenario #2: 
I want to use 3 triggers coming out of the front panel and I add an RTM
to pick up the remaining triggers.  In this scenario; I have 3 cameras,
3 laser power meters, and 8 faraday cups, where FP = Front Panel trigger
and RP = Rear Panel trigger on the RTM:
FP-0: camera 1
FP-1: camera 2
FP-2: camera 3
RP-0: Not Used (since it is shared with FP-0)  Basically, it is indeed the same signal, right?
RP-1: Not Used (since it is shared with FP-1)  Basically, it is indeed the same signal, right?
RP-2: Not Used (since it is shared with FP-2)  Basically, it is indeed the same signal, right?
RP-3: Laser Power Meter 1
RP-4: Laser Power Meter 2
RP-5: Laser Power Meter 3
RP-6: Faraday Cup 1
*
*
RP-13: Faraday Cup 8

How must I modify  "evrXL05.substitutions" ?
Also, explain extended delays versus non-extended delays as well
=========================================================



========================================================
Scenario #3:
In this scenario, I like to route all of my cables from the rear of the crate.
Some engineers don't like cables coming out of the front of the crate.
For microTCA, the main idea is to use the rear of the shelf as much as possible.
So, here we go: 
I add an RTM and again I need 14 triggers as shown below:
3 cameras, 3 laser power meters, and 8 faraday cups, where FP = Front Panel trigger
and RP = Rear Panel trigger on the RTM:
FP-0: Not Used because I don't like cables coming from the front of my crate. :)
FP-1: Not Used because I don't like cables coming from the front of my crate. :)
FP-2: Not Used because I don't like cables coming from the front of my crate. :)
RP-0: camera 1
RP-1: camera 2
RP-2: camera 3
RP-3: Laser Power Meter 1
RP-4: Laser Power Meter 2
RP-5: Laser Power Meter 3
RP-6: Faraday Cup 1
*
*
RP-13: Faraday Cup 8

How must I modify  "evrXL05.substitutions" ?
Also, explain extended delays versus non-extended delays as well
=========================================================

Of course, there may be some other scenarios but this will get me going.

For each, trigger output I want to set the properties/settings in my substitution file so that I have
the desired default for my hardware. 
If users change the properties/settings, I want to use autosave/restore to recover them

Finally,  I hope the questions and answers to all of this can be turned into a WIKI Doc for all to use and understand.
We have new people now and I think this will be helpful for everyone.
I definitely, need to start improving my understanding the timing system.  :)

Thanks in advanced for your help. 
I need to get the EVR setup for the Camera in XTA as well as
for the BeamDiagnostic Test Lab in Building B685 for Joe Frsich.


Most likely, I will have additional questions as I get into EVENTS/Patterns
and BSA.
For now, I want to focus on the EVR hardware layer.

Some block database block diagrams describing the relationship between
(1) evrXL05.substitutions
(2) trigXL05.substitutions
(3) evrPatternXL05.substitutions
(4) bsaXL05.substitutions


What is the layman's definition of pattern?
Do the patterns come from the MPG?
Which is now part of the new EVG, yeah!!  :)
Okay, can someone give us a few example patterns in english?
No assembly language and bit patterns please.



file evr.db
{
#                               Default Pulse
#      Device         Card   Delay   Width (clock ticks)   
pattern { DEV          , CARD , DELAY , WIDTH}
    { EVR:XL05:EV01,  0   ,   8   ,  12  }
}
file evrWithFrontPanel.db
{
#                               Default Pulse
#      Device         Card   Delay   Width (clock ticks)   
pattern { DEV          , CARD , DELAY , WIDTH , FP0 , FP1 , FP2 , FP3 }
    { EVR:XL05:EV02,  1   ,   8   ,  12   ,  0  ,  1  ,  22 , 23  }
}
file evrWithExtDelays.db
{
#                               Default Pulse
#      Device         Card   Delay   Width (clock ticks)   
pattern { DEV          , CARD , DELAY , WIDTH , STATE  , DG0W , DG0D , DG0C , DG0P , DG1W , DG1D , DG1C , DG1P , DG2W , DG2D , DG2C , DG2P }
    { EVR:XL05:EV03,  2   ,   8   ,  12   , Enabled,  13  ,100000,  1   ,Inverted,14  ,100000,  1   ,Normal, 10   , 100  ,  119 ,Normal}
}

