From f45d05d8f4d53e93e78217348e058fa37ec5bc90 Mon Sep 17 00:00:00 2001 From: Jan Michel Date: Mon, 22 Aug 2016 16:48:00 +0200 Subject: [PATCH] Update adc reader for better resolution --- users/frankfurt_test/trb3scadc.pl | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/users/frankfurt_test/trb3scadc.pl b/users/frankfurt_test/trb3scadc.pl index 7292262..ce5e225 100755 --- a/users/frankfurt_test/trb3scadc.pl +++ b/users/frankfurt_test/trb3scadc.pl @@ -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]); -- 2.43.0