#!/bin/bash
if [ $# == 0 ]; then
    chipnumber=0
elif [ $# == 1 ]; then
    chipnumber=$1
else
    echo "Wrong number of arguments: " $#
    exit
fi
datadir=/home/jum/wdir/ilcdaq/data
filename=${datadir}/chip${chipnumber}/lvcard.csv
./mcmpca16 --fec 0 --preamp 0 --gain 0 --shaper 0 --shutdown 1 --polarity 1 --biasctrl 0 --grst 1 --write
iret=$?
if [ $iret != 0 ]; then
    echo mcmpca16 exiting with status $iret
fi
./lvcard --saltro 0 --filecsv $filename
iret=$?
if [ $iret != 0 ]; then
    echo lvcard --saltro 0 exiting with status $iret
fi
echo will try to power off
./lvcard --power 0 --filecsv $filename
