;-------------------------------------------------------- ; L I S T ; ; S A C T R A C K S E Q U E N C E ;-------------------------------------------------------- ;Cannot exceed 1023 lines of instructions. ; SET 0.010 2 0 ;0.01 milliseconds per tick ;+/-10 volts ;0 degree offset; TABSZ 150000 ;set maximum table space ;DELAY command is based on the 100 microsecond clock ticks specified above ;TICKS command is based on the ADC sampling clock rate subject to num channels ;VAR V1 ;RE-USABLE variables for use only within mode subroutines ;VAR V2 ;these variables should not pass parameters between ;VAR V3 ;modes or subroutines ;VAR V4 ;VAR V5 ;VAR V6 ;VAR V7 ;VAR V8 ;VAR V9 ;VAR V10 ;VAR V11 ;VAR V12, ;VAR V13, ;VAR V14, ;VAR V15, ;VAR V16, ;VAR V17, ;VAR V18, VAR V19,TEMP1 ;MODE SUBROUTINE variable VAR V20,TEMP3 ;Accel Decel Adapt routines VAR V21,TEMP4 ;Accel Decel routines VAR V22,TEMP2 ;VAR V23, ;VAR V24, ;VAR V25, ;VAR V26, ;----------------------------------------------------------- ;above variables are zeroed every time a new mode is entered ;----------------------------------------------------------- VAR V27,ELAPSED=0 ;when OT testing began VAR V28,TIMECURR ;current SPIKE2 time VAR V29,TIMECHEK ;when to check if it is time to move VAR V30,TIMEFEED VAR V31,TEMPTRAK ;OT testing (convert to TABLE field?) VAR V32,TEMPWIND VAR V33,LEDBRD1 ;indicate which LED board (RED) VAR V34,LEDADD1 ;indicate which LED light (RED) VAR V35,LEDBRD2 ;indicate which LED board (GRN) VAR V36,LEDADD2 ;indicate which LED light (GRN) VAR V37,TRACKING ;is he tracking VAR V38,HITTYPE1 ;times all loc shown or step, non-adapt, etc shown VAR V39,HITTYPE2 ;times step-ramp, adapt shown VAR V40,ZERO=0 ;for many branching comparisons VAR V41,NAN=999999999 ;represents "not a number" VAR V42,SHUT1=1 ;primary shutter (normally open) VAR V43,SHUT2=0 ;secondary shutter (normally close) VAR V44,HE ;eye vertical position VAR V45,VE ;eye horizontal position VAR V46,HT2 ;target-2 horizontal position VAR V47,VT2 ;target-2 vertical position VAR V48,HT1 ;target-1 horizontal position VAR V49,VT1 ;target-1 vertical position VAR V50,DURFORG ;how long he has been forgiven VAR V51,DURFEED=0 ;duration he has been on-target before getting fed VAR V52,DURCONT=0 ;contiguously on-target VAR V53,DURON=0 ;total time on-target VAR V54,PARAMCHG=0 ;signals parameters changed -- VAR V55,SUCCESS ;comlete the task? ;we test the Digitial Input so the following VAR is reserved ;VAR V56 ;Collision and Mayhem ;we have DAC 0,1,2,3 so the following VAR are reserved ;V57, last DAC 0 value ;won't work ;V58, last DAC 1 value ;with galvo ;V59, last DAC 2 value ;V60, last DAC 3 value ;we don't have DAC 4,5,6,7 so ok to use the following VAR VAR V61,TEMPTIME ;time counter variable ;VAR V62, VAR V63,SBUFFER=1 ;which serial buffer to use 1 or 2 (must start with 1) VAR V64,FORGIVE=0 ;forgiveness ;the data table transfered to the sequencer ;0000 - 0999 Common parameters ;[00] := gWindowHvgDAC%; HWIND ;[01] := gWindowVvgDAC%; VWIND ;[09] := pFeedRate%; FEEDRATE ;[10] := pRealMinTime*1000; ASSOONAS ;[11] := pRealMaxTime*1000; NOLATER ;[12] := pRealContiguousTime*1000; CONTTON ;[13] := pRealTimeOn*1000; TOTALTON ;[14] := pOnFirst*1000; DURFIRST ;[15] := pOnSubsequent*1000; DURSUB ;[16] := pForgiveness*1000; FORGTIME ;[30] := gWhichBooth ;[31] := update report window info ;1000 - and above = for passing Table parmeters related to this behavioral mode ;-------------------------------------------------------- ; I N I T I A L I Z E L E D A R R A Y ;Initialize the LED array so buffer #1 will be active first. ;3/19/03 ;-------------------------------------------------------- DIGLOW [10101111] ;1-AF CLEAR all boards DELAY 12 ;13-120 microsecond delay DIGLOW [10111111] ;14-BF INTENSITY all boards DELAY 12 ;27-120 microsecond delay CALL BRITE DIGLOW [10001111] ;43-8F send to all boards, #1 buffer MOVI SBUFFER,2 ;44-prepare to use the other buffer next time TICKS TIMECURR ;set this up just so the IDLE routine will get started TICKS TIMECHEK,msTick(1) ;1ms, 0.001s later CRATE HZ(0) ;stop the ch 0 sinewave if it is running DRATE HZ(0) ;stop the ch 1 sinewave if it is running DIGOUT [....1...] ;low de-activates the SONALERT MOVI SHUT1,1 ;open the primary shutter MOVI SHUT2,0 ;close the secondary shutter CALL SHUTTER ;-------------------------------------------------------- ; M A I N ;Directs program control to the mode of choice. ;10/11/04 ;-------------------------------------------------------- MAIN: CALL BRITE MOVI ELAPSED,0 MOVI DURCONT,0 ;reset accumulators MOVI DURON,0 MOVI DURFORG,0 ;reset forgiveness timer ;-------------------------------------------------------- ; L I S T ;Moves the target on vectors defined by the user. ;Stays here until SQMODE contains to a value other than 2 ;which represents LIST. ; ;Variables: ; V1 = table data address pointer ; V2 = table data holder ; V3 = RTZ status ; V4 = RTZ stim percent ; V5 = count how many locations have been shown ; V6 = ; V7 = number of locations in the table ; V8 = horizontal DAC value with offset for zero ; V9 = vertical DAC value with offfset for zero ; ; TEMP1 = holds constant values ; ; HITTYPE1 = how many times the entire table of data has been presented ; MYREPORT = signals when it is time to report new data to the user ; ;Table Data Map: ; 1000 = number of points to display ; 1001 = RTZ active and last position (-1=inactive, 0=last was zero, 1=last was not zero) ; A+2 = ; A+3 = Onset Velocity Threshold ; A+4 = Offset Velocity Threshold ; A+5 = Blanking Duration ; 1006 = horizontal DAC value with offset for zero ; 1007 = vertical DAC value with offfset for zero ; ;target info stored in array at A=1010,1020,1030,1040... ; A+0 = location USED ; A+1 = X galvo d/a value (primary) ; A+2 = Y galvo d/a value (primary) ; A+3 = LED board number (primary) ; A+4 = LED address (primary) ; ;9/13/04 ;-------------------------------------------------------- LIST: BEQ PARAMCHG,0,LIST ;wait for parameters to arrive BEQ PARAMCHG,2,LIST97 ;skip if not the first time through MOVI PARAMCHG,2 ;new parameters grabbed CALL ZEROVAR ;clear all the re-usable VAR ;MOVI V2,1 ;so it will update report first time through ;TABST V2,[ZERO+31] MOVI V1,1000 ;parameter pointer TABLD V8,[V1+6] ;horizontal DAC value with offset for zero TABLD V9,[V1+7] ;vertical DAC value with offfset for zero MOVI V3,2000 ;for reading commands, first location ADDI V3,-1 ;get ready to load first command ;MARK 18 ;"12" ;present another trial LIST97: ADDI V3,1 ;INC pointer TABLD V15,[V3] ;MARK 19 ;"13" BEQ V15,1,LIST1 BEQ V15,2,LIST2 BEQ V15,3,LIST3 BEQ V15,4,LIST4 BEQ V15,5,LIST5 BEQ V15,6,LIST6 BEQ V15,7,LIST7 BEQ V15,8,LIST8 BEQ V15,9,LIST9 BEQ V15,10,LIST10 BEQ V15,999999997,LIST97 ;EndOfCommand, skip it, to visually delimit the list BEQ V15,999999998,LIST98 ;EndOfTrial ;invalid commands and EndOfList(999999999) processed here MOVI PARAMCHG,1 ;force it to reset V3,2000 and start at beginning of list JUMP LIST ;kAbsRad1 ;-------------------- LIST1: CALL OTTEST ;read target and eye values then compare (takes < 0.24 ms) BLT TRACKING,2,LIST1a ;confirm both H & V are on target MOVI FORGIVE,1 ;target is going to move, forgive him for being off targ LIST1A: ADDI V3,1 ;INC pointer MARK 1 ;SAVE - an initial target step has occured DAC 0,[V3] ;move to the next target location ADDI V3,1 ;INC pointer DAC 1,[V3] ;move to the next target location ADDI V3,1 ;INC pointer TABLD LEDBRD1,[V3] ;LED board ADDI V3,1 ;INC pointer TABLD LEDADD1,[V3] ;LED address CALL LEDS ;display the LEDs JUMP LIST97 ;get another command ;kAbsRad2 ;-------------------- LIST2: ADDI V3,1 ;INC pointer DAC 2,[V3] ;move to the next target location ADDI V3,1 ;INC pointer DAC 3,[V3] ;move to the next target location ADDI V3,1 ;INC pointer TABLD LEDBRD2,[V3] ;LED board ADDI V3,1 ;INC pointer TABLD LEDADD2,[V3] ;LED address CALL LEDS ;display the LEDs JUMP LIST97 ;get another command ;kShutter1 ;-------------------- LIST3: ADDI V3,1 TABLD SHUT1,[V3] ;get state for the primary shutter CALL SHUTTER1 ;set the primary shutter JUMP LIST97 ;get another command ;kShutter2 ;-------------------- LIST4: ADDI V3,1 TABLD SHUT2,[V3] ;get state for the secondary shutter CALL SHUTTER2 ;set the secondar shutter JUMP LIST97 ;get another command ;kOnTargetDetect ;-------------------- LIST5: ADDI V3,1 ;INC pointer TABLD TEMPTIME,[V3] ;pass the duration MULI TEMPTIME,msTick(1) ;convert from ms to ticks CALL ARRIVE ;allow up to one second to get on target ;BEQ TRACKING,2,ADAPT133 ;start next trial when both H & V are on Pri target JUMP LIST97 ;get another command ;kOnTargetDuration ;-------------------- LIST6: ADDI V3,1 TABLD TEMPTIME,[V3] ;pass the duration MULI TEMPTIME,msTick(1) ;convert from ms to ticks CALL ARRIVE ;allow up to one second to get on target ;;BGT SUCCESS,0,ADAPT555 JUMP LIST97 ;get another command ;kVelocityDetect ;-------------------- LIST7: ADDI V3,1 TABLD TEMPTIME,[V3] ;pass the duration MULI TEMPTIME,msTick(1) ;convert from ms to ticks MARK 36 ;'$' CALL ACCEL MARK 36 ;'$' ;;BEQ SUCCESS,0,ADAPT99 ;leave routine if he did not move (+1 & -1 are rt and lt) JUMP LIST97 ;get another command ;kDelay ;-------------------- LIST8: ADDI V3,1 ;INC index MOVI TEMPTIME,msTick(1) ;;how many ticks in a ms TABLD TEMP2,[V3] ;get the delay period MUL TEMPTIME,TEMP2 ;convert it to a time in ticks TICKS TIMECHEK ;begin computing delay end time ADD TIMECHEK,TEMPTIME ;add delay duration MARK 100 LIST8A: TICKS TIMECURR ;get current time BLT TIMECURR,TIMECHEK,LIST8A MARK 101 JUMP LIST97 ;get another command ;kStimulate ;-------------------- LIST9: CALL STIM JUMP LIST97 ;get another command ;End of Trial ;-------------------- LIST98: JUMP IDLE ;EndOfTrial ;unassigned ;-------------------- LIST10: NOP JUMP LIST97 ;get another command ;-------------------------------------------------------- ; I D L E ;Control spends most of the time here. It leaves when new ;choices have been made or when it is time to move. ;9/28/04 ;Table Data Map: ; ;On Target parameter stored in TABLE, ZERO=0000 ; ZERO+10 = pRealMinTime*1000; ASSOONAS ; ZERO+11 = pRealMaxTime*1000; NOLATER ; ZERO+12 = pRealContiguousTime*1000; CONTTON ; ZERO+13 = pRealTimeOn*1000; TOTALTON ; ZERO+14 = pOnFirst*1000; DURFIRST ; ZERO+15 = pOnSubsequent*1000; DURSUB ; ZERO+16 = pForgiveness*1000; FORGTIME ;-------------------------------------------------------- IDLE: BEQ PARAMCHG,1,MAIN ;the user choices have changed TICKS TIMECURR ;get the current time ;time to check again? BLT TIMECURR,TIMECHEK,IDLE ADDI TIMECHEK,msTick(1) ;1ms, 0.001s later (much more accurate! no time drift) ADDI ELAPSED,1 CALL MAYHEM ;monkey acting up? (0.02 ms if not shaking or shouting) CALL OTTEST ;read target and eye values then compare (takes < 0.24 ms) ;is he being forgiven? BEQ FORGIVE,0,IDLE5 ADDI DURFORG,1 ;keep track of the forgiveness period BLT DURFORG,[ZERO+16],IDLE6 ;FORGTIME, still forgiving? MOVI FORGIVE,0 ;turn off forgiveness MOVI DURFORG,0 ;reset forgiveness timer ;is he on-target? IDLE5: BLT TRACKING,2,IDLE7 ;confirm both H & V are on target DIGOUT [....0...] ;high activates the SONALERT IDLE6: NOP ;comes directly here if in a FORGIVE period ADDI DURON,1 ;increase time on accumulator ADDI DURCONT,1 ;increase contiguous time on accumulator ADDI DURFEED,1 ;increase feed accumulator ;has he been OT long enough to be fed? BLT DURFEED,TIMEFEED,IDLE3 ;test if it is time to feed ;MARK 70 ;F CALL FEED ;0.103ms, feed him MOVI DURFEED,0 ;reset the accumulator TABLD TIMEFEED,[ZERO+15] ;DURSUB, use shorter subsequent time on-target dur ;has he been on long enough to move the target? IDLE3: BLE ELAPSED,[ZERO+10],IDLE ;ASSOONAS, satisfied the AS SOON AS requirement? BLE DURCONT,[ZERO+12],IDLE ;CONTTON, satisfied the contiguous requirement? BLE DURON,[ZERO+13],IDLE ;TOTALTON, sa.tisfied the total time on requirement? JUMP MAIN ;move now! ;he is off target reset everything but the total time on move accumulator IDLE7: NOP ;MARK 66 DIGOUT [....1...] ;low de-activates the SONALERT BGE ELAPSED,[ZERO+11],MAIN ;NOLATER, long enough - move the target anyway? MOVI DURCONT,0 ;reset the contiguous time on MOVI DURFEED,0 ;reset the feed time on TABLD TIMEFEED,[ZERO+14] ;DURFIRST, subsequent time on-target duration JUMP IDLE ;-------------------------------------------------------- ; S T I M ;Sends a stimulation pulse. ;6/22/06 ;-------------------------------------------------------- STIM: DIGOUT [...1....] ;trigger stimulation MARK 47 ;/character DELAY 100 ;1ms DIGOUT [...0....] ;stop stimulation MARK 92 ;\character STIM2: RETURN ;-------------------------------------------------------- ; M A Y H E M ;Time-out target to discourage monekys from shreking or ;shaking. ; ;Sequence Variable Map: ; TEMPWIND = window size ; TEMPTRAK = target position ; TRACKING = 0, 1 or 2 depending if he is OT or not ; V2 = holds data from table ; ;On Target parameter stored in TABLE, ZERO=0000 ; ZERO+18= pMayhemDuration*1000; 'time-outs when shouting or shaking in XY mode ;9/6/05 ;-------------------------------------------------------- MAYHEM: DIBEQ [.......1],MAYHEM1 ;1-test the Mayhem Monitor ;He's shaking or shouting! TABLD TEMP1,[ZERO+18] ;Mayhem duration BLE TEMP1,ZERO,MAYHEM1 ;skip if no positive duration specified MARK 33 ;"!" DIGOUT [....1...] ;low de-activates the SONALERT MOVI SHUT1,0 ;open the primary shutter MOVI SHUT2,0 ;close the secondary shutter CALL SHUTTER ;turn off everything to look at MULI TEMP1,100 ;convert ms to ticks DELAY TEMP1 MOVI DURON,0 ;reset the time on accumulator MOVI DURCONT,0 ;reset the contiguous time on MOVI DURFEED,0 ;reset the feed time on MOVI FORGIVE,0 ;reset forgiveness MOVI DURFORG,0 ;reset forgiveness timer MOVI ELAPSED,0 ;reset time testing OT TICKS TIMECURR ;get fresh time, lots was missed during the DELAY command TICKS TIMECHEK,msTick(1) ;1ms, 0.001s later MOVI SHUT1,1 ;open the primary shutter MOVI SHUT2,0 ;close the secondary shutter CALL SHUTTER ;show the primary target again MAYHEM1: RETURN ;2-carry on ;-------------------------------------------------------- ; G E T P O S ;Load the eye and target positions for processing by ;script routine TimeToMoveOrFeed. ;10/1/03 ;-------------------------------------------------------- GETPOS: CHAN HE,2 ;1-read the current H eye CHAN VE,3 ;2-read the current V eye CHAN HT1,4 ;3-read the current H primary target CHAN VT1,5 ;4-read the current V primary target CHAN HT2,8 ;5-read the current H secondary target CHAN VT2,9 ;6-read the current V secondary target RETURN ;7- ;-------------------------------------------------------- ; A R R I V E ;Test that the animal lands on target within a specified ;period of time. ; ; Input VAR ; TEMPTIME = duration of test in TICKS ; ; Output VAR ; SUCCESS = 0=failed 1=succeeded ; ;2/24/05 ;-------------------------------------------------------- ARRIVE: BEQ TEMPTIME,ZERO,ARRIVE1 ;exit if duration is ZERO TICKS TIMECHEK ;get the current time ADD TIMECHEK,TEMPTIME ;add the duration ARRIVE2: CALL OTTEST BEQ TRACKING,2,ARRIVE1 ;ontarget? all done TICKS TIMECURR ;get the current time BLT TIMECURR,TIMECHEK,ARRIVE2 ;keep checking ARRIVE3: MOVI SUCCESS,0 ;he never arrived on-target RETURN ARRIVE1: MOVI SUCCESS,1 ;he arrived on-target RETURN ;-------------------------------------------------------- ; O T T E S T ;Tests if the animal is on-target horizontally and ;vertically and reports the result. Requires 0.26ms or less. ; ;Sequence Variable Map: ; TEMPWIND = window size ; TEMPTRAK = target position ; TRACKING = 0, 1 or 2 depending if he is OT or not ; V2 = holds data from table ; ;On Target parameter stored in TABLE, ZERO=0000 ; ZERO+0 = gWindowHvgDAC%; HWIND ; ZERO+1 = gWindowVvgDAC%; VWIND ; ZERO+17= pForceOT%; 'override, make him OT at all times ; ;10/7/04 ;-------------------------------------------------------- OTTEST: MOVI TRACKING,0 ;1-initialize CALL GETPOS ;8-find out where targ & eye are TABLD TEMPWIND,[ZERO] ;9-HWIND MOV TEMPTRAK,HT1 ;10-load horizontal target SUB TEMPTRAK,HE ;11-subtract horizonal eye BGT TEMPTRAK,0,OTTEST1 ;12-test if result is negative MULI TEMPTRAK,-1 ;13-abs() OTTEST1: BGT TEMPTRAK,TEMPWIND,OTTEST2 ;14-test if he is H-OT ADDI TRACKING,1 ;15-horizontally on-target OTTEST2: TABLD TEMPWIND,[ZERO+1] ;16-VWIND MOV TEMPTRAK,VT1 ;17-load vertical target SUB TEMPTRAK,VE ;18-subtract vertical eye BGT TEMPTRAK,0,OTTEST3 ;19-test if result is negative MULI TEMPTRAK,-1 ;20-abs() OTTEST3: BGT TEMPTRAK,TEMPWIND,OTTEST4 ;21-test if he is V-OT ADDI TRACKING,1 ;22-vertically on-target OTTEST4: TABLD V2,[ZERO+17] ;23-test if using OT override BEQ V2,0,OTTEST5 ;24-do it the old fashioned way, earn it! MOVI TRACKING,2 ;25-force him to be on-target, cheater! OTTEST5: RETURN ;26- ;-------------------------------------------------------- ; B L A N K ; ;Extinguish the target if a blanking period has been ;specified and the animal moves towards the target. ; ;5/12/06 ;-------------------------------------------------------- BLANK: BEQ ZERO,[V1+5],BLANK1 ;bypass if no BLANKING is specified CALL ACCEL BEQ SUCCESS,0,BLANK1 ;leave routine if he did not move (+1 & -1 are rt and lt) MARK 66 ;'B' MOVI SHUT1,0 ;to close shutter CALL SHUTTER ;express shutter choices CALL LEDS ;RED LED off TABLD TEMPTIME,[V1+5] ;get blanking duration BLANK2: DELAY 98 ;1-consume remaining millisecond DBNZ TEMPTIME,BLANK2 ;2-test until period is over MOVI SHUT1,1 ;to open shutter CALL SHUTTER ;express shutter choices CALL LEDS ;RED LED on BLANK1: RETURN ;-------------------------------------------------------- ; A C C E L ; ;Test when the animal exceeds a specified eye velocity. ; ;I n p u t V a r ; THRESH2 = threshold velocity to come down to (in DAC bits) ;C o m p u t a t i o n V a r ; TEMPTIME = count down to zero ; TEMP3 = process H velocity (ch6) ; TEMP4 = process V velocity (ch7) ;O u t p u t V a r ; SUCCESS = -1:negative thresh 0:failed +1:positive thresh ; ;1/22/04 ;-------------------------------------------------------- ACCEL: NOP ;MOVI TEMPTIME,1000 ;millisecond ticks ACCEL1: CHAN TEMP3,6 ;1-read the current analog velocity signal CHAN TEMP4,7 ;2-read the curennt analog velocity signal BGT TEMP3,[V1+3],ACCEL2 ;3-positive horizontal movement BGT TEMP4,[V1+3],ACCEL2 ;4-positive vertical movement MULI TEMP3,-1 ;5-invert to test negative direction MULI TEMP4,-1 ;6-invert to test negative direction BGT TEMP3,[V1+3],ACCEL3 ;7-negative direction movement BGT TEMP4,[V1+3],ACCEL3 ;8-negative direction movement DELAY 90 ;9-consume remaining millisecond DBNZ TEMPTIME,ACCEL1 ;10-test until period is over MOVI SUCCESS,0 ;unsuccessful trial RETURN ACCEL2: MOVI SUCCESS,1 ;successful positive direction trial JUMP ACCEL4 ;detect the end of the movement ACCEL3: MOVI SUCCESS,-1 ;successful negative direction trial JUMP ACCEL4 ;detect the end of the movement ACCEL4: RETURN ;-------------------------------------------------------- ; S H U T T E R ;Sets the shutters open or closed. ;12/17/02 ;-------------------------------------------------------- SHUTTER: CALL SHUTTER1 ;set the primary shutter CALL SHUTTER2 ;set the secondary shutter RETURN ;-------------------------------------------------------- ; S H U T T E R 1 ;Sets primary shutter open or closed. ; 0 = HIGH OUTPUT ; 1 = LOW OUTPUT ;9/4/03 ;-------------------------------------------------------- SHUTTER1: TABLD V2,[ZERO+30] BEQ V2,0,SHUT1ROB ;Robinson convention is opposite of the Fuchs convention ;BEQ V2,3,SHUT1ROB ;Visual convention is opposite of the Fuchs convention ;0=ROB,1=OKN,2=LED,3=VIS ;Fuchs shutters BEQ SHUT1,1,OPENF DIGOUT [.......1] ;close the primary shutter MARK 70 ;"F" for "OFF" RETURN OPENF: DIGOUT [.......0] ;open the primary shutter MARK 78 ;"N" for "ON" RETURN ;Robinson shutters SHUT1ROB: BEQ SHUT1,1,OPENR DIGOUT [.......0] ;close the primary shutter MARK 70 ;"F" for "OFF" RETURN OPENR: DIGOUT [.......1] ;open the primary shutter MARK 78 ;"N" for "ON" RETURN ;-------------------------------------------------------- ; S H U T T E R 2 ;Sets secondary shutter open or closed. ; 0 = HIGH OUTPUT ; 1 = LOW OUTPUT ;9/4/03 ;-------------------------------------------------------- SHUTTER2: BEQ SHUT2,1,S2OPEN DIGOUT [......0.] ;close the secondary shutter MARK 102 ;"f" for "off" RETURN S2OPEN: DIGOUT [......1.] ;open the secondary shutter MARK 110 ;"n" for "on" RETURN ;-------------------------------------------------------- ; F E E D ;Sends a feeder pulse. ;10/12/04 ;-------------------------------------------------------- FEED: DIGOUT [.....1..] ;1-high triggers the feeder DELAY 100 ;101-1 ms pulse width DIGOUT [.....0..] ;102-low is the feeder off state MARK 64 ;@ RETURN ;103- ;-------------------------------------------------------- ; L E D S ;Activate a red or a green LED. Seems that the parallel- ;to-serial interface requires 120 microsec between ;characters. The buffering is not as fast as Frank Miles ;had hoped. The time it takes to complete this command ;varies: ; RED only = 0.44 ms ; GRN only = 0.45 ms ; RED & GRN = 0.71 ms ;3/19/03 ;-------------------------------------------------------- LEDS: DIGLOW [10101111] ;1-AF clear all boards DELAY 12 ;13-120 microsecond delay BEQ SHUT1,0,LEDS2 ;14-present a red LED? DIGLOW LEDBRD1 ;15-C0 add address + deg theta DELAY 12 ;27-120 microsecond delay DIGLOW LEDADD1 ;28-radius in lower nibble DELAY 12 ;40-120 microsecond delay ;MARK 18 ;12x LEDS2: BEQ SHUT2,0,LEDS3 ;41-present a green LED? DIGLOW LEDBRD2 ;42-C0 add address + deg theta DELAY 12 ;54-120 microsecond delay DIGLOW LEDADD2 ;55-radius in lower nibble DELAY 12 ;67-120 microsecond delay ;MARK 19 ;13x LEDS3: BNE SBUFFER,1,LEDS1 ;68- DIGLOW [10001111] ;69-8F send to all boards, #1 buffer MOVI SBUFFER,2 ;70-prepare to use the other buffer next time RETURN ;71- LEDS1: DIGLOW [10011111] ;69-9F send to all boards, #2 buffer loads first by default MOVI SBUFFER,1 ;70-prepare to use the other buffer next time RETURN ;71- ;-------------------------------------------------------- ; B R I T E ;Set the LED intensity. ;5/5/06 ;-------------------------------------------------------- BRITE: MARK 38 ;'&' DIGLOW [ZERO+29] ;1- (06...0C) (1...12) LED intensity DELAY 12 ;2-14 microsecond delay BNE SBUFFER,1,BRITE1 ;15- DIGLOW [10001111] ;16-8F send to all boards, #1 buffer MOVI SBUFFER,2 ;17-prepare to use the other buffer next time RETURN ;18- BRITE1: DIGLOW [10011111] ;19-9F send to all boards, #2 buffer loads first by default MOVI SBUFFER,1 ;20-prepare to use the other buffer next time RETURN ;21- ;-------------------------------------------------------- ; Z E R O V A R ; ;Zeros all the re-usable VAR so that they are empty before ;using. ; ;11/8/04 ;-------------------------------------------------------- ZEROVAR: MOVI V1,0 MOVI V2,0 MOVI V3,0 MOVI V4,0 MOVI V5,0 MOVI V6,0 MOVI V7,0 MOVI V8,0 MOVI V9,0 MOVI V10,0 MOVI V11,0 MOVI V12,0 MOVI V11,0 MOVI V14,0 MOVI V15,0 MOVI V16,0 MOVI V17,0 MOVI V18,0 MOVI TEMP1,0 MOVI TEMP3,0 MOVI TEMP4,0 MOVI TEMP2,0 MOVI V23,0 MOVI V24,0 MOVI V25,0 MOVI V26,0 RETURN