3351 0x3800000a49380728 # dirich3 untested
3361 0xe300000a4938b328 # dirich3 untested
3381 0xf200000a4938ae28 # dirich3 untested
+3391 0xba00000a48bbef28 # dirich3 tested
3691 0x4d00000a496aea28 # dirich3 untested
3701 0x6100000a49790b28 # dirich3 untested
3711 0x0c00000a49a58028 # dirich3 untested
3741 0x9400000a49ec3728 # dirich3 untested
3751 0xfb00000a49aaf028 # dirich3 untested
3761 0xd200000a49ec5028 # dirich3 untested
+3771 0xe300000a48ae1828 # dirich3 tested
3791 0x6400000a48ae0c28 # dirich3 untested
3801 0xa900000a488f0728 # dirich3 untested
3811 0x8b00000a48e5da28 # dirich3 untested
use lib "/home/hadaq/trbsoft/daqtools/dmon/code";
use Dmon;
-my $dirich = 0x1229;
+my $dirich = 0x1234;
$dirich = $ARGV[0];
my $first_channel = 0;
my $last_channel = 31;
-my $default_threshold = 0x3000;
+my $default_threshold = 0x6000;
#my $absolute_max_threshold = 0x8000;
my $absolute_min_threshold = 0x1000;
my $command;
my $chain=0;
+my $READ = 0x0<<20; # bits to set for a read command
+my $WRITE = 0x8<<20; # bits to set for a write command
+my $REGNR = 24; # number of bits to shift for the register number
for my $channel (0 .. 31) {
$chain = ($channel <16) ? 0 : 1;
- $command = $fixed_bits | ($channel << $channel_shift) | ($default_threshold << $shift_bits);
+ #($channel<<$REGNR | $WRITE | ($data&0xffff));
+ # sendcmd($channel<<$REGNR | $WRITE | ($data&0xffff));
+ #$command = $fixed_bits | ((0x10| ($channel&0xf)) << $channel_shift) | (($default_threshold+$channel) << $shift_bits);
+ $command = ($channel&0xf)<<$REGNR | $WRITE | ($default_threshold&0xffff);
+ #print "$command\n";
Dmon::PadiwaSendCmd($command,$dirich, $chain);
+ usleep(10E3);
#trb_register_write($dirich, $throffset + $channel , $default_threshold);
#$rh_res = trb_register_read($dirich, $throffset + $channel);
}
-
+#exit;
usleep (1E5);
my $boundaries = {};
my $hit_zero_diff_flag = 0;
- my $lower_threshold = 0x6a80;
- my $upper_threshold = 0xd000;
- my $reasonable_upper_threshold = 0x8000;
+ my $lower_threshold = 0x6f80;
+ my $upper_threshold = 0x9000;
+ my $reasonable_upper_threshold = 0x7800;
my $thresh_increment = 0x8;
THRESH_LOOP: for (my $thresh = $lower_threshold ; $thresh <= $upper_threshold; $thresh += $thresh_increment) {
$chain = ($channel <16) ? 0 : 1;
- $command = $fixed_bits | ($channel << $channel_shift) | ($thresh << $shift_bits);
+ #$command = $fixed_bits | ( (0x10|($channel&0xf)) << $channel_shift) | ($thresh << $shift_bits);
+ $command = ($channel & 0xf)<<$REGNR | $WRITE | ($thresh&0xffff);
+ #print "chain: $chain\n";
Dmon::PadiwaSendCmd($command,$dirich, $chain);
##trb_register_write($dirich, $throffset + $channel , $thresh);
undef $rh_res;
}
my $diff = $hits[1] - $hits[0];
- #printf "cur thresh: %.4x diff: $diff\n",$thresh ;
+ #printf "channel: $channel: cur thresh: %.4x diff: $diff\n",$thresh ;
#sleep 0.2;
$hit_zero_diff_flag = 1 if($diff == 0);
last THRESH_LOOP;
}
- }
+ } # THRESH_LOOP
if ( ! exists $boundaries->{$channel}->{'upper'}) {
$boundaries->{$channel}->{'upper'} = $upper_threshold;
}
$chain = ($channel <16) ? 0 : 1;
- $command = $fixed_bits | ($channel << $channel_shift) | ($default_threshold << $shift_bits);
+ #$command = $fixed_bits | ( (0x10|($channel&0xf)) << $channel_shift) | ($default_threshold << $shift_bits);
+ $command = ($channel & 0xf)<<$REGNR | $WRITE | ($default_threshold&0xffff);
Dmon::PadiwaSendCmd($command,$dirich, $chain);
#trb_register_write($dirich, $throffset + $channel , $default_threshold);
}