T/R Sequencer

 
 

Any transceiver system has several items that must be switched in the proper sequence when transitioning between transmit and receive mode. For my rig, I decided to use a microcontroller to provide a programmable sequence of events on a series of digital outputs in response to the key input.


I chose the Zilog Z8 Encore XP series because:

  1. They come in DIP packages, as well as surface mount

  2. The CPU family includes a wide variety of I/O types, and an on-chip clock

  3. The evaluation board is cheap ($40) and uses a USB programming pod

  4. The evaluation kit comes with a full ANSI C compiler


Since I’m about 100X more productive in C than assembler, the free compiler was the clincher for this deal. CPU performance was not much of an issue since we’re only trying to do simple digital timing at the sub-milliseocond level.


Getting the evaluation kit going was pretty easy after reading the documentation. I actually used my MacBook, which is Intel-based, booted up in Windows XP, as the development system. That worked great. It didn’t work from Parallels, a virtual machine that allows most Windows applications to operate transparently under the regular Mac OS. Must be something funny about the USB support. Anyway, the example code that Zilog supplies was all I needed to get going.


I started out by listing the items to be controlled (T/R switch, receiver mute, VFO T/R frequency switch, etc.) and assigned delay times for each one. Times are different for T-to-R and R-to-T modes. The microcontroller timer resolves 0.1 ms, which makes it easy to dial in the delays precisely while testing the overall rig.

Since this microcontroller has nothing else to do, it’s main idle loop simply polls the key input, waiting for it to change state. The other thing that goes on continuously is the handling of interrupts from one of the counter-timers. The counter is set up to divide the on-chip clock (5.70 MHz) by 570 to produce an interrupt every 0.1 ms. When we need to start measuring elapsed time, we set a variable to zero and then increment it at each interrupt until the desire time is reached.


The program is a state machine with three states:

1. Key down: The key input just transitioned to the transmit mode. The code waits for a series of intervals to elapse, and sets output bits at desired times.

2. Key up: Similar to the key down state, but transitioning to receive mode.

3. Idle: The key state is not changing; it could be in either state. The code polls for a change of key state. 

Microcontroller T/R Sequencer Board

Timing jitter was plus or minus 50 microseconds (within one tick of the timer). I did have to adjust some of the times, especially the one associated with the sidetone so that its sound occurred at exactly the same time that carrier was produced. This project was so easy to build and the code was so easy to create and modify that I’ll be looking forward to another application in the near future.

Performance

Download Source Code:

   main.h

   main.c

Program Design

TR_Switch.html

Previous

Xmtr HomeTransmitter.html