Mega16 text beacon keyer from qsl.net/zs1agx/mega16

The tbk.hex program generates D/A data to change frequency of xtal osc for beacon that is received
on USB or LSB receiver . The program also generates test audio tones (in phase quadrature) that can
be used for testing. [The two dot net programs wfalltbk.exe and slfft_gx.exe are waterfall display
programs that can also generate .wav audio same as the mega16 tbk.hex]. There is an addition android
program that generates cset2.asm that can be used either by the mega16 tbk.hex or by either waterfall program.
When the bootloader is used, the tbk.hex can be programmed into the mega16 and then the cset2.asm can be assembled
and also programmed into the mega16. Then CSET allows change to other font set.

use the tbk\tbk.hex to program the mega16, remember to set fuses low byte 0001 1111

(to experiment with mega16, burn the bootloader and use AvrOspII on PC) sp12 is old DOS program to program AVR
The bootloader will also allow the tbk.hex to be programmed into the mega16

otherwise:
The folder cset2 contains an .apk to design a new font (Android 5,large screen) This creates an .asm file that must be
assembled to a .hex and programmed together with the original tbk.hex

The folder tbk contains the .hex file for the text beacon keyer
The folder BL contains .hex for 19200 bootloader for mega16 uses pC1

The (low) fuses  should be set to 0001 1111 for brown out and external XTAL:
BODLEVEL=0, BODEN=0 (enabled), SUT1=0, SUT0=1,  CKSEL3/2/1/0 all 1

Setting for hyperterm connection:
ANSI: 9600,8N1 (9600 for a keyr with 8Mhz xtal)
Backspace sends crtlH backspace ctrlH
ASCII Setup, Sending: both 'send line ends' and 'echo typed' UNCHECKED
ASCII Setup, Receiving: 'Append LF' CHECKED. 'Force' UNCHECKED , 'Wrap' CHECKED



Bootloader
The bootloader is included as extra; it is a separate program  and is included
here only because it might be of interest (and it works).

The bootlm16.hex is a avrOspII pre-assembled bootloader.
This bootloader (when resident within mega16) allows programming of mega16 via PC USB COM port.

This looks for PINC,1 to be a low level if BOOTRST = 0 (programmed), install pullup at PINC,1

BOOTSZ1=1 BOOTSZ0=0 for $1F00
so the high fuses are x101 1100
x,JTAG disabled, SPI enabled, CKOPT=1 (unprogramed), EESAVE=1, BOOTSZ1=1, BOOTSZ0=0, BOOTRST=0
The (low) fuses are 0001 1111
BODLEVEL=0, BODEN=0 (enabled), SUT1=0, SUT0=1,  CKSEL3/2/1/0 all 1

The bootloader runs at 19200 with an 8Mhz XTAL,

The lock bits are set to  xx10 1111
BLB12=1, BLB11=0,   BLB02=1, BLB01=1, LB2=1, LB1=1
with LB2=1 and LB1=1, there is no memory lock
with BLB02=1,BLB01=1, there are no restrictions on SPM/LPM
with BLB12=1,BLB11=0 the SPM is not allowed to write to bootloader section

The SPI cannot be disabled with serial MISO/MOSI programmer.
The fuse bits are not affected by device erase.
The fuse bits cannot be programmed via OspII.

with sp12 (old real LPT: port programmer), the bootloader is programmed with
sp12 -M8 -wF00011111 -wH1011100 -wpfC bootlm16.hex  -wL101111 -P2
(this shows Fuses,High and Lock bits as used)

Ensure that 'configure' of AvrOspII is set to 'OSP II' (not 'AVR911')
Select 19200 and the correct PC USB COM port for 8Mhz xtal.
Notice that OspII 'erase device' does not clear EEPROM, but the blank EEPROM can be read and saved beforehand.




mode  pB2 pB1 pB0  single pixel time,  column time
   0    0   0   0     50mS                    
   1    0   0   1     50mS                                       repeat column
   2    0   1   0     50mS       	   		    
   3    0   1   1     50mS                                       repeat column
   4    1   0   0   20,25,33,50,100mS     100mS                 	
   5    1   0   1   20,25,33,50,100mS  100mS+100mS               repeat column
   6    1   1   0   20,25,33,50,75mS   100mS or 75ms*   
   7    1   1   1   20,25,33,50mS  -   100mS+100mS or 50mS+50mS* repeat column (selected with no switch installed)
 
 A jumper on pB4 is needed to select between programming and beacon modes.

commands via 9600bps Serial

m_save:	.db "SAVE",0,0	;1
m_test: .db "TEST",0,0	;2
m_reset: .db "RESET",0 ;3
m_load: .db "LOAD",0,0 ;4
m_cset: .db "CSET=",0 ;5
m_tilt: .db "TILT=",0; 6
m_slow: .db "SLOW=",0 ; 7
m_tild: .db "CHAR=", 0 ; 8
		.dw 0 
   .org $0D00
messcmd: .db "!LOAD !TEST !RESET !SAVE !CSET= !SLOW= !TILT= or ?",0x0d
messhlp: .db "Type in message, then !SAVE",0x0d	; term with 0 for DRE
messnone: .db "No message to save?",0x0d
messnl: .db "No EE message found", 0x0d
messok: .db "ok", 0x0d
sendqt: .db "?",0x0d
 
here are some characters  to try in cset2.asm :
0x05,0xb8,0xa8,0x85,0x28,0x38
0x05,0x3e,0x29,0x02,0xa9,0xbe
0x05,0x26,0x91,0x84,0x11,0xa6
0x05,0x9c,0x2b,0x84,0xab,0x1c
A quick way to test a new character is with !CHAR=5,26,91,84,11,a6  Then type a ? to check. 
Then include a Tilde character in the message; this new character is always sent in single column mode with 100mS fixed time.

!SLOW=1 is 2* 100mS speed, !SLOW=2 is 4* the 100mS speed, !SLOW=3 is 8* the 100mS speed, and !SLOW=4 is 32* the 100mS speed.
Reset to 100mS with !SLOW=0

!SAVE saves the message and the current CSET,TILT and SLOW values. Either TILT or SLOW, not both as same time:

!CSET is used to select alternative font/character set if the .apk was used to create one

you can also try !TILT=1       (or 2 or 3 or 4)
you can also try !TILT=-1      (or -2 or -3 or -4)
then !TILT=0 to reset it       (!TILT only works for the audio)


Most RS232 accept 0v as negative voltage input; make sure that the 10k returns to +5v and it is the
4k7 that returns to +12v! Set the 9600bps 8N1 for Fdx with incoming (from keyer) CR translate set
to CR/LF.
