summaryrefslogtreecommitdiff
path: root/i/serialplot/read.pl
diff options
context:
space:
mode:
Diffstat (limited to 'i/serialplot/read.pl')
-rw-r--r--i/serialplot/read.pl46
1 files changed, 46 insertions, 0 deletions
diff --git a/i/serialplot/read.pl b/i/serialplot/read.pl
new file mode 100644
index 0000000..0a9c722
--- /dev/null
+++ b/i/serialplot/read.pl
@@ -0,0 +1,46 @@
+#!/usr/bin/perl -w
+#use strict;
+
+my $i=0;
+my $tab;
+my $init=0;
+
+while (defined($line = <STDIN>) && $init == 0)
+{
+ #if ($line =~ m/[P-W][0-9a-f1-F]{2},[0-9a-f1-F]{2}/)
+ {
+ $tab[$i] = substr ($line,1,1);
+ for (my $j=0; $j<= $i-1; $j++)
+ {
+ if (substr($line,1,1) eq $tab[$j])
+ {
+ $init =1;
+ }
+
+ }
+ $i++ if ($init == 0);
+ }
+}
+
+
+for (my $j=0; $j <= $i; $j++)
+{
+ $line = <STDIN>;
+}
+
+while ($init != 2 )
+{
+ for (my $j=0; $j <= $i-1; $j++)
+ {
+ if (defined($line = <STDIN>))
+ {
+ print "0x" . substr($line,2,2) . substr($line,5,2);
+ }
+ else
+ {
+ $init = 2;
+ }
+ print " ";
+ }
+ print "\n";
+}