From 661a5a231e10c428c326a6b48edfbb4ce6e209ff Mon Sep 17 00:00:00 2001 From: hadeshyp Date: Mon, 27 Aug 2012 11:31:32 +0000 Subject: [PATCH] *** empty log message *** --- README.txt | 2 + adcplot.pl | 43 +++++++++++++++++++ cbmrich.txt => config/DAC_cbmrich.db | 0 dac_configuration.txt => config/DAC_config.db | 0 dac_program.pl | 10 ++--- 5 files changed, 50 insertions(+), 5 deletions(-) create mode 100644 README.txt create mode 100755 adcplot.pl rename cbmrich.txt => config/DAC_cbmrich.db (100%) rename dac_configuration.txt => config/DAC_config.db (100%) diff --git a/README.txt b/README.txt new file mode 100644 index 0000000..aea17bd --- /dev/null +++ b/README.txt @@ -0,0 +1,2 @@ +adcplot.pl Takes values (measurements from AD9222 and similar) from a TrbNet-Fifo and plots them using the HPlot library +dac_progam.pl Programs a LTC2600 DAC with settings from a db files diff --git a/adcplot.pl b/adcplot.pl new file mode 100755 index 0000000..9d32c4a --- /dev/null +++ b/adcplot.pl @@ -0,0 +1,43 @@ +#!/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); +} + diff --git a/cbmrich.txt b/config/DAC_cbmrich.db similarity index 100% rename from cbmrich.txt rename to config/DAC_cbmrich.db diff --git a/dac_configuration.txt b/config/DAC_config.db similarity index 100% rename from dac_configuration.txt rename to config/DAC_config.db diff --git a/dac_program.pl b/dac_program.pl index c0c3c48..4abc01f 100755 --- a/dac_program.pl +++ b/dac_program.pl @@ -33,17 +33,17 @@ while (my $a = <$fh>) { 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; } -- 2.43.0