#include #include volatile uint8_t msgIndex; volatile uint8_t timerCounter; volatile uint8_t counter2; volatile uint8_t audio; volatile uint8_t key; volatile uint8_t bit; volatile uint8_t pause; volatile uint8_t character; volatile uint8_t speed; volatile uint16_t callsign; volatile uint8_t keyDelay; #define PERIOD 6 #define A 0b11111001, #define B 0b11101000, #define C 0b11101010, #define D 0b11110100, #define E 0b11111100, #define F 0b11100010, #define G 0b11110110, #define H 0b11100000, #define I 0b11111000, #define J 0b11100111, #define K 0b11110101, #define L 0b11100100, #define M 0b11111011, #define N 0b11111010, #define O 0b11110111, #define P 0b11100110, #define Q 0b11101101, #define R 0b11110010, #define S 0b11110000, #define T 0b11111101, #define U 0b11110001, #define V 0b11100001, #define W 0b11110011, #define X 0b11101001, #define Y 0b11101011, #define Z 0b11101100, #define _SPC 0b11101111 #define _0 0b11011111, #define _1 0b11001111, #define _2 0b11000111, #define _3 0b11000011, #define _4 0b11000001, #define _5 0b11000000, #define _6 0b11010000, #define _7 0b11011000, #define _8 0b11011100, #define _9 0b11011110, #define _BRK 0b11010010 #define _KEYUP 0b10000000 #define _KEYDN 0b10100000 #define MSGMAX 9 #define SHORTSTART 0; int8_t msg[MSGMAX] = { K B _1 K I X _BRK, _2 _SPC }; uint8_t speeds[8] = {1, 2, 10, 30, 60, 100, 150, 200}; uint8_t dit[8] = {150, 150, 150, 150, 150, 150, 150, 150}; //uint8_t speeds[8] = {1, 1, 1, 10, 30, 60, 100, 200}; //uint8_t dit[8] = {150, 36, 30, 150, 150, 150, 150, 150}; // DIT SPEED WPM // 150 1 12wpm // 150 2 6wpm // 150 10 QRSS1 // 150 30 QRSS3 // 150 60 QRSS6 // 150 100 QRSS10 // 150 150 QRSS15 // 150 200 QRSS20 // 36 1 50wpm // 30 1 60wpm int main(void) { DDRB = 24; TCCR0B |= (1<= speeds[speed]) { counter2 = 0; if ((character == _KEYDN) || (character == _KEYUP)) { key = 0xff; bit = 0; } else { if (!pause) { key--; if ((!key) && (!bit)) pause = 2; } else pause--; } if (key == 0xff) { if (!bit) { msgIndex++; if (msgIndex == MSGMAX) { msgIndex = SHORTSTART; if (callsign > 6000) { msgIndex = 0; callsign = 0; speed = 0; } else { msgIndex = SHORTSTART; speed = (PINB & 0x07); } } bit = 7; // Get character from message character = msg[msgIndex]; // Look for 0 signifying start of coding bits while (character & (1<