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
#!/usr/bin/env perl
use strict;
use warnings;
use Device::SerialPort;
$|=1;
my $serDev = $ARGV[0] || '/dev/ttyUSB0';
my $port = Device::SerialPort->new($serDev);
my $serSpeed = $ARGV[1] || 115200;
my $serDB = $ARGV[2] || 8;
my $serPA = $ARGV[3] || 'none';
my $serSB = $ARGV[4] || 1;
unless ($port) {
print "Serial port: $serDev not found, use\n\n";
print " $0 <device> <speed> <baud> <parity> <stopbits>\n\n";
print " $0 /dev/ttyACM0 115200 8 none 1\n\n";
exit;
}
$port->databits($serDB);
$port->baudrate($serSpeed);
$port->parity($serPA);
$port->stopbits($serSB);
$port->read_char_time(1); # don't wait for each character
$port->read_const_time(500); # 0.5 sec per unfulfilled "read"
$port->write("PAGE\n");
$port->lookclear;
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
#!/usr/bin/env perl
use strict;
use warnings;
# use Device::SerialPort;
use Win32::SerialPort;
$|=1;
# my $serDev = $ARGV[0] || '/dev/ttyUSB0';
my $serDev = $ARGV[0] || 'COM3';
# my $port = Device::SerialPort->new($serDev);
my $port = new Win32::SerialPort($serDev);
my $serSpeed = $ARGV[1] || 115200;
my $serDB = $ARGV[2] || 8;
my $serPA = $ARGV[3] || 'none';
my $serSB = $ARGV[4] || 1;
unless ($port) {
print "Serial port: $serDev not found, use\n\n";
print " $0 <device> <speed> <baud> <parity> <stopbits>\n\n";
print " $0 /dev/ttyACM0 115200 8 none 1\n\n";
exit;
}
$port->databits($serDB);
$port->baudrate($serSpeed);
$port->parity($serPA);
$port->stopbits($serSB);
$port->read_char_time(1); # don't wait for each character
$port->read_const_time(500); # 0.5 sec per unfulfilled "read"
$port->write("PAGE\n");
$port->lookclear;
2017-07-09T14:06:01 GwenDragonVielleicht dieses … write_settings bei http://search.cpan.org/~bbirth/Win32-SerialPort-0....
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
#!/usr/bin/env perl
use strict;
use warnings;
use Win32::SerialPort;
$|=1;
my $serDev = $ARGV[0] || 'COM3';
my $serSpeed = $ARGV[1] || 115200;
my $serDB = $ARGV[2] || 8;
my $serPA = $ARGV[3] || 'none';
my $serSB = $ARGV[4] || 1;
my $port = new Win32::SerialPort($serDev);
$port->user_msg("ON");
$port->databits($serDB);
$port->baudrate($serSpeed);
$port->parity($serPA);
$port->stopbits($serSB);
$port->handshake("rts");
$port->buffers(4096, 4096);
$port->write_settings || undef $port;
unless ($port) {
print "Serial port: $serDev not found, use\n\n";
print " $0 <device> <speed> <baud> <parity> <stopbits>\n\n";
print " $0 /dev/ttyACM0 115200 8 none 1\n\n";
exit;
}
$port->write("IRGEDNWAS\n");
$port->lookclear;
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
#!/usr/bin/env perl
use strict;
use warnings;
use Win32::SerialPort;
$|=1;
my $serDev = $ARGV[0] || 'COM3';
my $serSpeed = $ARGV[1] || 115200;
my $serDB = $ARGV[2] || 8;
my $serPA = $ARGV[3] || 'none';
my $serSB = $ARGV[4] || 1;
my $port = new Win32::SerialPort($serDev);
$port->databits($serDB);
$port->baudrate($serSpeed);
$port->parity($serPA);
$port->stopbits($serSB);
$port->write_settings || undef $port;
unless ($port) {
print "Serial port: $serDev not found, use\n\n";
print " $0 <device> <speed> <baud> <parity> <stopbits>\n\n";
print " $0 /dev/ttyACM0 115200 8 none 1\n\n";
exit;
}
$port->write("PAGE\n");
$port->lookclear;
sleep(3);
$port->write("PAGE\n");
$port->lookclear;
sleep(10);
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
#!/usr/bin/env perl
use strict;
use warnings;
use Win32::SerialPort;
$|=1;
my $serDev = $ARGV[0] || 'COM3';
my $serSpeed = $ARGV[1] || 115200;
my $serDB = $ARGV[2] || 8;
my $serPA = $ARGV[3] || 'none';
my $serSB = $ARGV[4] || 1;
my $port = new Win32::SerialPort($serDev);
$port->databits($serDB);
$port->baudrate($serSpeed);
$port->parity($serPA);
$port->stopbits($serSB);
$port->write_settings || undef $port;
unless ($port) {
print "Serial port: $serDev not found, use\n\n";
print " $0 <device> <speed> <baud> <parity> <stopbits>\n\n";
print " $0 /dev/ttyACM0 115200 8 none 1\n\n";
exit;
}
$port->write("PAGE\n");
sleep(3);
$port->write("PAGE\n");