//Set the R18 pulses from the Spin Rate

if (srate > 500) then 
   $pwHr18 = 2.0e6/(9.0*srate)
   pwHr18 = 0.1*trunc($pwHr18/0.1 + 0.5)
   srate = 2.0e6/(9.0*pwHr18)
   aHr18 = aH90*(4.0*pwH90)/pwHr18
   if (aHr18 = 4095) then 
      write('error','reset_r18 Error: aHr18 is >= to 4095')
   endif
endif

if (qHr18 < 2) then qHr18 = 2 endif

//Synchronize the PRESTO CP Times with even rotor periods

aXhxpto3 = aX90
pw1Xhxpto3 = pwX90
pw2Xhxpto3 = 2.0*pwX90
t1HXpto3 = 9.0*pwHr18*trunc(t1HXpto3/(9.0*pwHr18) + 0.5)
t2HXpto3 = 9.0*pwHr18*trunc(t2HXpto3/(9.0*pwHr18) + 0.5)














