I can write to, and read from, a TRENDnet TU-S9 USB to RS-232 Adapter via AppleScript and Python; not with Perl.
I cannot figure what I maybe missing or configured improperly.
Any Assistance is welcomed and appreciated.
#!/usr/local/bin/perl use strict; # Computer: iMac 2017;, USB to Serial Adapter: TRENDnet TU-S9; # Just showing the Locations of the 'SerialPort' Files. #use lib "/usr/local/lib/perl5/site_perl/5.36.0/darwin-2level/auto/Dev +ice/SerialPort/SerialPort.bundle"; #use lib "/usr/local/lib/perl5/site_perl/5.36.0/darwin-2level/Device/S +erialPort/SerialPort.pm"; use Device::SerialPort; # I tried each of the below my $port = Device::SericalPort->new ...Lin +es of Code. #my $port = Device::SerialPort->new("/dev/cu.usbserial"); #my $port = Device::SerialPort->new("/dev/tty.usbserial"); #my $port = Device::SerialPort->new("/dev/ttys0"); my $port = Device::SerialPort->new("/dev/ttys1"); # Like the three (3 +) Lines above, this Driver produces the same Result. # The below Parameters are from my AppleScript and Python Code , which + both work flawlessly via the TRENDnet TU-S9. $port->databits(8); $port->baudrate(4800); $port->handshake("rts"); $port->parity("none"); $port->stopbits(1); #$port->write_settings || undef $port; print "01"; print "\n"; $port->write("FA21050000;"); # Write "FA21050000;" Hz to Yaesu FTdx-1 +200 Transceiver to set VFO-A Frequency. # The VFO-A Frequency is NOT changed. print "02"; print "\n"; $port->write("FB;"); # Write "FB;" to FTdx-1200 to have Trans +ceiver place Frequency of VFO-B into its Buffer. my $byte=$port->read(11); # Read the VFO-B Frequency, in "FBXXXXXX +XX;" Format print "$byte"; # Print expected returned Frequency, in +"FBXXXXXXXX;" Format, where XXXXXXXX is Freq. in Hz. print "\n"; #The VFO-B Frequency is NOT retreived from the FTdx-1200 Transceiver. print "03"; print "\n"; $port->close();
Instead of seeing:
01 ... followed by the, Variable Frequency Oscillator, VFO-A change to '21050000' Hz- which does not occur.
02
FBXXXXXXXX; ... where 'XXXXXXXX' is the Frequency, in Hz, which is what ever VFO-B is set to.
03
... what is displayed is:
01 ... VFO-A is not changed to '21050000' Hz.
02
03
In reply to Cannot write to, or read from, the SerialPort by macdev
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |