4831

Originally designed for another purpose, but maybe usefull for foxhunt, a beacon transmitter or practice.

Hardware
========
A small microcontroller (IC1 = PIC12F1840) is the heart of the circuit. Because only a 12V power supply was available IC2 is added to supply the required 5V for the microcontroller. There are 2 outputs: a tone, which is filtered a bit by R1 and C4 and a relay (for instance to operate a light or a CW-transmitter). Eventually a high impedance speaker (plus series resistor) can be connected to pin 2 directly (min. 200 ohm).
The string to send as morse code is selected with JP1 and JP2 (no jumper = silence, only JP1 = string 1, only JP2 = string 2, both jumpers = string 3). If a jumper is placed the device keeps sending the selected string followed by a pause.
JP3 is the programmer interface for the microcontroller, but also a connection for external devices.
The generator can be used in one of 3 ways:
  1. with fixed settings; pin 2 and 5 of JP3 are connected
  2. with potentiometers to change speed and tone 
  3. with a serial interface (I used an FTD232 to connect with USB).Normally the USB-device is only connected if the settings or strings have to be changed; otherwise only the wire for version 1 is present.


Software
=======
The program is written in the C-language and can be compiled by the Knudsen C-compiler (https://www.bknd.com/cc5x/index.html). The free version will do the job. In the zip-file both the source code and the compiled hex file are present.
At program start the voltage on GP1/RxD is determined. If it is below 4.7V (AD-value = 240)  then potentiometers are assumed. If the voltage is higher then a serial device like FTD232 or a wire is assumed. Therefore pin 5 of JP3 must not be left floating.
Timer 0 is used to generate the tone. After overflow of this timer an interrupt is generated and the timer is reset to a start value. The higher this value, the higher the frequency.
Timer 1 is used to set the basic timing of the morse code generated. The timer is reset as soon as a compare value is reached. The higher the compare value, the lower the speed.
Following settings are burned into the EEPROM:
- speed of transmission/length of a dot, default Tdot=205 ms
- tone (pitch), default 800 Hz
- pause between transmissions, default 20 seconds
- string 1 (Max. 31 characters)
- string 2
- string 3
If a serial interface is used, all settings can be re-programmed through the interface. If potentiometers are connected the values for speed and tone are derived from the analog inputs.

Operation
========
Connect the required components to JP3 according to the schematic, depending on your wishes.
If a string has to be send repeatedly also connect JP1 and/or JP2.
If a new program has to be burned into the microcontroller through JP3, jumper JP2 MUST be open. Because all pins of the microcontroller are used by the circuit low-voltage programming is not possible. If one string is enough for you, LVP is possible. In that case JP2 must be replaced by a 10k resitor, R4 must be omitted and LVP must be set to ON in the program.
The serial interface is activated if both JP1 and JP2 are open. Following commands are available:
  • '1', '2' or '3' = send string 1/2/3
  • 'A', 'B' or 'C' = write string 1/2/3 into EEPROM
  • 'M' = live message; the code is sent as you type. Because there is a FIFO of 100 characters you can eventually copy and paste short texts. Stop with the escape-key.
  • 'P' = set pause (0-9), pause between 2 transmission (0 = 5 seconds and 9 = 50 seconds)
  • 'S' = set speed (0-9), duration of a dot (0 = 40 ms and 9 = 400 ms)
  • 'T' = set tone (0-9), pitch (0 = 490 Hz and 9 = 1600 Hz)
  • 'H' or '?' = show short helptext
Commands 'P', 'S' and 'T' must be follwed by a single number ('0' to '9'); any other input will generate an error. Commands 'A', 'B' or 'C' are immediately followed by a string of max. 31 charcters followed by an escape. During transmission of string 1, 2 or 3 the serial interface will not respond, but characters sent are stored in the FIFO and will be evaluated after the transmission.
Baudrate is 9600, 1 startbit, 8 databits, 1 stopbit.