update motion sync

This commit is contained in:
2018-11-12 15:10:19 +01:00
parent 4927a02706
commit 1e676bcd18
4 changed files with 76 additions and 39 deletions

View File

@@ -1016,7 +1016,41 @@ PB_BSREAD -> sample how to configure user Flags
Gate3[1].Chan[0].UserFlag -> is set to 0 when event triggered (mapped to output FronUnivOut4 in the EVR) Gate3[1].Chan[0].UserFlag -> is set to 0 when event triggered (mapped to output FronUnivOut4 in the EVR)
EVR output powerBrick register $(USR_FLAG_ID)
FrontUnivOut4 Gate3[1].Chan[0].UserFlag 5
FrontUnivOut5 Gate3[1].Chan[1].UserFlag 6
FrontUnivOut6 Gate3[1].Chan[2].UserFlag 7
Event 254 -> Pulser 0 -> FrontUnivOut4 Gate3[1].Chan[0].UserFlag
Event 40 -> Pulser 1 -> FrontUnivOut4 Gate3[1].Chan[1].UserFlag
Event 22 -> Pulser 2 -> FrontUnivOut4 Gate3[1].Chan[2].UserFlag
caput SAR-CVME-TIFALL5-EVG0:SoftEvt-EvtCode-SP 254
Sample test code for sync:
open prog 2
Gate3[0].GpioData[0].16.1=0
linearabs
//X50Y-0
dwell10
while(Gate3[1].Chan[0].UserFlag==0){}
while(1)
{
if(Gate3[1].Chan[1].UserFlag==0)
{
break
}
}
Gather.Enable=2
Gate3[0].GpioData[0].16.1=1
//pvt40abs
//X50:443.604Y-0:0
dwell1000
Gather.Enable=0
close
b2r
``` ```

View File

