diff --git a/llrfsystem/llrfsystemApp/Db/sp-ramping.template b/llrfsystem/llrfsystemApp/Db/sp-ramping.template
index 43df0ef2352b4ec29a9bb648ae492af7addf4ede..0706c83042446c1cac865ef59dbda54b7bcc5bb9 100644
--- a/llrfsystem/llrfsystemApp/Db/sp-ramping.template
+++ b/llrfsystem/llrfsystemApp/Db/sp-ramping.template
@@ -106,6 +106,18 @@ record(ao, "$(P)$(R)SPRampingPhase"){
     info(ARCHIVE_THIS, "")
 }
 
+# Delay
+record(ao, "$(P)$(R)SPRampingDelay"){
+    field(DESC, "SP lag time")
+    field(PREC, "3")
+    field(EGU,  "ms")
+
+    info(DESCRIPTION, "SP lag time")
+    info(autosaveFields, "VAL")
+    info(SAVRES_THIS, "")
+    info(ARCHIVE_THIS, "")
+}
+
 # Calculate size of table needed to cover whole RF pulse. Same
 #  table length is then used for amplitude and phase tables
 record(calc, "$(P)$(R)#SPRampingTabS") {
@@ -124,21 +136,20 @@ record(aSub, "$(P)$(R)#SPRamping") {
     field(SNAM, "sp_ramping")
     
     field(INPA, "$(P)$(R)SPRampingEn")
-    field(FTA, "SHORT")
+    field(FTA,  "SHORT")
     field(INPB, "$(PD)$(RD)SPTbl-Mag.NORD") # Size of magnitude array
-    field(FTB, "LONG")
+    field(FTB,  "LONG")
 
     field(INPC, "$(P)$(R)FreqSampling")
     field(INPD, "$(PD)$(RD)IQSmpNearIQ-N-RB")
     field(INPE, "$(P)$(R)#SPRampingTabS CP")
-    field(FTE, "LONG")
+    field(FTE,  "LONG")
 
     field(INPF, "$(P)$(R)SPRampingTfill CP")
     field(INPG, "$(P)$(R)SPRampingTao CP")
     field(INPH, "$(P)$(R)SPRampingA CP")
-
-    # To trigger record:
     field(INPI, "$(P)$(R)SPRampingPhase CP")
+    field(INPJ, "$(P)$(R)SPRampingDelay CP")
 
     # Magnitude Array
     field(FTVA, "DOUBLE")
diff --git a/llrfsystem/llrfsystemApp/src/pulse_gen.c b/llrfsystem/llrfsystemApp/src/pulse_gen.c
index b7760f7ebd041a87558a346d338ca12fb95c8c0b..4860d243be6f3e5a946bbfb866829ee47500dc40 100644
--- a/llrfsystem/llrfsystemApp/src/pulse_gen.c
+++ b/llrfsystem/llrfsystemApp/src/pulse_gen.c
@@ -202,13 +202,14 @@ static long pulse_gen(aSubRecord *psr){
  * Parameters:
  * A: Enable
  * B: Old table size
- * C: Sampling rate
+ * C: Sampling rate (MHz)
  * D: Near IQ N
  * E: Table size
- * F: Filling time
- * G: Tao
+ * F: Filling time (ms)
+ * G: Tao (ms)
  * H: Pulse power
  * I: Phase value
+ * J: Delay (ms)
  *
  * Output:
  * A: SP Magnitude waveform
@@ -220,10 +221,11 @@ static long sp_ramping(aSubRecord *psr){
     double const fsampling     =  *((double*) psr->c);
     double const IQN           =  *((double*) psr->d);
     long   const table_size    =  *((long*)   psr->e);
-    double const Tfill         = (*((double*) psr->f))*1e3;
-    double const tao           =  *((double*) psr->g);
+    double const Tfill         = (*((double*) psr->f))*1e3; // us
+    double const tao           = (*((double*) psr->g))*1e3; // us
     double const P             =  *((double*) psr->h);
     double const phase_value   =  *((double*) psr->i);
+    double const Tdelay        = (*((double*) psr->j))*1e3; // us
 
     // If generation not enabled, don't touch table.
     if(gen_enabled == 0) {
@@ -242,26 +244,35 @@ static long sp_ramping(aSubRecord *psr){
 
     // Calculate end point for filling time
     // overrun with table size
+    long delay_samples = Tdelay * sampling_rate;
+    long ramp_samples = Tfill * sampling_rate;
+    long tao_samples = tao * sampling_rate;
 
-    long i_end_fill  = (long)((Tfill) * sampling_rate);
-    if(i_end_fill > table_size) i_end_fill = table_size;
+    long i_end_fill = delay_samples + ramp_samples;
+    if (i_end_fill > table_size) i_end_fill = table_size;
 
     long i = 0;
     double * mag = (double*)psr->vala;
     double * ang = (double*)psr->valb;
     double t;
 
+    double fill_ratio = 1 / (1 - exp((double)(-ramp_samples)/tao_samples));
+
+    // Fill magnitude with zeros for Tdelay
+    for (i = 0; i < delay_samples; i++) {
+        mag[i] = 0;
+    }
     // Fill magnitude with slope up to P in Tfill
-    for (i = 0; i < i_end_fill; i++) {
-        t = (i/sampling_rate)/1e3; 
-        mag[i] = P*(1-exp(-t/tao));
+    for (i = delay_samples; i < i_end_fill; i++) {
+        t = i - delay_samples;
+        mag[i] = fill_ratio*P*(1 - exp(-t/tao_samples));
     }
     // Fill magnitude with constant power P in pulse
     for (i = i_end_fill; i < table_size; i++) {
         mag[i] = P;
     }
     // Set the last point to P to avoid that the filling power
-    //  is set along the full pulse should the table be too short
+    // is set along the full pulse should the table be too short
     mag[table_size - 1] = P;
 
     // Fill phase table with the given constant value