The PIC10F has a very, very small addressing space. The PIC10F200 has only 256 instructions in Flash memory and virtually no SRAM space. The message must be stored in the program space as a RETLW array.
The program space must also store the decoding code so the simpler, the better. For example, it's not possible to store a ASCII->Morse translation table. So the message must be stored in a pre-encoded format that is both compact and straight-forward to interpret.
I have chosen to limit the Morse "characters" to 5 tics, and the number 5 fits in 3 bits. Hence 5+3=8 and a character fits in a byte.
- 3 LSB give the "tic count" (how many dit/dahs) (the case of 0 means "space")
- 5 bits give the lengths of the respective tics (0 for dit, 1 for dah)
The translation is performed during assembly with a list of #define so the software is very simple and no storage is lost. The whole program is less than 60 instructions...
Discussions
Become a Hackaday.io Member
Create an account to leave a comment. Already have an account? Log In.