The MAR CCD can be operated as a virtual counter (online -tki). The contributions of Martin Dommach (Perl, client programming) and Edgar Weckert (implementing the state history) are aknowledged.
if( $method =~ /reset/i) { Spectra::marccd_abort(); return 0 if( !Spectra::marccd_start()); return Spectra::marccd_open_shutter(); } if( $method =~ /read/i) { return 0 if( !Spectra::marccd_close_shutter()); return 0 if( !Spectra::marccd_readout()); return 0 if( !Spectra::marccd_correct()); my $fname = $Spectra::SYM{ scan_name} . "_" . $Spectra::SYM{ sindex}; return Spectra::marccd_writefile( $fname); }
Online decodes the symbol MARCCD_HOST
when it opens the
connection on port 2002. Immediately after the open Online
sends the string abort\012
to ensure that the CCD is
in a known state.
To operate the MarCCD the server has to be started:
/home/marccd/bin/linux/marccd
It is important to take a background image first. Otherwise the correct() function causes a program crash. The remote control is enabled by 'Acquire' - 'Remote' - 'Start'.
Note that the chapter 'Beamline specific code' in Online -Tki manual contains an example that demonstrates how the MAR-CCD can be operated by a widget.
Here is a list of available functions:
Spectra::marccd_abort() sends "abort\012" Spectra::marccd_get_state() sends "get_state\012" returns (depending on the version): IDLE 0 ACQUIRE 1 READOUT 2 CORRECT 3 WRITING 4 ABORTING 5 UNAVAILABLE 6 ERROR 7 BUSY 8 Spectra::marccd_wait_for_state() waits for a specified state, e.g. marccd_wait_for_state( "40") means state was WRITING, now IDLE Spectra::marccd_start() sends "Start\012" and waits for state "81" Spectra::marccd_readout() sends "readout,0\012", sleeps 2s and waits for state "20" Spectra::marccd_readout_bg() sends "readout,1\012", sleeps 2s and waits for state "20" Spectra::marccd_readout_mr() sends "readout,2\012", sleeps 2s and waits for state "20" Spectra::marccd_correct() sends "correct\012" and waits for state "30" Spectra::marccd_writefile( "fname") sends "writefile,${fname},1\012" and waits for state "40"