--- /dev/null
+#!/usr/bin/perl -w
+use warnings;
+use FileHandle;
+use Time::HiRes qw( usleep );
+use Data::Dumper;
+use HPlot;
+use HADES::TrbNet;
+# my $fh;
+
+trb_init_ports() or die("could not connect to trbnetd");
+# open $fh, "../../trb3/multitest/adcdump.txt" or die $!."\nFile not found.";
+
+
+my $plot = ();
+$plot->{name} = "ADC";
+$plot->{file} = "files/ADC";
+$plot->{entries} = 1000;
+$plot->{type} = HPlot::TYPE_HISTORY;
+$plot->{output} = HPlot::OUT_SCREEN;
+$plot->{titles}->[0] = "";
+$plot->{xlabel} = "sample";
+$plot->{ylabel} = "value";
+$plot->{sizex} = 1200;
+$plot->{sizey} = 900;
+$plot->{ymin} = 0;
+$plot->{ymax} = 2**12;
+$plot->{nokey} = 1;
+HPlot::PlotInit($plot);
+
+
+while(1) {
+
+trb_register_write(0xfadc,0xc000,0) or sleep 5 and next;
+usleep(100);
+my $mux1 = trb_register_read_mem(0xfadc,0xc006,1,1050) or sleep 5 and next;
+
+foreach my $v (@{$mux1->{0xfadc}}) {
+ HPlot::PlotAdd("ADC",$v & 0xfff,0);
+ }
+HPlot::PlotDraw("ADC");
+sleep(1);
+}
+
if(my ($ref) = $a =~ /^\s*!Reference\s+(\w+)/i) {
$ref = hex(substr($ref,2)) if (substr($ref,0,2) eq "0x");
$reference = $ref * 1.;
- print $reference."\n";
+# print $reference."\n";
}
if(my ($board,$chain,$chainlen,$dac,$chan,$cmd,$val) = $a =~ /^\s*(\w\w\w\w)\s+(\w+)\s+(\d+)\s+(\d+)\s+(\d)\s+(\w)\s+(\w+)/) {
- $val = hex(substr($val,2)) if (substr($val,0,2) eq "0x");
+ $val = hex(substr($val,2)) if (substr($val,0,2) eq "0x");
$chain = hex(substr($chain,2)) if (substr($chain,0,2) eq "0x");
- $cmd = hex($cmd);
+ $cmd = hex($cmd);
$board = hex($board);
- if ($val > $reference) {
- printf("Error, value %i is higher than reference %i\n",$val,$reference);
+ if ($val >= $reference) {
+ printf(STDERR "Error, value %i is higher than reference %i\n",$val,$reference);
next;
}