Go to the documentation of this file.00001 CLOSE
00002
00003 ;##################################################################
00004 ;; \file
00005 ;; Define motion for 2 slit blades driven by one axis that moves them both to
00006 ;; adjust the position, and another that moves only one to adjust the gap.
00007 ;;
00008 ;; Original Author: Emma Shepherd
00009 ;;
00010 ;; Defined axes:
00011 ;; - X (addr 6) = centre in same EGUs as blade
00012 ;; - Y (addr 7) = size in same EGUs as blade
00013 ;;
00014 ;; Macros:
00015 ;; - COORD = $(COORD) CS number, e.g. 2
00016 ;; - PLC = $(PLC) PLC number, should be CS number+15, e.g. 17
00017 ;; - CENT = $(CENT) Axisnum for centre motor, e.g. 1
00018 ;; - GAP = $(GAP) Axisnum for gap motor, e.g. 3
00019 ;; - DIR = $(DIR) Set to 1 if aperture is opened by driving positively,
00020 ;; - and -1 if negatively.
00021 ;##################################################################
00022
00023 ; Change to CS$(COORD)
00024 &$(COORD)
00025
00026 ; Set relevant axes to use kinematics
00027 #$(CENT)->I ; centre motor
00028 #$(GAP)->I ; gap motor
00029
00030 ; These are set by motor_in_cs.template
00031 #define CENTMOVE P(4700+$(CENT))
00032 #define CENTMRES P(4800+$(CENT))
00033 #define CENTOFF P(4900+$(CENT))
00034 #define GAPMOVE P(4700+$(GAP))
00035 #define GAPMRES P(4800+$(GAP))
00036 #define GAPOFF P(4900+$(GAP))
00037
00038 ; Direction
00039 #define DIRECTION Q20
00040 DIRECTION = $(DIR)
00041
00042 ; Calculate tool-tip centre position (gap is obtained directly from motor readback)
00043 #define CENTPOS (CENTMRES*P$(CENT)+CENTOFF)
00044 #define GAPPOS (GAPMRES*P$(GAP)+GAPOFF)
00045 #define CENTCS Q7
00046 #define GAPCS Q8
00047 OPEN FORWARD
00048 CLEAR
00049 CENTCS = CENTPOS + GAPPOS/2
00050 GAPCS = DIRECTION*GAPPOS
00051 CLOSE
00052
00053 ; Calculate centre motor position from tool-tip co-ordinates
00054 #define CENTPOS Q228
00055 #define GAPPOS Q229
00056 OPEN INVERSE
00057 CLEAR
00058 ; calculate motor positions in EGUs
00059 CENTPOS = CENTCS-DIRECTION*GAPCS/2
00060 GAPPOS = DIRECTION*GAPCS
00061 ; then in cts
00062 P$(CENT)=(CENTPOS-CENTOFF)/CENTMRES
00063 P$(GAP)=(GAPPOS-GAPOFF)/GAPMRES
00064 CLOSE
00065
00066 ; A PLC(sx+15) needs to be made to do position reporting
00067 ; Readbacks should be in &{axisnum}Q81..89
00068 ; As forward kinematic, but with Px = mx62/(Ix08*32)
00069 #define CENTPOS (CENTMRES*m$(CENT)62/(I$(CENT)08*32)+CENTOFF)
00070 #define GAPPOS (GAPMRES*m$(GAP)62/(I$(GAP)08*32)+GAPOFF)
00071 #define CENTCS Q87
00072 #define GAPCS Q88
00073 OPEN PLC$(PLC)
00074 CLEAR
00075 ADDRESS&$(COORD)
00076 CENTCS = CENTPOS + GAPPOS/2
00077 GAPCS = DIRECTION*GAPPOS
00078 ; If raw motor record did the last move, set demands = readbacks
00079 if (CENTMOVE = 1)
00080 or (GAPMOVE = 1)
00081 CENTMOVE = 0
00082 GAPMOVE = 0
00083 Q77 = Q87
00084 Q78 = Q88
00085 endif
00086 CLOSE
00087 ENABLE PLC$(PLC)