Wiebrock Druckanzeiger MDA 3.104 auslesen
#****************************************************************
#!/usr/bin/perl
use strict;
use warnings;
# Wiebrock aka Ashcroft MDA pressure transmitter
### Define Seriell Port
my $port = "/dev/ttyS1"; # like COM2
### Set Port with stty
system "stty 9600 -oddp -ixoff min 1 time 5 ignbrk -brkint -icrnl -imaxbel -opost -onlcr -isig -icanon -iexten -echo -echoe -echok -echoctl -echoke -F $port";
### open Port as COM
open(COM, "+>$port") or die "can't open $port";
select(COM); # COM as standart E/A
$| = 1; # Character one by one = no buffer
### Send STXMATX asks for ALL
print("\2M\3");
sleep(1); # 9600 BPS could be slow ...
sysread(COM, my ($line), 40);
close(COM);
select(STDOUT);
#print $line . "\n";
my @lines =( split(/_/, $line) );
#print ("SNR:" . $lines[0] . "\n");
#print ("Switch: " . $lines[3] . "\n");
#print ("Switch: " . $lines[4] . "\n");
my $Dezimalselector = $lines[1];
my $Raw_pressure = $lines[2];
my $Pressure = $Raw_pressure / ($Dezimalselector*10);
print ("Sourcename ". $Pressure . "\n");
#****************************************************************