From 0a945baabd2bfef2e56d1c473303811edccf84fb Mon Sep 17 00:00:00 2001 From: hadeshyp Date: Tue, 12 Jun 2012 15:01:44 +0000 Subject: [PATCH] *** empty log message *** --- cbmrich.txt | 18 +++++++++--------- dac_configuration.txt | 10 +++++----- dac_program.pl | 42 +++++++++++++----------------------------- 3 files changed, 27 insertions(+), 43 deletions(-) diff --git a/cbmrich.txt b/cbmrich.txt index 237d3ad..3d7fbc7 100644 --- a/cbmrich.txt +++ b/cbmrich.txt @@ -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 diff --git a/dac_configuration.txt b/dac_configuration.txt index fada851..4e483f3 100644 --- a/dac_configuration.txt +++ b/dac_configuration.txt @@ -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 diff --git a/dac_program.pl b/dac_program.pl index 51d2732..4bb9855 100755 --- a/dac_program.pl +++ b/dac_program.pl @@ -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 \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 -- 2.43.0