use warnings;
use Data::Dumper;
-my $endpoint = 0x201;
+my $endpoint = 0xc001;
use HADES::TrbNet;
my $rough_value=0;
my $fine_value=0;
#my $mode = $main::mode;
-my $mode = "padiwa";
+my $mode = "cbm";
sub NEW {
this->slider->setMinimum(0x0);
- this->slider->setMaximum(0xffff);
+ if ($mode eq "padiwa") {
+ this->slider->setMaximum(0xffff);
+ }
+ else {
+ this->slider->setMaximum(0xfff);
+ }
this->scrollBar->setMinimum(0x0);
this->scrollBar->setMaximum(0xff);
this->valueSpinBox->setValue(3150);
- this->setWindowTitle(this->tr('Thresholds'));
+ my $titleofwindow="Thresholds of channel $main::channel";
+ this->setWindowTitle(this->tr($titleofwindow));
+# this->setWindowTitle(this->tr('Thresholds $channel'));
}
$rough_value = $value;
write_to_hardware();
- print "set value called: $value\n";
+ #print "set value called: $value\n";
}
sub setValueFine {
this->scrollBar->setValue($value);
$fine_value = $value;
write_to_hardware();
- print "set fine value called: $value\n";
+ #print "set fine value called: $value\n";
}
sub write_to_hardware {
my $sum = $rough_value + $fine_value;
+ #print "channels: ". $main::channel_str . "\n";
+
if ($mode eq "cbm") {
+ my $rh_res;
+ $rh_res = trb_register_write($endpoint,0xd410, 0x1);
+
if($sum > 4095) {
$sum=4095;
}
foreach my $dacch (0..7) {
my $rh_res;
my $command;
- $command= 0x00300000+($dacch<<16) + ($sum<<4);
+ $command= 0x00300000 | ($dacch<<16) | ($sum<<4);
$rh_res = trb_register_write($endpoint,0xd400, $command);
-
+ printf "trbcmd w 0x%x 0xd400 0x%x\n", $endpoint, $command;
+
if(!defined $rh_res) {
my $res = trb_strerror();
print "error output: $res\n";
exit();
}
$rh_res = trb_register_write($endpoint,0xd411, 0x1);
+ printf "trbcmd w 0x%x 0xd411 0x%x\n", $endpoint, 1;
}
}
my $rh_res;
$rh_res = trb_register_write($endpoint,0xd410, 0x1);
- foreach my $dacch (0..15) {
-
- my $command;
- $command= 0x00800000 + ($dacch<<16) + ($sum);
-
- $rh_res = trb_register_write($endpoint,0xd400, $command);
-
- if(!defined $rh_res) {
- my $res = trb_strerror();
- print "error output: $res\n";
- exit();
- }
- $rh_res = trb_register_write($endpoint,0xd411, 0x1);
+
+ #foreach my $dacch (0..15) {
+ my $dacch = $main::channel;
+ #print "chosen channel:$dacch\n";
+ my $command;
+ $command= 0x00800000 + ($dacch<<16) + ($sum);
+ $rh_res = trb_register_write($endpoint,0xd400, $command);
+
+ if(!defined $rh_res) {
+ my $res = trb_strerror();
+ print "error output: $res\n";
+ exit();
}
+ $rh_res = trb_register_write($endpoint,0xd411, 0x1);
+
}
--- /dev/null
+log4perl.logger.padiwa_threshold=DEBUG, A1
+log4perl.appender.A1=Log::Dispatch::File
+log4perl.appender.A1.filename=padiwa_threshold.log
+log4perl.appender.A1.mode=append
+log4perl.appender.A1.layout=Log::Log4perl::Layout::PatternLayout
+#log4perl.appender.A1.layout.ConversionPattern=%d %p> %F{1}:%L %M %P - %m%n
+log4perl.appender.A1.layout.ConversionPattern=%d %p> %M %P - %m%n
+
+# results of threshold scan
+log4perl.logger.padiwa_threshold_data=DEBUG, D1
+log4perl.appender.D1=Log::Dispatch::File
+log4perl.appender.D1.filename=padiwa_threshold_results
+log4perl.appender.D1.mode=append
+log4perl.appender.D1.layout=Log::Log4perl::Layout::PatternLayout
+log4perl.appender.D1.layout.ConversionPattern=%d %m%n
+
+
+# for thresholds for the DAQ
+#log4perl.logger.mdc_threshold_analyze=DEBUG, A2
+#log4perl.appender.A2=Log::Dispatch::File
+#log4perl.appender.A2.filename=data/mdc_threshold_daq.db
+#log4perl.appender.A2.mode=append
+#log4perl.appender.A2.layout=Log::Log4perl::Layout::PatternLayout
+#log4perl.appender.A2.layout.ConversionPattern=%m%n
+
+
+# only for test
+log4perl.logger.test=DEBUG, T1
+log4perl.appender.T1=Log::Dispatch::File
+log4perl.appender.T1.filename=test.log
+log4perl.appender.T1.mode=append
+log4perl.appender.T1.layout=Log::Log4perl::Layout::PatternLayout
+log4perl.appender.T1.layout.ConversionPattern=%d %m%n