• The mystery of 9 bits contained within 8 bits

I found a way of storing 9 bits of information within 8 bits.

Morse code has 1 dit or 1 dah up to a combination totaling 6 bits of information.

I decided that I would represent a 0 as a dit, and a 1 as a dah. Then I decided I would use the lower 3 bits to represent a bit count register. Bits 1 thru 5 were possible and still fit into 8 bits. It took more thought to work out a work around to get 6 bits of Morse  code and have a 3 bit count register.  Then it occurred to me that I could use the binary 001, 010, 011, 101 as is, I just needed to work in 110 and 100. I recognized that 000 and 100 had both lower bits as a 0 and this was not the case with 1,2,3, and 5.  I also realized that the binary "4" bit position was the needed 6 th bit. So I came up with a numbering and a conversion scheme that works. B000 and B100 represent that 6 bits of Morse code are in this byte. B111 represents that 4 bits of Morse code are contained in this byte. B110 represents this byte contains no valid Morse code, skip this byte.

The Morse code byte is unpacked in this manner. The 3 LSB bits are masked out and tested. First for a B110, to skip around outputting bad data. Then if B000 or  B100 is present then the bit count is set to B110 and the Morse code byte is right shifted 2 times to position the LSB into bit D0 maintaining the 6 Morse code bits or shifted right 3 times to position the 1 thru 5 bits of Morse code to align the LSB with D0. The final step is to test if the bit count register contains B111,  then if B111 is present the bit count is set to B100.

So in the end I was able to pack 6 bits of Morse code plus a 3 bit count register totaling 9 bits, into 8 bits of data.

• The Ascii to Morse Code generator is working

The program reads an ASCII character string array.

The ASCII is tested for being in the range of 0x20 to 0x7F.  Any character not a Morse code character will be flagged as a no code and will be skipped.

The ASCII is used as a pointer to the data byte that holds the Morse code.

The Morse code is then output to the relay for a dit and a dah, but the PWM outputs have a dit output and another a dah output.

I managed to use one byte of data to contain 1 to 6 bits of Morse code, and a 3 bit register to contain the number of bits of Morse code contained in this byte.

I am still working on the final mix of output activity for the final performance but I am leaning toward a relay, with possibly one or more piezo sound devices.