Hallo,
ich hab da mal eine Perl Frage:
Perl
#!/usr/bin/perl
use strict;
use warnings;
#Redlion PAXP pressure read
### Define Seriell Port
my $port = "/dev/ttyS4"; # like COM5
### Set Port with stty
system "stty 9600 -oddp -ixoff -echo < $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 TA to PAXP asks for INPut Value
print("TA*\015");
sleep(1); # 9600 BPS could be slow ...
sysread(COM, my ($line), 20);
$line =~ s/ *//g; # kill blanks
close(COM);
select(STDOUT);
print("Mainz ". $line); # Print to Standartout
Alles anzeigen
Dieses Script funktioniert auch nach Reboot.
Perl
#!/usr/bin/perl
use strict;
use warnings;
### Define Seriell Port
my $port = "/dev/ttyS1"; # like COM2
### Set Port with stty
system "stty 9600 -oddp -ixoff -echo < $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);
my @lines =( split(/_/, $line) );
my $Dezimalselector = $lines[1];
my $Raw_pressure = $lines[2];
my $Pressure = $Raw_pressure / ($Dezimalselector*10);
print ("Bonn ". $Pressure . "\n");
Alles anzeigen
Dieses Script hat noch ein Problem nach dem Reboot,
wenn ich allerdings einmal mit minicom an der Schnittstelle war dann geht es? Kopfkratz
Code
stty -a -F /dev/ttyS1
speed 9600 baud; rows 0; columns 0; line = 0;
intr = ^C; quit = ^\; erase = ^?; kill = ^U; eof = ^D; eol = <undef>; eol2 = <undef>; swtch = <undef>; start = ^Q; stop = ^S; susp = ^Z; rprnt = ^R;
werase = ^W; lnext = ^V; flush = ^O; min = 1; time = 5;
-parenb -parodd cs8 -hupcl -cstopb cread clocal -crtscts
ignbrk -brkint -ignpar -parmrk -inpck -istrip -inlcr -igncr -icrnl -ixon -ixoff -iuclc -ixany -imaxbel -iutf8
-opost -olcuc -ocrnl -onlcr -onocr -onlret -ofill -ofdel nl0 cr0 tab0 bs0 vt0 ff0
-isig -icanon -iexten -echo -echoe -echok -echonl -noflsh -xcase -tostop -echoprt -echoctl -echoke
So zeigt sich die Schnittstelle wenn sie tut.
Die Frage ist wie muss ich die Zeile:
system "stty 9600 -oddp -ixoff -echo < $port";
verändern?
Denn sie wird scheinbar nicht ausgeführt;
stty möchte ja eigentlich ein -F vor der Schnittstelle ?
Gruß und Dank an Alle die bis hier mitlasen
Ulf
System ist lenny falls das wichtig ist.