/* ************************************************************ */ /* exposuredsp.c */ /* read data for HICALI */ /* 2000/12/05 T. Ichikawa copied from resetReadDsp.c */ /* 2001/06/08 T. Ichikawa modified for V2 */ /* 08/31 Y. KATSUNO revised for HAWAII2 */ /* 2002/12/26 T. YOSHIKAWA revised for HICALI */ /* ************************************************************ */ #include #include #include #include #include #include #define NAXIS1 1082 /* x range */ #define NAXIS2 1024 /* y range */ /* external functions in "hicalclock.c" */ extern void transfer_to_serial(); extern void serial_read_out(); extern void serial_cds_read_out(int cds, unsigned int *read_out); extern void transfer_to_serial_binning(); extern void shutter_open(); extern void shutter_close(); /* start address of dsp memory */ unsigned int *sdram = (unsigned int *)0x02000000; /* DSP Interface Board Top address */ volatile int *dap = (int *)0x01700000; int main() { int i, j, k; int datanum = NAXIS1 * NAXIS2; unsigned int exposure[2], exposure_time, dark; unsigned int start, wipe, read[6], cds; unsigned int fin = 1; unsigned int read_out[2]; /* setup dsp */ c6xconf(); /* setup CCD array */ shutter_close(); /* close shutter before wipe out */ S_HREAD(&wipe, 1, 1); while(wipe != 1){ /* wipe out until wipe = 1 */ for(i=0; i<1024; i++){ transfer_to_serial(); for(j=0; j<541; j++){ serial_read_out(); } } S_HREAD(&wipe, 1, 1); } /* exposure */ S_HREAD(exposure, 2, 1); exposure_time = exposure[0]; dark = exposure[1]; /* 1:dark frame 0:light frame */ fin = exposure_time; if(exposure_time >= 1) { if(exposure_time > 1000) { /* Use LabVIEW timer if exposure time > 1000 msec */ if(!dark)shutter_open(); S_HWRITE(&fin, 1, 1); S_HREAD(&start, 1, 1); if(!dark)shutter_close(); } else { /* Use DSP timer if exposure time <= 1000 msec */ if(!dark)shutter_open(); delay_msec(1, exposure_time); if(!dark)shutter_close(); } } /* image data read out */ S_HREAD(&read, 6, 1); cds = read[0]; if(cds >= 3) { /* Corelated double sampling only cds >=3 */ /* pixel count reset */ k = 0; /* cds read out */ for(i=0; i<1024; i++){ transfer_to_serial(); for(j=0; j<541; j++){ serial_cds_read_out(cds, read_out); sdram[k] = read_out[0]; k++; sdram[k] = read_out[1]; k++; } } } else { /* else nomal read out */ /* pixel count reset */ k = 0; /* nomal read out */ for(i=0; i<1024; i++){ transfer_to_serial(); for(j=0; j<541; j++){ serial_read_out(read_out); sdram[k] = read_out[0]; k++; sdram[k] = read_out[1]; k++; } } } /* load image data */ S_HWRITE(sdram, datanum, 1); return 0; }