Hi all,
I have a query on reading the serial port using Win32:: Serial Port.

I am trying to write a command to the COM port and reading the response of
it. 

The following script is not working if I open the serial port before
starting the loop and keep writing the command until the desired response is
got. Can you please explain why???

$atcmd = $atcmd . "\r";
    
while($no_of_atmpts < $max_noatmpts)
{                     
          $Utils::at_port_handle = Win32::SerialPort->start
("$Utils::configuration_file") 
                               or warn "Can't open Serial port for UE AT
$Utils::configuration_file";

          $Utils::at_port_handle->write($atcmd);

          sleep(1);

          $at_response = $Utils::at_port_handle->input;

          if($at_response =~ /OK/)
          {
                  $no_of_atmpts = $max_noatmpts;
          }
          else
          {
                  $no_of_atmpts++;
                  sleep(2);
          }

          $Utils::at_port_handle -> close or print "Could not close the COM
port properly\n";
} 



**********************************************************************
The information contained in this email and any attachments
is likely to be confidential and legally privileged, and is for the
intended recipient named above only. Any copying, 
dissemination, disclosure of or use of this email or its 
attachments unless authorised by us is prohibited, except 
that you may forward this email and/or attachments to a third 
party on a strict "need to know" basis. 

If you have received this email in error, please notify us 
immediately by replying to the email or by calling 
+91-80-26492700. Please then delete this email and any full
or partial copies of it.

You as the intended recipient must be aware and accept 
that emailis not a totally secure communications medium.

Although we have taken all reasonable steps to make 
sure this email and any attachments are free from viruses, 
we do not (to the extent permitted by law) accept any liability 
whatsoever for any virus infection and/or compromise of 
security caused by this email and any attachment.

No contract may be formed or documents served by you 
on or with us by this email or any attachments unless 
expressly agreed otherwise by us. 
**********************************************************************

_______________________________________________
Perl-Win32-Users mailing list
Perl-Win32-Users@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
  • Query on reading COM port Rajesh Vattem

Reply via email to