Unable to read the string



Hi this is Arun here, i am new to perl.Here i am trying to read a
string from the serial port but i am not able to and this is my
program:

# Read serial port until message or timeout occurs
sub ReadPort($$$) {
(my $String, my $TimeOut, my $Display) = @_;
$ob->read_const_time($TimeOut); # Setup timeout value in mS
my $Reply = ""; # Initialize message
do {
($Count, $Result) = $ob->read(1); # Read serial port
$Reply .= $Result; # Build message
print "$Result" if ($Display); # Display messages if enabled
} while($Count > 0 and $Reply !~ m/$String/);
print "\n" if ($Display); # Put carriage return at end of
displayed output
if ($Reply !~ m/$String/) {
print "ERROR: Read timed out waiting for '$String' \n";
return(1);
}
return($Reply);


So just needed help for the above program to be solved.

.



Relevant Pages

  • Re: Unable to read the string
    ... Arun wrote: ... string from the serial port but i am not able to and this is my ... # Display messages if enabled ... print $result if $display; ...
    (perl.beginners)
  • RE: SerialPort read&write members display string value above 127 as "?
    ... Serial Port Class methods of Read and Write default to ASCII code ... namespace EncodeTest1 ... // A Unicode string with two characters outside an 8-bit code ... "This unicode string contains two characters " + ...
    (microsoft.public.dotnet.framework)
  • Re: String Variable containing "R" has zero length??? mscomm1.input
    ... >>I can't read from the serial port. ... >>dim d as integer ... >>Bunch of stuff For Sale and Wanted at the link below. ... > You need to find out why the com control is returning an empty string. ...
    (microsoft.public.vb.controls)
  • Re: PC Com Port data capture....
    ... Note this method burns a user license by running full time on a serial port. ... carriage return at the end of the string as most do. ... This is for a scale application. ...
    (comp.databases.pick)
  • Re: how can I send AT commands by the serial port when the VISA VIs dont work?
    ... serial port, if I use the hyperterminal of Windows I do not have ... This is done with a termination character ... LabVIEW sends out EXACTLY the characters you tell it to ... to the device you have to append them explicitedly to the string you ...
    (comp.lang.labview)