CS_blade_slits.pmc

Go to the documentation of this file.
00001 CLOSE
00002 
00003 ;################################################
00004 ;; \file
00005 ;; Define motion for 2 slit blades
00006 ;;
00007 ;; Original Author: Tom Cobb
00008 ;;
00009 ;; Defined axes:
00010 ;; - X (addr 6) = centre in same EGUs as blade
00011 ;; - Y (addr 7) = gap in same EGUs as blade
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 ;; - BP = $(BP)  Axisnum for Blade+, e.g. 1
00017 ;; - BM = $(BM)  Axisnum for Blade-, e.g. 3
00018 ;################################################
00019 
00020 ; Change to CS$(COORD)
00021 &$(COORD)
00022 
00023 ; Set relevant axes to use kinematics
00024 #$(BP)->I ; +ve blade
00025 #$(BM)->I ; -ve blade
00026 
00027 ; These are set by motor_in_cs.template
00028 #define BPMOVE P(4700+$(BP))
00029 #define BPMRES P(4800+$(BP))
00030 #define BPOFF  P(4900+$(BP))
00031 #define BMMOVE P(4700+$(BM))
00032 #define BMMRES P(4800+$(BM))
00033 #define BMOFF  P(4900+$(BM))
00034 
00035 ; Calculate gap and centre from blade positions
00036 #define BPPOS (BPMRES*P$(BP)+BPOFF)
00037 #define BMPOS (BMMRES*P$(BM)+BMOFF)
00038 #define CENTRE Q7
00039 #define GAP Q8
00040 OPEN FORWARD
00041 CLEAR
00042     CENTRE = (BPPOS + BMPOS)/2
00043     GAP = BPPOS - BMPOS
00044 CLOSE
00045 
00046 ; Calculate blade positions in cts from gap and centre
00047 #define BPPOS Q228
00048 #define BMPOS Q229
00049 OPEN INVERSE
00050 CLEAR
00051     ; calculate in EGUs
00052     BPPOS = CENTRE + GAP/2
00053     BMPOS = CENTRE - GAP/2
00054     ; then in cts
00055     P$(BP) = (BPPOS - BPOFF)/BPMRES
00056     P$(BM) = (BMPOS - BMOFF)/BMMRES
00057 CLOSE
00058 
00059 ; A PLC(sx+15) needs to be made to do position reporting
00060 ; Readbacks should be in &{axisnum}Q81..89
00061 ; As forward kinematic, but with Px = mx62/(Ix08*32)
00062 #define BPPOS (BPMRES*m$(BP)62/(I$(BP)08*32)+BPOFF)
00063 #define BMPOS (BMMRES*m$(BM)62/(I$(BM)08*32)+BMOFF)
00064 #define CENTRE Q87
00065 #define GAP Q88
00066 OPEN PLC$(PLC)
00067 CLEAR
00068     ADDRESS&$(COORD)
00069     CENTRE = (BPPOS + BMPOS)/2
00070     GAP = BPPOS - BMPOS
00071     ; If blade motor record did the last move, set demands = readbacks
00072     if (BPMOVE = 1)
00073     or (BMMOVE = 1)
00074         BPMOVE = 0
00075         BMMOVE = 0
00076         Q77 = Q87
00077         Q78 = Q88
00078     endif
00079 CLOSE
00080 ENABLE PLC$(PLC)
 All Classes Files Functions Variables Typedefs Defines