rkrasowski has asked for the wisdom of the Perl Monks concerning the following question:
Hi, I am sure that answer to this problem is simple. What I am trying to do is to communicate over serial port using Device::SerialPort. The problem is when I am trying to send long string. Only a part of it is transmitted. I understand that buffer has limits. I can do it while openning file and sending data from file using while <file >, but for string?? Here is an example of my code ( numbers up to 8 are sent, nothing after that:
a#!/usr/bin/perl use strict; use warnings; use Device::SerialPort; my $PORT = "/dev/ttyO1"; my $ob = Device::SerialPort->new($PORT) || die "Can't Open $PORT: $!"; $ob->baudrate(115200) || die "failed setting baudrate"; $ob->parity("none") || die "failed setting parity"; $ob->databits(8) || die "failed setting databits"; $ob->handshake("none") || die "failed setting handshake"; $ob->write_settings || die "no settings"; $| = 1; my $string = "1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20\n"; $ob->write( "$string\n");
Any idea how to fix it?? Thanks in advance. Robert
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: How to send long sting Device::SerialPort
by BrowserUk (Patriarch) on Dec 07, 2013 at 22:00 UTC | |
|
Re: How to send long sting Device::SerialPort
by oiskuu (Hermit) on Dec 08, 2013 at 10:05 UTC | |
by rkrasowski (Sexton) on Dec 08, 2013 at 13:36 UTC | |
by kschwab (Vicar) on Dec 08, 2013 at 14:25 UTC | |
by rkrasowski (Sexton) on Dec 08, 2013 at 16:51 UTC | |
by oiskuu (Hermit) on Dec 09, 2013 at 11:32 UTC |