[WT-support] Access to antenna controller from LUA-script

gt-i at gmx.net gt-i at gmx.net
Sun Dec 18 01:02:14 CET 2016


Bob,
I just figured out the nasty trick: the antenna switch installs a 
virtual com port named "COM14". Using this in a call to io.open will 
create a text file under windows. One has to name all com-ports > COM9 
in UNC notation. Here is the adapted code line:
local rsw62 = io.open("\\\\.\\"..RSW_COMPORT, "w")
Thanks for your support.
73 Gernot, DF5RF


Am 16.12.2016 um 01:25 schrieb Bob Wilson, N6TV:
> If you install Portmon 
> <https://technet.microsoft.com/en-us/sysinternals/portmon.aspx> you 
> can trace all bytes being written to the serial port. Perhaps it 
> requires DTR=ON RTS=ON instead of OFF or a different baud rate that 
> what I've hard coded in the MODE command.  Send me your script as an 
> attachment and a PDF file documenting the required command stream for 
> your antenna switch device, and I'll take a look.
>
> I wrote bytes to an FTDI serial port using my script, and it seemed to 
> work fine, the trace showed the bytes being written OK, encluding SOH 
> and ETX.
>
> 73,
> Bob, N6TV
>
> On Thu, Dec 15, 2016 at 4:15 PM, <gt-i at gmx.net <mailto:gt-i at gmx.net>> 
> wrote:
>
>     Bob,
>     good hint. However, after playing quite a while, I'm pretty sure
>     that io.write does not send anything out, instead it seems to
>     write it to an internal buffer which I can check using :read(1). I
>     tried :flush() and :setvbf("no") which did not cure this. I also
>     played with variations of io.open(.."w", "r+") etc. I tested on a
>     phyiscal COM-port with an Echo-plug (RX/TX, all Modemlines
>     connected to each other), to a virtual one using com0com etc - no
>     change.
>     Any other idea?
>     Tnx,
>
>     Gernot DF5RF
>
>
>     Am 14.12.2016 um 23:43 schrieb Bob Wilson, N6TV:
>
>         Win-Test includes the Lua version 5.1 interpreter, which
>         supports decimal escape sequences in string literals.  (Only
>         Lua 5.2 and later supports hex escape sequences.)
>
>         So to write the string TEST, preceded by SOH (1 decimal) and
>         terminated by ETX (3 decimal), you may simply code:
>
>         device:write("\1TEST\3")
>
>         You may specify up to three decimal digits after the
>         backslash, \0 to \255 (for 0x00 to 0xFF).  If you need a CR or
>         LF, you may use \r or \n .
>
>         You may find this ASCII to decimal lookup table helpful:
>
>         https://courses.engr.illinois.edu/ece390/books/labmanual/ascii-code-table.html
>         <https://courses.engr.illinois.edu/ece390/books/labmanual/ascii-code-table.html>
>            
>         <https://courses.engr.illinois.edu/ece390/books/labmanual/ascii-code-table.html
>         <https://courses.engr.illinois.edu/ece390/books/labmanual/ascii-code-table.html>>
>
>
>         Attached is a much improved serial port script that runs the
>         Windows MODE command only once, instead of every time you run
>         the script.  It also accepts the COM port number 1-99 as an
>         script argument so that you don't have to answer a prompt for
>         COM port number the first time you run it.
>
>         Win-Test reflector subscribers may not see the attachment, but
>         there will be a link to a "non-text attachment" in the
>         reflector archives for this month
>         <http://lists.f5mzn.org/pipermail/support/2016-December/
>         <http://lists.f5mzn.org/pipermail/support/2016-December/>>, at
>         the bottom of this post, where you should be able to view and
>         download it using your browser.  During download, be sure to
>         rename the file from *attachment.obj* to *COM_Test.wts*.
>
>         73,
>         Bob, N6TV
>
>         On Wed, Dec 14, 2016 at 1:09 PM, <gt-i at gmx.net
>         <mailto:gt-i at gmx.net> <mailto:gt-i at gmx.net
>         <mailto:gt-i at gmx.net>>> wrote:
>
>             Bob,
>
>             thanks for sharing, this is what I was looking for.
>         However, it
>             does not seem to work with the antswitch and since it is a
>             USB-VCOM port I cannot check externally. The protocol requires
>             special bytes like SOH (0x01) and ETX (0x03) - maybe those
>         will be
>             filtered out somehow? Any idea how to make sure these
>         characters
>             will be sent out unchanged?
>
>             73
>
>             Gernot, DF5RF
>
>
>     _______________________________________________
>     Support mailing list
>     support at win-test.com <mailto:support at win-test.com>
>     http://lists.f5mzn.org/cgi-bin/mailman/listinfo/support
>     <http://lists.f5mzn.org/cgi-bin/mailman/listinfo/support>
>
>
>
>
> _______________________________________________
> Support mailing list
> support at win-test.com
> http://lists.f5mzn.org/cgi-bin/mailman/listinfo/support



More information about the Support mailing list