COMMENT * This file is used to generate DSP code for the utility board. It will time the exposure, operate the shutter, control the CCD temperature and turn the analog power on. This is Rev. 3.00 software. Modified 1-12-97 for 10 MHz input clock frequency by adding 2 to elapsed exposure time rather than one. Power ON sequence written for Gen II power control board, Rev. 4A -d DOWNLOAD 'HOST' To generate code for downloading to DSP memory. -d DOWNLOAD 'ROM' To generate code for writing to the ROM. * PAGE 132 ; Printronix page width - 132 columns ; Name it a section so it doesn't conflict with other application programs SECTION UTILAPPL ; These are also defined in "utilboot.asm", so be sure they agree APL_ADR EQU $90 ; Starting address of application program BUF_STR EQU $80 ; Starting address of buffers in X: BUF_LEN EQU $20 ; Length of buffers SSI_BUF EQU BUF_STR ; Starting address of SCI buffer in X: COM_BUF EQU SSI_BUF+BUF_LEN ; Starting address of command buffer in X: COM_TBL EQU COM_BUF+BUF_LEN ; Starting address of command table in X: ; Define some useful constants APL_XY EQU $1EE0 ; Starting address in EEPROM of X: and Y: values DLY_MUX EQU 150 ; Number of DSP cycles to delay for MUX settling DLY_AD EQU 200 ; Number of DSP cycles to delay for A/D settling ; Assign addresses to port B data register PBD EQU $FFE4 ; Port B Data Register IPR EQU $FFFF ; Interrupt Priority Register ; Addresses of memory mapped components in Y: data memory space ; Write addresses first WR_DIG EQU $FFF0 ; was $FFFF Write Digital output values D00-D15 WR_MUX EQU $FFF1 ; Select MUX connected to A/D input - one of 16 EN_DIG EQU $FFF2 ; Enable digital outputs WR_DAC3 EQU $FFF7 ; Write to DAC#3 D00-D11 WR_DAC2 EQU $FFF6 ; Write to DAC#2 D00-D11 WR_DAC1 EQU $FFF5 ; Write to DAC#1 D00-D11 WR_DAC0 EQU $FFF4 ; Write to DAC#0 D00-D11 ; Read addresses next RD_DIG EQU $FFF0 ; Read Digital input values D00-D15 STR_ADC EQU $FFF1 ; Start ADC conversion, ignore data RD_ADC EQU $FFF2 ; Read A/D converter value D00-D11 WATCH EQU $FFF7 ; Watch dog timer - tell it that DSP is alive ; Bit definitions of STATUS word ST_SRVC EQU 0 ; Set if ADC routine needs executing ST_EX EQU 1 ; Set if timed exposure is in progress ST_SH EQU 2 ; Set if shutter is open ST_READ EQU 3 ; Set if a readout needs to be initiated STRT_EX EQU 4 ; Set to indicate start of exposure ; Bit definitions of software OPTIONS word OPT_SH EQU 0 ; Set to open and close shutter ; Bit definitions of Port B = Host Processor Interface PWR_EN1 EQU 0 ; Power enable bit ONE - Output PWR_EN0 EQU 1 ; Power enable bit ZERO - Output PWRST EQU 2 ; Reset power conditioner counter - Output SHUTTER EQU 3 ; Control shutter - Output IRQ_T EQU 4 ; Request interrupt service from timing board - Output SYS_RST EQU 5 ; Reset entire system - Output WATCH_T EQU 8 ; Processed watchdog signal from timing board - Input ;************************************************************************** ; * ; Register assignments * ; R1 - Address of SCI receiver contents * ; R2 - Address of processed SCI receiver contents * ; R3 - Pointer to current top of command buffer * ; R4 - Pointer to processed contents of command buffer * ; N4 - Address for internal jumps after receiving 'DON' replies * ; R0, R5, R6, A, X0, X1 - For use by program only * ; R7 - For use by SCI ISR only * ; Y0, Y1, and B - For use by timer ISR only. If any of these * ; registers are needed elsewhere they must be saved and * ; restored in the TIMER ISR. * ;************************************************************************** ; Specify execution and load addresses. ORG P:APL_ADR,P:APL_ADR ; The TIMER addresses must be defined here and SERVICE must follow to match ; up with the utilboot code ; JMP actual > target -> MOVE Y: add more heat ADD X,A ; Add both least and most significant ; words (X0 and X1) to accumulator A MOVE Y: Power reset BSET #PWRST,X:PBD BSET #HVEN,X:PBD ELSE ; Earlier Revision power control boards BSET #PWRST,X:PBD ; Reset power control board REP #30 NOP BCLR #PWRST,X:PBD ENDIF RTS ; Return from PWR_OFF_SUBROUTINE ; Power OFF command execution PWR_OFF MOVEP #$2000,X:IPR ; Disable TIMER interrupts JSR Turn on +/- 6.5V, +/- 16.5V BCLR #PWRST,X:PBD ELSE BSET #LVEN,X:PBD ; Make sure line is high to start with DO #255,L_PON1 ; The power conditioner board wants to BCHG #LVEN,X:PBD ; see 128 H --> L transitions NOP ; Backplane signal settling time delay L_PON1 ENDIF JSR Turn on +36V ELSE HV_ON BSET #HVEN,X:PBD ; Make sure line is high to start with DO #255,L_PON5 ; The power conditioner board wants to BCHG #HVEN,X:PBD ; see 128 H --> L transitions L_PON5 ENDIF JSR APL_XY WARN 'Application P: overflow!' ; Make sure next application ENDIF ; will not be overwritten ; Command table resident in X: data memory ; The last part of the command table is not defined for "bootrom" ; because it contains application-specific commands IF @SCP("DOWNLOAD","HOST") ORG X:COM_TBL,X:COM_TBL ELSE ; Memory offsets for generating EEPROMs ORG P:COM_TBL,P:APL_XY ENDIF DC 'PON',PWR_ON ; Power ON DC 'POF',PWR_OFF ; Power OFF DC 'SEX',START_EX ; Start exposure DC 'PEX',PAUSE ; Pause exposure DC 'REX',RESUME ; Resume exposure DC 'AEX',ABORT ; Abort exposure DC 'OSH',OPEN ; Open shutter DC 'CSH',CLOSE ; Close shutter DC 'DON',PR_DONE ; Process DON reply DC 0,START,0,START,0,START,0,START DC 0,START,0,START,0,START ; Y: parameter table definitions, containing no "bootrom" definitions IF @SCP("DOWNLOAD","HOST") ORG Y:0,Y:0 ; Download address ELSE ORG Y:0,P: ; EEPROM address continues from P: above ENDIF DIG_IN DC 0 ; Values of 16 digital input lines DIG_OUT DC 0 ; Values of 16 digital output lines DAC0 DC 0 ; Table of four DAC values to be output DAC1 DC 1000 DAC2 DC 2000 DAC3 DC 3000 NUM_AD DC 16 ; Number of inputs to A/D converter AD_IN DC 0,0,0,0,0,0,0,0 DC 0,0,0,0,0,0,0,0 ; Table of 16 A/D values EL_TIM_MSECONDS DC 0 ; Number of milliseconds elapsed TGT_TIM DC 6000 ; Number of milliseconds desired in exposure U_CCDT DC $C20 ; Upper range of CCD temperature control loop L_CCDT DC $C50 ; Lower range of CCD temperature control loop K_CCDT DC 85 ; Constant of proportionality for CCDT control A_CCDT EQU AD_IN+5 ; Address of CCD temperature in A/D table T_CCDT DC $0FFF ; Target CCD T for small increment algorithmn T_COEFF DC $010000 ; Coefficient for difference in temperatures DAC0_LS DC 0 ; Least significant part of heater voltage ; Define power supply turn-on variables IF @SCP("POWER","R6") T_HV DC $240 ; Target HV supply voltage for Rev 6 pwr contl board ELSE T_HV DC $4D0 ; Target HV supply voltage for Rev 2 or 3 boards ENDIF K_HV DC $080 ; Tolerance of HV supply voltage T_P15 DC $5C0 ; Target +15 volts supply voltage K_P15 DC $080 ; Tolerance of +15 volts supply voltage T_M15 DC $A40 ; Target -15 volts supply voltage K_M15 DC $080 ; Tolerance of -15 volts supply voltage I_HV DC 0 ; Initial value of HV I_P15 DC 0 ; Initial value of +15 volts I_M15 DC 0 ; Initial value of -15 volts ; Define some command names CLR DC 'CLR' ; Clear CCD RDC DC 'RDC' ; Readout CCD ABR DC 'ABR' ; Abort readout OSH DC 'OSH' ; Open shutter connected to timing board CSH DC 'CSH' ; Close shutter connected to timing board POK DC 'POK' ; Message to host - power in OK PER DC 'PER' ; Message to host - ERROR in power up sequence SBV DC 'SBV' ; Message to timing - set bias voltages IDL DC 'IDL' ; Message to timing - put camera in idle mode STP DC 'STP' ; Message to timing - Stop idling CSW DC 'CSW' ; Message to timing - clear switches ; Miscellaneous CC00 DC $C00 ; Maximum heater voltage so the board doesn't burn up SV_A1 DC 0 ; Save register A1 during analog processing SV_SR DC 0 ; Save status register during timer processing EL_TIM_FRACTION DC 0 ; Fraction of a millisecond of elapsed exposure time INCR DC $CCCCCC ; Exposure time increment = 0.8 milliseconds SH_DEL DC 10 ; Shutter closing time TEMP DC 0 ; Temporary storage location for X:PBD word COM_HDR DC 0 ; Header of command being executed ; During the downloading of this application program the one millisecond ; timer interrupts are enabled, so the utility board will attempt to execute ; the partially downloaded TIMER routine, and crash. A workaround is to ; put a RTI as the first instruction of TIMER so it doesn't execute, then ; write the correct instruction only after all the rest of the application ; program has been downloaded. Here it is - ORG P:APL_ADR,P:APL_ADR JMP