# File mdipict.src	30.9.93	IZ
#
# Takes pictures in all modes for contamination monitoring as part 
# of LFFT
#
#     !GI0 = exposure time in shutter ticks (0.25 msec/tick)
#     !GI5 = IP program (3,4,5)
#     !GI7 = Sequence ID
#     !GI9 = wait time after exposure command in seconds
#

program "@(#) MODULE: mdipict.src RELEASE: %R%.%L% CREATED: %G% %U%"
source "/mdisw/cfl/eof/src/mdipict.src"
descr " mdipict - Takes pictures in all modes"

display "Executing procedure: mdipict"
writen !GS9 "  "
write  !GS9 "Executing procedure mdipict :"
write  !GS9 " %s" !DATE
writen !GS9 " %s" !TIME

tcblock mbcmsumm 1 1
#tcblock mbiplbic 0 3
set !GI5 = 3
perform liplbic

tcblock mbcmhdr1 0x4040 0x4040 0 1 0
write !GS9 "  Taking full 1024x1024"
writen !GS9 " in FD & HR; OBS & CAL modes"

tcblock mbcmaadc 3
writen !GS9 "  CCD amplifier A, offset: 3"

set !GI7 = 0xc018

set !GI0 = 16000
ask !RI "Enter exposure time ('0' for default of 16000 ticks)"
if !RI > 0 then
  set !GI0 = !RI
end if
write !GS9 "  Exposure time:"
write !GS9 " %d" !GI0
set !GI9 = 110
write !GS9 " ticks with %d" !GI9
writen !GS9 " second waits"

perform lobsmode

open decom160 !LS1
writen !GS9 "  160k data stored in: %s" !LS1

tcblock mbcmtp1r !GI7 !GI0 !GI0
writen !GS9 "    OBS FD"
wait time !GI9
tcblock mbcmtp3r !GI7 !GI0 !GI0
writen !GS9 "    OBS HR"
wait time !GI9

perform lcalmode

tcblock mbcmtp1r !GI7 !GI0 !GI0
writen !GS9 "    CAL FD"
wait time !GI9
tcblock mbcmtp3r !GI7 !GI0 !GI0
writen !GS9 "    CAL HR"
wait time !GI9

tcblock mbcmdrkr !GI7 !GI0 !GI0
wait time !GI9
writen !GS9 "    Soft DARK"
tcblock mbcmbadc 3
writen !GS9 "  CCD amplifier B, offset: 3"
tcblock mbcmdrkr !GI7 !GI0 !GI0
wait time !GI9
writen !GS9 "    Soft DARK"

tcblock mbcmtp3r !GI7 !GI0 !GI0
writen !GS9 "    CAL HR"
set !GI9 = 120
wait time !GI9

tcblock mbcmaadc 3
writen !GS9 "  Set CCD amplifier back to A, offset: 3"

wait time 7
close decom160

writen !GS9 "Finished procedure mdipict : %s" !TIME
writen !GS9 "  "
display "End procedure mdipict"
