01. Simply put - Thank you haukex and Marshall.

02. Yes, adding a 'sleep()' Command below each '$port->write*()' solved my Dilemma. However, I used 'Time::HiRes' - usec() Function for delays less than 1 Second.

I also see the usefulness of the ''IO::Termios' Module' Functions.

Below is a complete Code Example:
#!/usr/bin/perl #use strict; #use warnings; use Device::SerialPort; use Time::HiRes qw(usleep); sub Handle_FTdx1200{ my $delayValue=100000; my $port = Device::SerialPort->new("/dev/cu.usbserial"); $port->databits(8); $port->baudrate(4800); $port->handshake("rts"); $port->parity("none"); $port->stopbits(1); $port->write_settings || undef $port; $port->write("FA;"); usleep($delayValue); my $VFOA=$port->read(11); $port->write("MD0;"); usleep($delayValue); my $Mode=$port->read(5); $port->write("PC;"); usleep($delayValue); my $Pwr=$port->read(6); $port->close(); $VFOA=substr($VFOA, 2, 8); $Mode=substr($Mode, 3, 1); $Pwr=substr($Pwr, 2, 3); $Pwr=int($Pwr); $Pwr="$Pwr"; return($VFOA, $Mode, $Pwr); } my ($tFreq, $tMode, $tPower)=Handle_FTdx1200(); print($tFreq); print("\n"); print($tMode); print("\n"); print($tPower); print("\n");
03. Apparently, in my initial Perl Code, I did not try the 'sleep()' Function.
It is in AppleScript that a delay Function, after any 'serialport Function, is required.

Below is AppleScript Code to set the Keyer Speed to 38 Words per Minute.
set desiredPort to "/dev/cu.usbserial" set tSpeed to "38" try set tPort to serialport open desiredPort bps rate 4800 data bits 8 + parity 0 stop bits 1 handshake 3 delay 0.1 serialport write ("KS;") to tPort delay 0.1 set originalSpeed to serialport read tPort delay 0.1 set originalSpeed to (get (characters 4 through 5 of originalSpeed +) as string) as integer serialport write ("KS0" & tSpeed & ";") to tPort delay 0.1 serialport write ("KS;") to tPort delay 0.1 set currentSpeed to serialport read tPort delay 0.1 set currentSpeed to (get (characters 4 through 5 of currentSpeed) +as string) as integer display dialog "Original Speed: " & originalSpeed & return & "Curr +ent Speed: " & currentSpeed giving up after 5 buttons ("OK") default +button "OK" serialport close tPort on error serialport close tPort end try
In conclusion - again, thank you - to the both of you.

In reply to Re: Cannot write to, or read from, the SerialPort by macdev
in thread Cannot write to, or read from, the SerialPort by macdev

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.