From aca5a274f0c34bd2861368e165318a8bfe09f3ce Mon Sep 17 00:00:00 2001 From: Michael Traxler Date: Wed, 4 Aug 2021 04:45:20 +0200 Subject: [PATCH] added, mt --- .../dirich_set_standard_thresholds.pl | 67 +++++++++++++++++++ 1 file changed, 67 insertions(+) create mode 100755 users/gsi_ee_trb84/dirich_set_standard_thresholds.pl diff --git a/users/gsi_ee_trb84/dirich_set_standard_thresholds.pl b/users/gsi_ee_trb84/dirich_set_standard_thresholds.pl new file mode 100755 index 0000000..5d472fc --- /dev/null +++ b/users/gsi_ee_trb84/dirich_set_standard_thresholds.pl @@ -0,0 +1,67 @@ +#!/usr/bin/perl +use warnings; +use strict; +use HADES::TrbNet; +use Time::HiRes qw(usleep); +use Data::Dumper; + +use lib "/home/hadaq/trbsoft/daqtools/dmon/code"; +use Dmon; + +my $dirich = 0x1234; +my $std_thresh = 0x6800; + +$dirich = $ARGV[0]; +if($ARGV[1]) { + $std_thresh = $ARGV[1]; + $std_thresh = hex($std_thresh); +} + +unless ($ARGV[0]) { + print "usage: $0 [std_threshold]]\n"; + exit; +} + +$dirich = hex($dirich); + +my $throffset = 0xa000; +#my $monitor = 0xdfc0; +my $monitor = 0xc001; + +my $first_channel = 0; +my $last_channel = 31; + +my $default_threshold = 0x6000; + +#my $absolute_max_threshold = 0x8000; +my $absolute_min_threshold = 0x1000; + +my @res; my $res; my $rh_res; + +trb_init_ports() or die trb_strerror(); + +# enable monitor counters +$res = trb_register_write($dirich, 0xdf80 , 0xffffffff); +if(!defined $res) { + $res = trb_strerror(); + print "error output: $res\n"; +} + + +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 = ($channel&0xf)<<$REGNR | $WRITE | ($std_thresh & 0xffff); + #print "$command\n"; + Dmon::PadiwaSendCmd($command,$dirich, $chain); + usleep(10E3); +} +exit; + -- 2.43.0