]> jspc29.x-matter.uni-frankfurt.de Git - daqtools.git/commitdiff
Update adc reader for better resolution
authorJan Michel <j.michel@gsi.de>
Mon, 22 Aug 2016 14:48:00 +0000 (16:48 +0200)
committerJan Michel <j.michel@gsi.de>
Mon, 22 Aug 2016 14:48:00 +0000 (16:48 +0200)
users/frankfurt_test/trb3scadc.pl

index 729226277f0f3e11a3a3eaece86d4634dd34c5bd..ce5e225bb2fdfcb9b7dd1b6adb2bfe55118bfc9c 100755 (executable)
@@ -15,7 +15,7 @@ my $board = hex($ARGV[0]);
 #0 for TRB3sc, 1 for DiRich, 2 for Concentrator, 3 for PowerVoltages, 4 for PowerCurrents
 my $modedesc = ['Trb3sc','DiRich','Concentrator','Power-Voltages','Power-Currents'];
 my $mode = $ARGV[1] || 0;
-my $multiplier= [[2,1,1,2],[2,2,1,0],[2,2,1,25],[2,2,1,1],[10,5,2,1]];
+my $multiplier= [[1,1,0.5,2],[1,1,0.5,0],[1,1,0.5,3.125],[1,1,0.5,0.5],[5,1.25,1,0.5]];
 my $t = [['mV (3.3)','mV (2.5)','mV (1.2)','mV (6)'],
          ['mV (3.3)','mV (2.5)','mV (1.1)',''],
          ['mV (3.3)','mV (2.5)','mV (1.2)','mA (@1.2)'],
@@ -23,6 +23,8 @@ my $t = [['mV (3.3)','mV (2.5)','mV (1.2)','mV (6)'],
          ['mA (@1.1)','mA (@1.2)','mA (@2.5)','mA (@3.3)']];
 my $channel = [7,7,7,6,5];
 
+#1:4V, 2:2V, 3:1V
+my $resolution = [[2,1,2,1],[2,2,2,1],[2,2,2,4],[2,2,2,2],[2,3,2,2]];
 print "\nRunning in mode ".$modedesc->[$mode]."\n\n";
 
 
@@ -31,21 +33,21 @@ system("trbcmd w $board 0xd41a 25");
 
 my $cmd; my $s;
 
-$cmd = 0xc3830000;
+$cmd = 0xc1830000 + ($resolution->[$mode][0] << 25);
 $s = Dmon::PadiwaSendCmd($cmd,$board,$channel->[$mode]);
 
 usleep(5000);
-$cmd = 0xd3830000;
+$cmd = 0xd1830000 + ($resolution->[$mode][1] << 25);
 $s = Dmon::PadiwaSendCmd($cmd,$board,$channel->[$mode]);
 printf("0x%08x\t%i %s\n",$s->{$board},($s->{$board}>>19&0xfff)*$multiplier->[$mode][0],$t->[$mode][0]);
 
 usleep(5000);
-$cmd = 0xe3830000;
+$cmd = 0xe1830000 + ($resolution->[$mode][2] << 25);
 $s = Dmon::PadiwaSendCmd($cmd,$board,$channel->[$mode]);
 printf("0x%08x\t%i %s\n",$s->{$board},($s->{$board}>>19&0xfff)*$multiplier->[$mode][1],$t->[$mode][1]);
 
 usleep(1000);
-$cmd = 0xf3830000;
+$cmd = 0xf1830000 + ($resolution->[$mode][3] << 25);
 $s = Dmon::PadiwaSendCmd($cmd,$board,$channel->[$mode]);
 printf("0x%08x\t%i %s\n",$s->{$board},($s->{$board}>>19&0xfff)*$multiplier->[$mode][2],$t->[$mode][2]);