@@ -60,7 +60,7 @@ file "$(mrfioc2_TEMPLATES=db)/evr-pcie-300DC.db"
Pul0-Name-I="Pulser 0" #Description of the pulser. Maximum 40 characters allowed! Pul0-Name-I="Pulser 0" #Description of the pulser. Maximum 40 characters allowed!
Pul0-Name-I.DESC="Pulse for WSC readout." #Secondary description of the pulser. Maximum 40 characters allowed! Pul0-Name-I.DESC="Pulse for WSC readout." #Secondary description of the pulser. Maximum 40 characters allowed!
Pul0-Ena-Sel=1, #0 = Disabled, 1 = Enabled Pul0-Ena-Sel=1, #0 = Disabled, 1 = Enabled
Pul0-Polarity-Sel=0, #0 = Active High, 1 = Active Low Pul0-Polarity-Sel=1, #0 = Active High, 1 = Active Low
Pul0-Delay-SP=0, #Pulser delay in us (DI 1 event at 5400, need to trigger for bunch at 7500) Pul0-Delay-SP=0, #Pulser delay in us (DI 1 event at 5400, need to trigger for bunch at 7500)
Pul0-Width-SP=5000, #Pulser width in us Pul0-Width-SP=5000, #Pulser width in us
Pul0-Prescaler-SP=1, #0-65535 : Pulser prescaler Pul0-Prescaler-SP=1, #0-65535 : Pulser prescaler
@@ -68,17 +68,17 @@ file "$(mrfioc2_TEMPLATES=db)/evr-pcie-300DC.db"
Pul1-Name-I="Pulser 1" #Description of the pulser. Maximum 40 characters allowed! Pul1-Name-I="Pulser 1" #Description of the pulser. Maximum 40 characters allowed!
Pul1-Name-I.DESC="" #Secondary description of the pulser. Maximum 40 characters allowed! Pul1-Name-I.DESC="" #Secondary description of the pulser. Maximum 40 characters allowed!
Pul1-Ena-Sel=1, #0 = Disabled, 1 = Enabled Pul1-Ena-Sel=1, #0 = Disabled, 1 = Enabled
Pul1-Polarity-Sel=0, #0 = Active High, 1 = Active Low Pul1-Polarity-Sel=1, #0 = Active High, 1 = Active Low
Pul1-Delay-SP=0, #Pulser delay in us Pul1-Delay-SP=0, #Pulser delay in us
Pul1-Width-SP=0, #Pulser width in us Pul1-Width-SP=5000, #Pulser width in us
Pul1-Prescaler-SP=1, #0-65535 : Pulser prescaler Pul1-Prescaler-SP=1, #0-65535 : Pulser prescaler
Pul2-Name-I="Pulser 2" #Description of the pulser. Maximum 40 characters allowed! Pul2-Name-I="Pulser 2" #Description of the pulser. Maximum 40 characters allowed!
Pul2-Name-I.DESC="" #Secondary description of the pulser. Maximum 40 characters allowed! Pul2-Name-I.DESC="" #Secondary description of the pulser. Maximum 40 characters allowed!
Pul2-Ena-Sel=1, #0 = Disabled, 1 = Enabled Pul2-Ena-Sel=1, #0 = Disabled, 1 = Enabled
Pul2-Polarity-Sel=0, #0 = Active High, 1 = Active Low Pul2-Polarity-Sel=1, #0 = Active High, 1 = Active Low
Pul2-Delay-SP=0, #Pulser delay in us Pul2-Delay-SP=0, #Pulser delay in us
Pul2-Width-SP=0, #Pulser width in us Pul2-Width-SP=5000, #Pulser width in us
Pul2-Prescaler-SP=1, #0-65535 : Pulser prescaler Pul2-Prescaler-SP=1, #0-65535 : Pulser prescaler
Pul3-Name-I="Pulser 3" #Description of the pulser. Maximum 40 characters allowed! Pul3-Name-I="Pulser 3" #Description of the pulser. Maximum 40 characters allowed!
@@ -404,9 +404,9 @@ pattern { EVT, FUNC }
# #
file "$(mrfioc2_TEMPLATES=db)/evr-pulserMap.template"{ file "$(mrfioc2_TEMPLATES=db)/evr-pulserMap.template"{
pattern {PID F, EVT, ID} pattern {PID F, EVT, ID}
{0, Trig, 22, 0 } # ESA laser diag-1 {0, Trig, 254, 0 } # ESB JF-Start
{1, Trig, 0, 0 } {1, Trig, 40, 0 } # ESB JF-Acquire frame
{2, Trig, 0, 0 } {2, Trig, 22, 0 } # ESA laser diag-1
{3, Trig, 0, 0 } {3, Trig, 0, 0 }
{4, Trig, 0, 0 } {4, Trig, 0, 0 }
{5, Trig, 0, 0 } {5, Trig, 0, 0 }

View File

@@ -95,23 +95,24 @@ close
# - waits raising edge of <flag> and the sets DesTimeBase=ServoPeriod # - waits raising edge of <flag> and the sets DesTimeBase=ServoPeriod
# flag ='PowerBrick[0].GpioData[0].0.1==1' # flag ='PowerBrick[0].GpioData[0].0.1==1'
flag = 'Gate3[1].Chan[0].UserFlag==0' flag0 = 'Gate3[1].Chan[0].UserFlag==0'
flag1 = 'Gate3[1].Chan[1].UserFlag==0'
prg = ''' prg = '''
//L0=Sys.PhaseCount //L0=Sys.PhaseCount
//send 1"sync0 %d:%d\\n",Sys.PhaseCount,Sys.PhaseCount-L0 //send 1"sync0 %d:%d\\n",Sys.PhaseCount,Sys.PhaseCount-L0
while({flag}){{}} while({flag0}){{}}
//send 1"sync1 %d:%d\\n",Sys.PhaseCount,Sys.PhaseCount-L0 //send 1"sync1 %d:%d\\n",Sys.PhaseCount,Sys.PhaseCount-L0
//L1=Sys.PhaseCount //L1=Sys.PhaseCount
while(1) while(1)
{{ {{
if({flag}) if({flag1})
{{ {{
//PowerBrick[0].GpioData[0].16.8=255 //PowerBrick[0].GpioData[0].16.8=255
//send 1"sync2 %d:%d\\n",Sys.PhaseCount,Sys.PhaseCount-L1 //send 1"sync2 %d:%d\\n",Sys.PhaseCount,Sys.PhaseCount-L1
break break
}} }}
}} }}
'''.format(plcId=plcId, crdId=crdId, flag=flag) '''.format(plcId=plcId, crdId=crdId, flag0=flag0, flag1=flag1)
self.sync_prg = prg self.sync_prg = prg
self.sync_run = '&{crdId}b{prgId}r'''.format(prgId=prgId, plcId=plcId, crdId=crdId) self.sync_run = '&{crdId}b{prgId}r'''.format(prgId=prgId, plcId=plcId, crdId=crdId)

View File

@@ -142,7 +142,8 @@ class ShapePath(MotionBase):
comm=self.comm comm=self.comm
gt=self.gather gt=self.gather
gt.set_phasemode(False) gt.set_phasemode(False)
gt.set_address("Motor[3].ActPos","Motor[2].ActPos","Motor[1].ActPos","Motor[3].DesPos","Motor[2].DesPos","Motor[1].DesPos") #gt.set_address("Motor[3].ActPos","Motor[2].ActPos","Motor[1].ActPos","Motor[3].DesPos","Motor[2].DesPos","Motor[1].DesPos")
gt.set_address("Motor[3].ActPos","Motor[2].ActPos","Motor[1].ActPos","Motor[3].DesPos","Motor[2].DesPos","Motor[1].DesPos","Gate3[1].Chan[1].UserFlag")
gt.set_property(MaxSamples=1000000, Period=acq_per) gt.set_property(MaxSamples=1000000, Period=acq_per)
ServoPeriod= .2 #0.2ms #Sys.ServoPeriod is dependent of !common() macro ServoPeriod= .2 #0.2ms #Sys.ServoPeriod is dependent of !common() macro
#ServoPeriod=comm.gpascii.servo_period #ServoPeriod=comm.gpascii.servo_period
@@ -555,7 +556,8 @@ if __name__=='__main__':
sp.setup_gather(acq_per=2) sp.setup_gather(acq_per=2)
#setup_sync(self, crdId=1, prgId=2, plcId=2, mode=0, **kwargs): #setup_sync(self, crdId=1, prgId=2, plcId=2, mode=0, **kwargs):
sp.setup_sync() #no sync at all sp.setup_sync() #no sync at all
#sp.setup_sync(mode=1) #sync with timing system #sp.setup_sync(mode=1) #sync with timing system (PLC)
sp.setup_sync(mode=2) #sync with timing system (PROG)
#sp.gen_grid_points(w=2,h=2,pitch=50,rnd=.2);sp.sort_points(xy);sp.setup_motion(fnPrg=fn+'.prg',mode=1,pt2pt_time=10,acq_per=1) #sp.gen_grid_points(w=2,h=2,pitch=50,rnd=.2);sp.sort_points(xy);sp.setup_motion(fnPrg=fn+'.prg',mode=1,pt2pt_time=10,acq_per=1)
sp.gen_swissmx_points(scale=10);sp.setup_motion(fnPrg=fn+'.prg',mode=1,pt2pt_time=40,acq_per=1) sp.gen_swissmx_points(scale=10);sp.setup_motion(fnPrg=fn+'.prg',mode=1,pt2pt_time=40,acq_per=1)