Spent some real time on this, but am totally stuck - help would be greatly appreciated. I have an astro camera that is controlled by a serial interface and was provided with a small control program (dotnet). The camera and program work fine on my Win7 PC with a Serial-USB connection and I am using Device Monitoring Studio to see the data going to the serial port. I want to migrate the control to Strawberry Perl, so I created the following test program:
#! C:\perl\bin\perl.exe use strict; use warnings; use Win32::SerialPort ; my $PortObj = new Win32::SerialPort ("COM1") || die "Can't open port\n"; $PortObj->baudrate(9600); $PortObj->parity("none"); $PortObj->databits(8); $PortObj->stopbits(1); $PortObj->write_settings || undef $PortObj; my $stt = pack 'H16', 'FF010003005F630A' ; $PortObj->write($stt); $PortObj->close || warn "Close Failed!\n"; undef $PortObj;
The serial monitor shows that my program is initializing the serial port and able to set baud, etc. However, the write command does not cause any serial output at all. I replaced the hex pack string with a simple text string as a test with a \n and a \r, but again, the command does nothing. I set perl.exe to run as administrator but that did not matter. It almost seems as if Windows is preventing me from writing to the serial port in some way. I turned off Windows Firewall but that did not help. Any ideas on how I can debug this one?

In reply to can't write-Win32::SerialPort by franko

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.