]> jspc29.x-matter.uni-frankfurt.de Git - daqtools.git/commitdiff
*** empty log message ***
authorhadeshyp <hadeshyp>
Tue, 12 Jun 2012 15:01:44 +0000 (15:01 +0000)
committerhadeshyp <hadeshyp>
Tue, 12 Jun 2012 15:01:44 +0000 (15:01 +0000)
cbmrich.txt
dac_configuration.txt
dac_program.pl

index 237d3ad060cadbb18eed8ece60627ee3e5df38bf..3d7fbc712ec2134d2584141c67b8e22f188a642b 100644 (file)
@@ -1,9 +1,9 @@
-# Board   DAC     Channel       Command       Value
-  f300    0       0             3             0x3450
-  f300    0       1             3             0x1230
-  f300    0       2             3             0x6780
-  f300    0       3             3             0x0345
-  f300    0       4             3             0x3450
-  f300    0       5             3             0x1230
-  f300    0       6             3             0x6780
-  f300    0       7             3             0x0345
+# Board   ChainLen    DAC     Channel       Command       Value
+  f300    1           0       0             3             0x3450
+  f300    1           0       1             3             0x1230
+  f300    1           0       2             3             0x6780
+  f300    1           0       3             3             0x0345
+  f300    1           0       4             3             0x3450
+  f300    1           0       5             3             0x1230
+  f300    1           0       6             3             0x6780
+  f300    1           0       7             3             0x0345
index fada8519ba319b831a55856f0c78a70730b3b329..4e483f3a884ced2fb685872202f308612fac6a5e 100644 (file)
@@ -1,5 +1,5 @@
-# Board   DAC     Channel       Command       Value
-  f333    0       0             3             0x3450
-  f333    0       1             3             0x1230
-  f333    1       0             3             0x6780
-  f333    2       0             3             0x345
+# Board   ChainLen   DAC     Channel       Command       Value
+  f333    4          0       0             3             0x3450
+  f333    4          0       1             3             0x1230
+  f333    4          1       0             3             0x6780
+  f333    4          2       0             3             0x345
index 51d2732287d92096e3b6c9c92d78c58a945120b7..4bb9855775a1ffe45f5a1d30e2fd3670adf66942 100755 (executable)
@@ -1,35 +1,25 @@
 #!/usr/bin/perl -w
 use warnings;
-
 use FileHandle;
 use Time::HiRes qw( usleep );
 use Data::Dumper;
 use HADES::TrbNet;
 
-
 if (!defined &trb_init_ports()) {
   die("can not connect to trbnet-daemon on the $ENV{'DAQOPSERVER'}");
 }
-
-
-
-my $config = {};
-
 my $fh;
 
 if(!$ARGV[0]) {
   print "usage: dac_program.pl <filename of configuration file>\n\n";
   print "Example config file:\n";
-  print "# Board    DAC     Channel       Command       Value\n";
-  print "  f301     0       0             3             0x3450\n";
-  print "  f301     0       1             3             0x1230\n";
-  print "  f301     1       0             3             0x6780\n";
-  print "  f301     2       0             3             0x345\n";
-
-  
+  print "# Board   ChainLen    DAC     Channel       Command       Value\n";
+  print "  f300    1           0       0             3             0x3450\n";
+  print "  f300    1           0       1             3             0x1230\n";
+  print "  f300    1           0       2             3             0x6780\n";
+  print "  f300    1           0       3             3             0x0345\n";
   exit;
-}
-
+  }
 
 open $fh, "$ARGV[0]" or die $!."\nFile '$ARGV[0]' not found.";
 
@@ -40,7 +30,7 @@ while (my $a = <$fh>) {
   $a=~s/#.*//;
   
  
-  if(my ($board,$dac,$chan,$cmd,$val) = $a =~ /^\s*(\w\w\w\w)\s+(\d+)\s+(\d)\s+(\w)\s+(\w+)/) {
+  if(my ($board,$chain,$dac,$chan,$cmd,$val) = $a =~ /^\s*(\w\w\w\w)\s+(\d+)\s+(\d+)\s+(\d)\s+(\w)\s+(\w+)/) {
     if (substr($val,0,2) eq "0x") {
       $val = hex(substr($val,2));
       }
@@ -52,19 +42,13 @@ while (my $a = <$fh>) {
     $o |= $val;
     
     my @values;
-    foreach my $i (0..15) {
+    foreach my $i (0..($chain-1)) {
       $values[$i] = 0x00F00000;
       }
-    $values[16] = $dac+1;
-    $values[$dac] = $o;
-
-    
-    #Write memory address $board  registers 0xd400 - 0xd410 with @values...
-    foreach my $i (0..15) {
-      trb_register_write($board,0xd400+$i,$values[$i]);
-      }
-    trb_register_write($board,0xd410,16);  #"16" workaround until length of chain is known
+    $values[16] = $chain;
+    $values[$chain-1-$dac] = $o;
+#     print Dumper @values;
+    trb_register_write_mem($board,0xd400,0,\@values,$chain) or die "trb_register_write_mem: ", trb_strerror(); 
+    usleep(5*$chain);
     }
-    usleep(80);
-
   }
\ No newline at end of file