[WT-support] Access to antenna controller from LUA-script
gt-i at gmx.net
gt-i at gmx.net
Wed Dec 14 22:09:58 CET 2016
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
Am 11.12.2016 um 02:29 schrieb Bob Wilson, N6TV:
> Here's a LUA example that you can follow or modify to suit your
> purpose. It sends the "P" command to power on an Elecraft KPA500.
> First it prompts for the COM port number of the amplifier, opens the
> COM port, and writes to the port. After that it won't prompt for the
> COM port again unless you restart Win-Test (or type REOPENNOW).
>
> 73,
> Bob, N6TV
>
> -- KPA500_ON -- Power on KPA500
> -- Time-stamp: "11 February 2015 05:32 UTC"
> -- Assign to: Text command KPAON
> --
> -- See also: KPA500_OFF.wts
> -- Written by N6TV
>
> MB_ICONWARNING = 0x00000030
>
> local ComPortNum = 0
> if KPA500_COM_PORT == nil then
> ComPortNum = wtApp:InputInteger("Enter serial port number used by
> KPA500\n" ..
> "Enter 1 for COM1:, 2 for COM2:, etc.", wtCurrentScript)
> if ComPortNum == nil or ComPortNum == 0 or ComPortNum > 99 then
> return -1
> end
> KPA500_COM_PORT = string.format("COM%d:", ComPortNum)
> end
>
> local modeCommand = string.format("mode %s 38400,N,8,1", KPA500_COM_PORT)
> local rc = os.execute( modeCommand )
> if rc ~= 0 then
> wtApp:MessageBox(
> string.format("The following command failed:\n %s\nReturn code =
> %d\nNo action taken.",
> modeCommand, rc),
> MB_ICONWARNING, wtCurrentScript)
> return -1
> end
>
> local kpa500 = io.open(KPA500_COM_PORT,"w")
> if kpa500 ~= nil then
> kpa500:write("P")
> end
> kpa500:close()
> return -1
>
>
> 73,
> Bob, N6TV
>
> On Sat, Dec 10, 2016 at 4:25 PM, <gt-i at gmx.net <mailto:gt-i at gmx.net>>
> wrote:
>
> Hello,
>
> I have an antenna controller running on a com-port which I would
> like operate from within Win-Test. I got the protocol and can do
> this on a terminal program, but switching programs during the
> contest is not what I want.
>
> Is there a way to have that using a lua-script?
>
> mni tnx, 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>
>
>
More information about the Support
mailing list