Seeing the request for self modifying macros, I thought I'd re-post these 
how-to documents that I posted on this reflector a number of years ago. 
Hopefully they will help you understand how to create your own macros which can 
be used to rotate between a series of parameter changes via a single PF1 or PF2 
key press. Have fun playing with them, without as many headaches that I had in 
learning how to get them to work.

73,
Rich - K1HTV

For those of you who want to play more with macros, here are four that I use to 
set up my K3 for USB, CW, DATA-A and RTTY. Parameters that are set up include 
mode, receiver bandwidth, audio input connector (Front Panel for microphone, 
rear Line-In jack for DATA-A modes), Mic Gain and Compression level for SSB, CW 
Speed, VFO lock for DATA-A modes like PSK31, JT65 and WSPR. You can add or 
change other parameters in the macros for the various modes as you see fit. 

Macros are created using the "K3 Utility" program on a computer connected to 
the K3 via one of its COM ports. 16 Macros can be save in the "K3 Utility" but 
only the first 8 macros can be uploaded to the K3. The macros can be tested 
using the "K3 Utlity" in real time. Once they have been uploaded to the eight 
K3 internal macro memory locations, they can be assigned to various keys. Each 
can be assigned to any of the M1-4 (Tap) keys, or M1-4 (Hold), or the PF1 or 
PF2 (Hold) keys. 

 ***NOTE***  

In the case below, 7 macros are created using the "K3 Utility" program.  The 
first 4 macros (associated with 4 different modes) are loaded into MACRO memory 
positions 1,2,3 & 4 and programmed into the PF1 key. The last 3 macros 
(associated with setting 3 different power levels) are loaded into MACRO memory 
positions 5, 6 & 7.

After they are loaded, when you HOLD the PF1 key the K3 will toggle between the 
USB, CW, DATA-A and RTTY modes. The 7 character mnemonic assigned to that mode 
wil flash briefly on the LCD screen. Wait for it to flash before HOLDing the 
PF1 button to toggle to the next mode.

In a similar manner, when you HOLD the PF2 key, the power K3 level will switch 
to one of three different power settings.
 
Mem  MacroLabel Macro Commands
------------------------------
#1   USB-PF1    MD2;LK0;MN053;DN;DN;MG026;BW0250;CP020;MN110;SWT12;SWH45;SWT14;

Explanation of commands:
(Set mode to USB;Unlock VFO;Select the Front Panel mic jack(MN053;DN;DN);Set 
bandwidth to 2.5 KHz;Set Compression to 20;Set Macro#2 to be next one used; 
Menu exit).

***NOTE***
After switching to the USB mode on 40M, 80M or 160M with the PF1H key, don't 
forget to hold the MODE (ALT) key to change to the LSB mode for those bands.


#2  CW-PF1     MD3;LK0;BW0040;KS025;MN110;SWT13;SWH45;SWT14;

(Set mode to CW;Unlocks VFO;Set bandwidth to 400 Hz;Set CW mode to REV (I like 
to tune up into CW signals); Set Macro#3 to be the next one used;Menu exit)


#3  DTA-PF1    MD6;DT0;MN053;UP;UP;BW0250;PC050;LK1;MN110;SWT24;SWH45;SWT14;
(Set mode to DATA Mode;Set to DATA-A mode;Select 'Line In' jack on rear of K3 
(MN053;UP;UP);Set Bandwidth to 2.5 KHz;Lock VFO;Set macro #4 to be the next one 
used; Menu exit)


#4  RTT-PF1    MD6;DT2;MN053;DN;DN;BW0050;PC080;LK0;MN110;SWT11;SWH45;SWT14;
(Set mode to DATA;Set to FSK-D;Set bandwidth to 50 Hz;Unlock VFO;Set macro #1 
to be the next one used;Menu exit) The next 3 macros (5,6 & 7) use the PF2-HOLD 
key to toggle the K3 between three power levels, 10, 50 & 100 Watts.

    MacroLabel Macro Commands
#5  10W-PF2    PC010;MN110;SWT29;SWH47;SWT14;
#6  50W-PF2    PC050;MN110;SWT33;SWH47;SWT14;
#7  100WPF2    PC100;MN110;SWT27;SWH47;SWT14;

= = =
The following refers to the 4 mode macros and the sequence chosen to switch 
between each of them.

The "#" below is the number of the macro memory location in which to store the 
particular macro in the K3.  Since each macro command references a particular 
K3 memory to be used, do NOT change the K3 memories in which the macros are 
stored without making any necessary changes to the "MN110;SWTnn;" command.

The sequence that holding the PF1 key will follow can be changed by changing 
the SWTnn command for each mode. In the example below, by holding the PF1 key, 
the switching sequence is USB, CW, DATA-A, RTTY, then back to USB. The two 
macro commands used to set up the next mode called is the MN110 (MACRO) 
followed by the SWTnn (keypad number 1-4) corresponding to the four modes 
programmed into those keys).

