KETEK_4K MCA

The KETEK_4K MCA is connected via USB. It is defined in /online_dir/exp_ini.exp by:

define/device=mca/module=ketek_4k/control=tango \
      /hostname=hasbw1dif/devicename="bw4/exp/mca1" mca1

The KETEK_4K MCA is accessed via a Tango server. The following commands are implemented:

Clear Clears the MCA and the attributes for the total time and the dead time.
Start Creates a thread that continuously (0.1s) reads the MCA and writes the data into a buffer.
Stop Notifies the thread to exit.
Read Reads the MCA spectrum, 4096 channels, 16 bits each. The dead time and the total time are calculated using the first 4 words:

attr_DeadTime += ((double)((0x3ff & spectrum[1]) << 16) + spectrum[0])/25000000.; 
attr_TotalTime += ((double)((0x3ff & spectrum[3]) << 16) + spectrum[2])/25000000.; 
attr_LiveTime = attr_TotalTime - attr_DeadTime;

The following attributes are implemented:

DAC0 Temperatur control, 0 - 0xff, n.a.
DAC1 LLD, unsigned short, 0 - 0xfff, 0 2.5V, 12b, def. 0x96, can be set with jive.
DAC2 ULD, unsigned short, 0 - 0xfff, 0 2.5V, 12b, def. 0xfff, can be set with jive.
DAC3 D_T, unsigned short, 0 - 0xfff, 0 2.5V, 12b, def. LLD, can be set with jive.
DeadTime float
LiveTime float
TotalTime float

If this device is used by online -tki the total time and the dead time are stored in the parameter block of the output file.

The USB interface needs the following configuration (kernel at least 2.6.xxx):

$ stty -F /dev/ttyUSB0 -a
speed 921600 baud; rows 0; columns 0; line = 0;
intr = ^C; quit = ^\; erase = ^?; kill = ^U; eof = ^D; eol = <undef>;
eol2 = <undef>; start = ^Q; stop = ^S; susp = ^Z; rprnt = ^R; werase = ^W;
lnext = ^V; flush = ^O; min = 1; time = 0;
-parenb -parodd cs8 -hupcl -cstopb -cread clocal -crtscts
ignbrk -brkint -ignpar -parmrk -inpck -istrip -inlcr -igncr -icrnl -ixon -ixoff
-iuclc -ixany -imaxbel
opost -olcuc -ocrnl onlcr -onocr -onlret -ofill -ofdel nl0 cr0 tab0 bs0 vt0 ff0
-isig -icanon -iexten -echo echoe -echok -echonl -noflsh -xcase -tostop
-echoprt -echoctl -echoke