#Add all possible paths here...
use lib '/home/hadaq/EPICS/base-3.14.12.3/lib/perl';
use lib '/mnt/home_cbm02/hadaq/EPICS/base-3.14.12.3/lib/perl';
+use lib '/home/hadaq/EPICS/EPICS-3.15.6/base/lib/perl';
use CA;
# Address list for Epics IOCs. Don't remove unused values
my $dirich = trb_register_read(0xfe51,0x0);
-foreach my $b (keys $dirich) {
+my $cnt = 1;
+foreach my $b (keys %{$dirich}) {
my $addr = sprintf("0x%x",$b);
writeThr2Flash($addr);
+ $cnt++;
+# sleep 5 unless ($cnt%20)
}
#print Dumper $dirich;
sub writeThr2Flash {
- my $addr = @_;
+ my $addr = shift @_;
print $addr."...";
- my $str = qx(/home/hadaq/trbsoft/daqtools/tools/spi_slave.pl -e=$addr -c=0 -flashcmd=8 -x=memtoflash --range '0x0..0xf');
+ system("/home/hadaq/trbsoft/daqtools/tools/spi_slave.pl -e=$addr -c=0 -flashcmd=8 -x=memtoflash --range '0x0..0xf' &");
#print $str."\n";
- $str = qx(/home/hadaq/trbsoft/daqtools/tools/spi_slave.pl -e=$addr -c=1 -flashcmd=8 -x=memtoflash --range '0x0..0xf');
+ system("/home/hadaq/trbsoft/daqtools/tools/spi_slave.pl -e=$addr -c=1 -flashcmd=8 -x=memtoflash --range '0x0..0xf' &" );
#print $str."\n";
print "done!\n";
}
my $name = $c->{name};
- my $fn = "gnuplot";
+ my $fn = "gnuplot 2>1";
#my $fh = new FileHandle ("|$fn") or die "error: no gnuplot";
open my $fh, "|$fn" or die "error: no gnuplot";
$fh->autoflush(1);
['mV (3.3)','mV (2.5)','mV (1.2)','mV (1.1)'],
['mA (@1.1)','mA (@1.2)','mA (@2.5)','mA (@3.3)'],
['mV (5)','mV (1.1)','mV (2.5)','mV (3.3)']];
-my $channel = [7,7,7,6,5,7]; #SPI interface number
+my $channel = [7,7,7,6,6,7]; #SPI interface number - 777657 would be right
#1:4V, 2:2V, 3:1V
my $resolution = [[2,1,2,1], [2,2,2,1], [2,2,2,4], [2,2,2,2], [3,3,2,2], [1,2,1,2]];
system("trbcmd w $board 0xd41a 25");
my $cmd; my $s;
+trb_register_write($board,0xd417,0x40) if($mode == 4);
$cmd = 0xc1830000 + ($resolution->[$mode][0] << 25);
$s = Dmon::PadiwaSendCmd($cmd,$board,$channel->[$mode]);
$s = Dmon::PadiwaSendCmd(0,$board,$channel->[$mode]);
printf("0x%08x\t%.2f °C\n",$s->{$board},(($s->{$board}>>19)&0xfff)/16.);
+trb_register_write($board,0xd417,0x0) if($mode == 4);
+
+
#back to normal SPI speed
system("trbcmd w $board 0xd41a 7");
print "\n";
##########################################
#variables
##########################################
-my $boardAddress = 0x0201;
-my $numberOfBoards = 1;
+my $boardAddress = 0x0110;
+my $numberOfBoards = 6;
my $numberOfSensors = 4;
my $secondsToWaitBeforeNextPrint = 3;
my $writeToFile = false;
if(defined $isRemote) {
my $env = $ENV{'QUERY_STRING'};
# $env =~ s/%20/ /g;
- $env =~ s/&/!/g;
+ $env =~ s/&/\\!/g;
my $cmd = "bash -c \"ssh $isRemote 'QUERY_STRING=".$env." perl'\" <htdocs/tools/pwr/pwr_remote.pl";
-# system("ssh $isRemote 'QUERY_STRING=".$env." perl -v' ");
-# print $cmd."\n";
+ system("ssh $isRemote 'QUERY_STRING=".$env." perl -v' ");
+ print $cmd."\n";
print qx($cmd);
}
else {
#!/usr/bin/perl -w
use HADES::TrbNet;
-use Storable qw(lock_store lock_retrieve);
+use Storable qw(lock_store retrieve lock_retrieve);
use feature "switch";
use Time::HiRes qw( time usleep );
die "Could not parse name $name \n";
}
- $db = lock_retrieve($file);
+ $db = retrieve($file);
die "Unable to read cache file\n" unless defined $db;
die "Your cached database is outdated. Update by running xml-db.pl"
unless exists $db->{'§EntityType'};
#!/usr/bin/perl -w
use HADES::TrbNet;
-use Storable qw(lock_retrieve);
+use Storable qw(retrieve);
use Time::HiRes qw( usleep );
use feature "switch";
elsif ($name =~ m/^([a-zA-Z0-9]+)$/) {$name = $1; $slice = 0;}
else {die "Could not parse name $name \n";}
- $db = lock_retrieve($file);
+ $db = retrieve($file);
die "Unable to read cache file\n" unless defined $db;
die "Name not found in entity file\n" unless(exists $db->{$name});