Leser: 1
6 Einträge, 1 Seite |
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
#!/usr/bin/perl -w
use strict;
require 5.003;
use Win32API::CommPort;
use Win32::SerialPort qw( :STAT0.19);
use Win32;
my $PortName = 'COM1';
my $pass;
my $return;
my $quiet = 1;
my $configFile= 'ER400TRS.cfg';
my $PortObj = new Win32::SerialPort($PortName,$quiet) || die "Can't open $PortName: $^E\n";
$PortObj->user_msg('ON');
$PortObj->baudrate (9600) || die "fail setting baudrate";
$PortObj->parity ("none") || die "fail setting parity";
$PortObj->databits (8) || die "fail setting databits";
$PortObj->stopbits (1) || die "fail setting stopbits";
$PortObj->handshake ("none") || die "fail setting handshake";
$PortObj>dtr_active (1) || die "fail setting dtr_active";
my @ar=$PortObj->buffers(128,128);
$PortObj->write_settings || die "no settings\n";
$PortObj->save($configFile) || die "no settings\n";
$PortObj->Close ||die "failed to close";
undef $PortObj;
$PortObj = tie( *COMFH,'Win32::SerialPort',$configFile)
|| die "can tie using";
my $BlockingFlags;
my ( $InBytes, $OutBytes, $LatchErrorFlags );
( $BlockingFlags, $InBytes, $OutBytes, $LatchErrorFlags ) = $PortObj->status
|| warn "could not get port status\n";
if ( $BlockingFlags ) { warn "Port is blocked"; }
if ( $BlockingFlags & BM_fCtsHold ) { warn "Waiting for CTS (clear to send)"; }
if ( $LatchErrorFlags & CE_FRAME ) { warn "Framing Error"; }
my ( $count_out, $output_string );
$output_string = "Hallo ";
while(1){
$ca++;
($BlockingFlags,$InBytes,$OutBytes,$ErrorFlags) = $PortObj->status;
die "lost port\n" unless defined $ErrorFlags;
unless($InBytes){
last if($ca > 25);
select(undef,undef,undef,0.01);
next;
}
if($string_in = $PortObj->read($InBytes)){
last;
}
}
$PortObj->close or die "failed to close";
undef $PortObj;
QuoteCan't locate Win32API/CommPort.pm in @INC (@INC contains: /usr/lib/perl5/5.8.6/i586-linux-thread-multi /usr/lib/perl5/5.8.6 /usr/lib/perl5/site_perl/5.8.6/i586-linux-thread-multi /usr/lib/perl5/site_perl/5.8.6 /usr/lib/perl5/site_perl /usr/lib/perl5/vendor_perl/5.8.6/i586-linux-thread-multi /usr/lib/perl5/vendor_perl/5.8.6 /usr/lib/perl5/vendor_perl .) at tcom1.pl line 6.
BEGIN failed--compilation aborted at tcom1.pl line 6.
6 Einträge, 1 Seite |