Here is what is used for the sequence USB,CW,DATA-A,RTTY,USB :
USB Macro #1 #1, MN110;SWT12 = Use Macro #2 (CW) next
CW Macro #2, MN110;SWT13 = Use Macro #3 (DATA-A) next
DATA-A Macro #3, MN110;SWT24 = Use Macro #4 (RTTY) next
RTTY Macro #4, MN110;SWT11 = Use Macro #1 (USB) next 

Here is what is used for the sequence RTTY,DATA-A,CW,USB:
USB Macro #1 #1, MN110;SWT24 = Use Macro #4 (RTTY) next
RTTY Macro #4, MN110;SWT13 = Use Macro #3 (DATA-A) next
DATA-A Macro #3, MN110;SWT11 = Use Macro #1 (CW) next
CW Macro #2, MN110;SWT11 = Use Macro #1 (USB) next

Here is what is used for the sequence CW,RTTY,DATA-A,USB:
CW Macro #2, MN110;SWT24 = Use Macro #4 (RTTY) next
RTTY Macro #4, MN110;SWT13 = Use Macro #3 (DATA-A) next
DATA-A Macro #3, MN110;SWT11 = Use Macro #1 (USB) next
USB Macro #1 #1, MN110;SWT12 = Use Macro #4 (RTTY) next

= = =

Once you have determined the mode sequence, here is the procedure used to 
program multiple macros into one of the PF1, PF2 or M1-8 keys: 

With the K3 powered on, open the K3 Utility.
Click on the "Port" tab then click "Test Communications".
If the test is successful, click OK and proceed. 
Click on the  "Command Tester/K3 Macro"  tab.
Click on "Edit Macros" in the upper right corner. 
You can cut the "Macro Label" and the "Macro Commands" from above and paste 
them into the correct boxes for each macro number. The #[1-7] identifies which 
macro memory number in the K3 Utiliy to paste the info into. 

When all the data has been entered:
Click on "Write Macros 1-8 to K3".
Click "Save" then close or minimize the K3 Utility.

Next, at the K3, to assign the four macros to the PF1 HOLD key:
1) Hold the MENU key.
2) Rotate the VFO-B dial so it reads to "MACRO" on the lower half of the LCD 
screen and the word "FUNCTION" above it.
3) Tap the first macro # to be entered (tap keypad #1). The LCD will read 
"Function MACRO #"
4) HOLD the PF1 key until "PF1 SET" appears. Next tap keypad #2, the hold PF1 
again, then tap keypad #3 and hold PF1. Finally tap keypad #4 and hold PF1. All 
macros have now been programmed into PF1-HOLD key.
5) Tap the "Menu" key and MACRO will disappear from the LCD display.

Follow the same steps to assign the three "Power Level" macros 5,6 & 7 to the 
PF2-HOLD key.

Test the mode change with repeatedly HOLD (not TAP) the PF1 key. You should see 
a brief mnemonic on the LCD screen for each mode.
Test power level with HOLD of the PF2 key. You should see a brief mnemonic on 
the LCD screen for each power level.


73,
Rich - K1HTV
ps

There is another macro which can be placed in the 8th memory and assigned to 
the M4 (HOLD) key:

Mem  MacroLabel Macro Commands
------------------------------
#8   SCAN-M4    SWT15;SWT15;SWT15:SWT15;SWH41;

Follow the same 5 steps above to assign the macro in K3 macro memory #8 to the 
M4 (HOLD) key.

To do a scan, first set VFO-A to lowest frequency to be scanned. Next set VFO-B 
to the highest frequency to be scanned. Tap V>M then rotate VFO-A to channel 
00. Tap V>M again to store the two freqs in Frequency Memory channel 00.  To 
start the scan hold the M4 key.

= = = = = = = = =

Wayne,

*Q1*: Did you just say that macros can be self-modifying!  I haven't
found the Write commands to do that yet.  Can you or any other really
smart guys elaborate?

For example, Let's say I'd like to create a toggle with a single macro. 
I would like it to do this without having an external application
controlling things.  So, internal to the K3, a macro would perform one
or more functions, then before exiting, would rewrite itself to "unset"
what was just done.

............

All this comes from my experience in making SCOM 7K controllers self
modify it's macros to make wonderful things happen.

Thanks!   This is about to become very interesting...

KD4Z - Warren
(K3 / P3 Kits scheduled to arrive this Monday)

______________________________________________________________
Elecraft mailing list
Home: http://mailman.qth.net/mailman/listinfo/elecraft
Help: http://mailman.qth.net/mmfaq.htm
Post: mailto:[email protected]

This list hosted by: http://www.qsl.net
Please help support this email list: http://www.qsl.net/donate.html
Message delivered to [email protected]

Reply via email to