;-------------------------------------------------------- ; C O L L I S I O N S E Q U E N C E ;5/8/04 ;-------------------------------------------------------- ;Cannot exceed 1023 commands. ; SET 0.010 2 0 ;0.01 milliseconds per tick ;+/-10 volts ;0 degree offset; ;I/O CONNECTIONS: ;Dig IN ch 0 <--- Window Discriminator output ;--obsolete-- Dig OUT ch 0 ---> Stimulation Isolation Unit input ;ANALOG CONNECTIONS: ;ADC 0 <--- Unit ;ADC 1 <--- Horz Eye ;ADC 2 <--- Vert Eye ;ADC 3 <--- Horz Target ;ADC 4 <--- Vert Target ;DAC 0 ---> Stimulation Isolation Unit input ;RESERVED KEYSTROKES: ;(s) = Enter Search mode ;(c) = Enter Collision mode VAR V1,MODE=0 ;mode: 0 = search 1 = collision ;Search parameters (h= hunt) VAR V2,hHALFDUR=5 ;pulse high = 0.1ms VAR V3,hDEADDUR=99990 ;pulse low = 999.9ms ;Collision, single pulse parameters VAR V11,cHALFDUR=5 ;pulse high = 0.1ms ;Collision, train pulse parameters VAR V6,tFILLER=90 ;0.1+0.9 = 1.0ms = 1000Hz VAR V7,tCYCLES=100 ;1000Hz*100cycles = 100ms ;Collision, common parameters VAR V4,cLATENCY=300 ;3ms delay ;VAR V8,cLATENCY VAR V5,cDEADDUR=100000 ;1Hz VAR V10,cTYPE=0 ;type: 0=single 1=train VAR V20,COUNTER VAR V21,HIDAC=1073741824 VAR V22,LODAC=-1073741824 VAR V50,TEMP1 ;temporary variable VAR V51,TEMP2 ;temporary variable VAR V52,TEMP3 ;temporary variable ;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 V62=sTICK(1) ;script needs this to send calibrated timing values ;Branch to the appropriate mode MAIN: BEQ MODE,0,SEARCH ;Search mode BEQ MODE,2,SEARCH ;Edit mode ;implied MODE=1 for Collision mode BEQ cTYPE,0,SINGLE BEQ cTYPE,1,TRAIN JUMP MAIN ;invalid mode ;Output pulses at regular intervals. These pulses ;are intended for the stimulation isolation unit. SEARCH: MOV TEMP1,hHALFDUR CALL BP ;output a biphasic pulse DELAY hDEADDUR ;big delay, no need to be hyper-accurate JUMP MAIN ;Sends out a pulse after receiving a pulse in. ;Incoming pulses come from the window discriminator. ;Outgoing pulse go to the stimulation isolation unit. ; SINGLE: MOV TEMP1,cHALFDUR MOV TEMP3,cLATENCY ADDI TEMP3,-3 ;adjust for command ticks WAIT [.......1] ;1- wait for incoming pulse MARK 84 ;2- "T" DELAY TEMP3 ;3- CALL BP ;output a biphasic pulse DELAY cDEADDUR ;period before 'collide can respond again JUMP MAIN ;Sends out a train of pulses after receiving a pulse in. ;Incoming pulses come from the window discriminator. ;Outgoing pulse go to the stimulation isolation unit. ; TRAIN: MOVI COUNTER,0 ;initialize MOV TEMP1,cHALFDUR ;TEMP2 used in BPMULTI MOV TEMP3,cLATENCY ADDI TEMP3,-3 ;adjust for command ticks WAIT [.......1] ;1- wait for incoming pulse MARK 84 ;2- "T" DELAY TEMP3 ;3- CALL BPMULTI DAC 0,0 ;pulse to zero DELAY cDEADDUR ;period before 'collide can respond again JUMP MAIN ;BP Sends one biphasic pulse. ;Requires that the mono phasic pulse duration be in TEMP1 BP: ADDI TEMP1,-3 ;adjust for command ticks DAC 0,HIDAC ;1- +5v MARK 83 ;2- "S" DELAY TEMP1 ;3- DAC 0,LODAC ;1- -5v MARK 115 ;2- "s" DELAY TEMP1 ;3- DAC 0,0 ;pulse to zero RETURN ;BPMULTI Sends the number of biphasic pulses specified by tCYCLES. ;Requires that the mono phasic pulse duration be in TEMP1 BPMULTI: ADDI TEMP1,-3 ;adjust for command ticks MOV TEMP2,tFILLER ;time between biphasic pulses ADDI TEMP2,-2 ;adjust for command ticks BPMULTI1: DAC 0,HIDAC ;1- +5v MARK 83 ;2- "S" DELAY TEMP1 ;3- DAC 0,LODAC ;1- -5v MARK 115 ;2- "s" DELAY TEMP1 ;3- DAC 0,0 ;pulse to zero DELAY TEMP2 ;tFILLER ADDI COUNTER,1 ;1- inc BLT COUNTER,tCYCLES,BPMULTI1 ;2- branch RETURN SMODE: 's MOVI MODE,0 ;switch to SEARCH mode JUMP MAIN CMODE: 'c MOVI MODE,1 ;switch to COLLIDE mode JUMP MAIN