OwenDuffy.net 


Simple Morse beacon keyer - EEPROM data structure

The Simple Morse beacon keyer (SMBK) architecture is that algorithms are in flash memory, and to the greatest extent possible configuration data is held in EEPROM. This makes it easy to make configuration changes and does not require access to a C compiler.

In use

EEPROM images in Intel hex format suitable for a device programmer are created for download by an online transaction embedded in the project page at Simple Morse beacon keyer .

Fig 1:
 

Fig 1 shows the data entry form for the EEPROM image generator.

The bits and bytes

The EEPROM data structure is designed to be flexible, and as a result includes a variable number of variable length data items.

eeprom:

Offset Variable Type Length Description
0 ver uint8 1 EEPROM version
1 options uint16 1 option bits
3 isync uint16 1 internal sync counter limit
5 esync uint16 1 external sync counter limit
7 toc toc_entry[8] 16 list of toc_entry

toc_entry[n]:

Offset Variable Type Length Description
7+2n offset uint16 1 offset of msg[n]

msg[n]:

Offset Variable Type Length Description
+0 msg_len uint8 1 length of msg data
+1 skip uint8 1 skip
+2 msg[] byte msg_len-1 encoded msg

Example

Fig 2:
:10000000040300701758021700210033003A00471C
:100010000047004700470009008888E1F5CFF7F462
:100020008B1100E1F5CFF7F4EFD1EFEDE2C0C0E2C4
:10003000FBEFD10603E1F5CFF7F40C00898989EFD6
:09004000E1F5CFF7F4EF00010037
:00000001FF

Fig 2 shows the Intel hex format file generated by the example shown in Fig 1. The Intel hex format includes address prefixes on each line and a checksum at end of line, so it isn't so easy to interpret.

Fig 3:
C:\>dump eeprom.bin
eeprom.bin:
00000000 0403 0070 1758 0217 0021 0033 003a 0047 ...p.X...!.3.:.G
00000010 0047 0047 0047 0009 0088 88e1 f5cf f7f4 .G.G.G.....auOwt
00000020 8b11 00e1 f5cf f7f4 efd1 efed e2c0 c0e2 ...auOwtoQomb@@b
00000030 fbef d106 03e1 f5cf f7f4 0c00 8989 89ef {oQ..auOwt.....o
00000040 e1f5 cff7 f4ef 0001 00                  auOwto...

Fig 3 shows a dump of the hex file after it is converted to a simple binary file. This is better, you can start picking your way through the fields and following pointers.

Fig 4:
 

Fig 4 shows the Intel hex file imported into Hex Editor Neo. Hex Editor Neo Professional contains a really useful facility to bind a structure definition to the binary file contents, allowing exploration of the structure using the structure element types, sizes, labels etc. The cursor hint in Fig 4 shows that the word containing 0x0017 is a pointer to a structure and expands the structure including using enumerated types for the encoded Morse symbols). Isn't that clever!

Fig 3:
#include <stddefs.h>

enum EncMorse: unsigned char
{
A=0xF9,
B=0xE8,
C=0xEA,
D=0xF4,
E=0xFC,
F=0xE2,
G=0xF6,
H=0xE0,
I=0xF8,
J=0xE7,
K=0xF5,
L=0xE4,
M=0xFB,
N=0xFA,
O=0xF7,
P=0xE6,
Q=0xED,
R=0xF2,
S=0xF0,
T=0xFD,
U=0xF1,
V=0xE1,
W=0xF3,
X=0xE9,
Y=0xEB,
Z=0xEC,
_SP=0xEF, //space
_0=0xDF,
_1=0xCF,
_2=0xC7,
_3=0xC3,
_4=0xC1,
_5=0xC0,
_6=0xD0,
_7=0xD8,
_8=0xDC,
_9=0xDE,
_SL=0xD2, ///
_OP=0xD6, //()
_EQ=0xD1, //=
_PL=0xCA, //+
_S0=0x80,
_S1=0x81,
_S2=0x82,
_S3=0x83,
_S4=0x84,
_S5=0x85,
_S6=0x86,
_S7=0x87,
_KU=0x88,
_KD=0x89,
_YU=0x8A,
_YD=0x8B,
_SQ=0x8C, //single quote
_A0=0x8D, //aux off
_A1=0x8E, //aux on
_1U=0x8F, 
_1D=0x90,
_DQ=0x92, //double quote
_DE=0x95, //.
_AT=0x9A, //@
_BS=0x9E, //\
_MI=0xA1, //-
_CP=0xAD, //)
_CO=0xB3, //,
_CL=0xB8,
_EU=0xB9,
_ED=0xBA,
_NO=0xBB
};

typedef struct{
int8 msgl;
int8 skip;
EncMorse msg[msgl-1];
} msg_t;

typedef struct{
uint16 msgp as msg_t*;
} msgptr_t;

public struct smbk_eeprom{
int8 ver;
uint16 options;
uint16 isync;
uint16 esync;
msgptr_t msgptr[8];
//msg_t msgs[*];
} ; 

The structure definition used by Hex Editor Neo Professional is shown above in Fig 5. There may be better ways to implement this, but this is simple and I am but a beginner with Hex Editor Neo Professional!

So, there you go... all you need to know if you wished to implement your own client program to generate the EEPROM image.

Links

Changes

Version Date Description
1.01 01/11/2012 Initial.
1.02    
1.03    
1.04    
1.05    

 


© Copyright: Owen Duffy 1995, 2021. All rights reserved. Disclaimer.