Elecraft KX3 Programmers Reference User Manual
Page 6

6
Creating and Using Macros
K3 Utility and KX3 Utility can be used to create and test macros. The first eight of these can be sent to the
transceiver, where they can be assigned to any of the programmable function switches. Macros can have a length of
up to 120 characters, along with a label of up to 7 characters.
Example (“SPLIT+2”): A>B, A>B, SPLIT, VFO B up 2 kHz, RIT/XIT off, assigned to PF1
To create this macro and assign it to a K3 front panel switch, you’ll need to complete all of steps 1-8 below. The
instructions are similar for the KX3, except that KX3 Utility is used, and some SWT/SWH codes are different.
1. Run K3 Utility.
2. Click on the Command Tester/K3 Macros tab.
3. Click on the Edit Macros button at the top of the screen. This brings up the macro edit window.
4. In MACRO 1’s Macro Label field, enter the label “SPLIT+2”.
5. In the Macro Commands field, enter:
SWT13;SWT13;FT1;UPB5;RT0;XT0; (the KX3 has differenent SWT/SWHxx codes)
Note: The number 5 in the “UPB5” command is not a value in kHz; it is an index into a table of step sizes. UPB5
moves VFO B up 2 kHz, DNB5 moves it down 2 kHz, etc. (there are similar commands for VFO A). For the full
list of UP/DN command variations, see the DN (down) command (page 8).
6. Click on Send Macros 1-8 to K3. Exit the edit window by clicking Save. The macro can now be tested from
within the Command Tester by clicking on its associated button. (The label won’t flash on VFO B when this is
done from K3 Utility – only when using the assigned switch at the K3.)
7. At the K3, locate CONFIG:MACRO x menu entry. Tap ‘1’ if the menu entry label is not already “MACRO 1”.
8. Hold
PF1
to assign PF1 to MACRO 1. Exit the menu.
From then on, using PF1 will flash SPLIT+2 and execute the above sequence.
Important Restrictions: (1) Macros normally only use SET commands, since they can’t make use of the response
from a GET. For a very useful exception to this rule, see the last sample in Table 2. (2) Macros should not use
meta-commands (like K31;) as this can interfere with software applications that control meta-modes. (3) Macros
can be used to send direct DSP commands (see ! and @, page 7), but at present this only works from K3 Utility, not
from K3 front-panel switches.
Simple Application Program
The pseudo-code program below displays the VFO A frequency (8 digits) while watching for the user to request a
frequency change via the PC keyboard. For details on individual commands, see the Command Reference section.
VfoControlLoop
{
SendCommand( “FA;” )
// GET frequency of VFO A
StringF = GetResponse( TIMEOUT_100MS )
// wait for response; include a timeout, just in case
Display( StringSubset( StringF, 5, 12 ) )
// show MHz through Hz digits on PC screen
If( KeyboardInput = “+” )
// up/down control could be a mouse click instead
SendCommand( “UP;” )
// this is a SET command that moves VFO A up
If( KeyboardInput = “-” )
SendCommand( “DN;” )
}