SPEC Setup for CCD camera


浜ホトのCCDカメラを SPECからコントロールするための メモです。

システムの構成

Prime DOSPARA custom PC
  Detected 2404.615 MHz processor.
  Memory: 900400k/917504k available

CORECO iMAGING PC-DIG RS-422
Hamamatsu Dual mode Cooled CCD C4880
NI-488.2 GPIB
Linux version 2.4.18-0vl3 (Vine 2.5) Vine 2.6では動作しなかった
SPEC 5.04.04-1

NI-488.2 GPIB Driver for Linux/x86 のインストール

まず、kernelのコンパイル
cd /usr/src/linux
make xconfig
  "Enable loadable module support" yes
  "Set version information on all symbols for modules" yes
  "Kernel daemon support" (to enable autoloading of module) yes
make dep
make bzImage
make modules modules_install

driverのインストール
su specadm
#ftp://ftp.natinst.com/support/gpib/linux/nigpib-linux-0.8.3.tar.gz
http://ftp.ni.com/support/gpib/linux/nigpib-linux-0.8.6.tar.gz
cd /home/specadm
tar xvfz nigpib-linux-0.8.3.tar.gz
./INSTALL

SPECのインストール

user: specadmの作成
adduser specadm

su specadm
cd
mkdir spec4.05.10
cd spec4.05.10
tar xvf ../spec_4.05.10_rh60_SP022.tar
./Install # as root

CPLOTのインストール

cd /home/nakao/cplot
tar xvfz /home/nakao/tmp/cplot_tohoku.tgz
ln -s /home/nakao/cplot /usr/local/cplot
ln -s /usr/local/cplot /usr/cplot
ln -s /usr/local/cplot/bin/cplot /usr/local/bin/cplot
ln -s /usr/local/cplot/bin/newfunc /usr/local/bin/newfunc

PC-DIG用ドライバ itifg-7.2.1のインストール

ftp://ftp.gom.com/pub/ITI-FG/itifg-7.2.1.tar.gz
tar xvfz itifg-7.2.1.tar.gz
cd itifg-7.2.1

itifgEXT.h内 #define PCD_DLY_MAX の値を以下のように変更
#define PCD_DLY_MAX ((unsigned long long)(ITI_DLY_BASE << 12) * 65537)
---> #define PCD_DLY_MAX ((unsigned long long)(ITI_DLY_BASE << 12) * 65537*10000)

make config
make depend
make
login as root
insmod ./itifg.o
MAKEDEV.itifg
./config_pcdig
test_itifg -f hama-ArrayCCD-14bpp-pcd.cam

make install
とすると、boot時に自動的にPC-DIG用ドライバ itifgが読み込まれる。 動作しているかは、dmesg コマンドで boot時のログに以下の行があれば 良い。

itifg[I]: 1 device(s) found.
itifg[I]: configure device 0.
itifg[I]: PC-DIG frame grabber board found.
itifg[I]: version 7.2.1-0.
itifg[I]: Nov 16 2005 (Linux 2.4.18-0vl3).

SPECによる CCDカメラのコントロール

まず、PC-DIGの初期化
config_pcdig fpgafiles/p2b1tn00.exo

setenv LANG=en /* shared memory 共有のためのおまじない */
onze \& /* CCDの画像表示プログラムの立ち上げ*/
fourc /* fourcの立ち上げ*/

<configの設定>
CCD-like DEVICE ADDR <>MODE <>TYPE
0 YES /dev/ic0idI 4 ITI PC-DIG Frame Grabber (read mode)

4.FOURC> ccd_rows=image_par(0,"rows");
5.FOURC> ccd_cols=image_par(0,"cols");
6.FOURC> shared ushort array image_data[ccd_rows][ccd_cols]; /* データ配列の定義 */
(PF最古のCCDは、 shared ushort array image_data[512][512] )
7.FOURC> image_par(0,"frames",1); /* CCD読み取りモード設定 */
8.FOURC> image_par(0,"extime",5000000); /* データ読出時のタイムアウト時間設定 */
9.FOURC> ser_put(0,"MON\r");   /* モニターモード */
10.FOURC> image_par(0,"run"); wait(0x04); image_get(0, image_data); /* データの読み込み */
実際のonzeで見えるCCD像

チェックのために可視光を測定しているので ぼやっと変に見えるが image_par(0,"run"); wait(0x04); image_get(0, image_data); を打つたびに 画像が自動的に更新される。

上述のPC-DIGの初期化をしなかったら、

こんな絵になりました。 画面4分割でかつ2つしか見えない 意味のわからない 画面です。

雑記

浜フォトのCCD側で 測定時間(7200 sec)の上限がある。

nakao@iiyo.phys.tohoku.ac.jp