Go to the documentation of this file.00001 CLOSE
00002
00003 ;################################################
00004 ;; \file
00005 ;; Define motion for 2 slit Apertures
00006 ;;
00007 ;; Original Author: Tom Cobb
00008 ;;
00009 ;; Defined axes:
00010 ;; - X (addr 6) = centre in same EGUs as aperture
00011 ;; - Y (addr 7) = gap in same EGUs as aperture
00012 ;;
00013 ;; Macros
00014 ;; - COORD = $(COORD) CS number, e.g. 2
00015 ;; - PLC = $(PLC) PLC number, should be CS number+15, e.g. 17
00016 ;; - AP = $(AP) Axisnum for Aperture+ (clips the +ve edge of the beam), e.g. 1
00017 ;; - AM = $(AM) Axisnum for Aperture- (clips the -ve edge of the beam), e.g. 3
00018 ;; - ASIZE = $(ASIZE) Size of Aperture, e.g. 5.85
00019 ;################################################
00020
00021 ; Change to CS$(COORD)
00022 &$(COORD)
00023
00024 ; Set relevant axes to use kinematics
00025 #$(AP)->I ; +ve Aperture
00026 #$(AM)->I ; -ve Aperture
00027
00028 ; These are set by motor_in_cs.template
00029 #define APMOVE P(4700+$(AP))
00030 #define APMRES P(4800+$(AP))
00031 #define APOFF P(4900+$(AP))
00032 #define AMMOVE P(4700+$(AM))
00033 #define AMMRES P(4800+$(AM))
00034 #define AMOFF P(4900+$(AM))
00035
00036 ; Store aperture size
00037 #define ASIZE Q20
00038 ASIZE = $(ASIZE)
00039
00040 ; Calculate gap and centre from aperture positions
00041 #define APPOS (APMRES*P$(AP)+APOFF)
00042 #define AMPOS (AMMRES*P$(AM)+AMOFF)
00043 #define CENTRE Q7
00044 #define GAP Q8
00045 OPEN FORWARD
00046 CLEAR
00047 CENTRE = (APPOS + AMPOS)/2
00048 GAP = ASIZE - AMPOS + APPOS
00049 CLOSE
00050
00051 ; Calculate aperture positions in cts from gap and centre
00052 #define APPOS Q228
00053 #define AMPOS Q229
00054 OPEN INVERSE
00055 CLEAR
00056 ; calculate in EGUs
00057 APPOS = CENTRE - (ASIZE - GAP)/2
00058 AMPOS = CENTRE + (ASIZE - GAP)/2
00059 ; then in cts
00060 P$(AP) = (APPOS - APOFF)/APMRES
00061 P$(AM) = (AMPOS - AMOFF)/AMMRES
00062 CLOSE
00063
00064 ; A PLC(sx+15) needs to be made to do position reporting
00065 ; Readbacks should be in &{axisnum}Q81..89
00066 ; As forward kinematic, but with Px = mx62/(Ix08*32)
00067 #define APPOS (APMRES*m$(AP)62/(I$(AP)08*32)+APOFF)
00068 #define AMPOS (AMMRES*m$(AM)62/(I$(AM)08*32)+AMOFF)
00069 #define CENTRE Q87
00070 #define GAP Q88
00071 OPEN PLC$(PLC)
00072 CLEAR
00073 ADDRESS&$(COORD)
00074 CENTRE = (APPOS + AMPOS)/2
00075 GAP = ASIZE - AMPOS + APPOS
00076 ; If aperture motor record did the last move, set demands = readbacks
00077 if (APMOVE = 1)
00078 or (AMMOVE = 1)
00079 APMOVE = 0
00080 AMMOVE = 0
00081 Q77 = Q87
00082 Q78 = Q88
00083 endif
00084 CLOSE
00085 ENABLE PLC$(PLC)