G4USP

Page last updated: 01/06/2012

Resultant software design:

    The software for the repeater controller was developed using MPLAB a propriety integrated development environment (IDE), which can be downloaded free of charge from Arizona Microchip. I found MPLAB to be an invaluable tool, intuitive in use, and with its simulator, I believe days were shaved off the development time of the software.

    The assembly listing for GB3HT  Ht_v1.asm 

            Software description

    Open Ht_v1.asm with MPLAB, or any text editing tool i.e. NOTEPAD if MPLAB is not available, however it is worth downloading and installing MPLAB as it formats the file in a way that makes it much easier to read.

    The assembly listing is organised and set out in a logical order, but a little further explanation of some sections / sub routines are in order

include p16f84.inc: when MPLAB compiles and assembles Ht_v1.asm the contents of P16F84.inc are included.  P16F84.inc simply contains the definitions the ports and commonly used registers associated with the PIC16F84 microcontroller used for the repeater controller, its contents could just as easily have been cut and pasted into Ht_v1.asm but using the command include and the file name p16f84.inc makes for a less cluttered assembly listing.

initialise: as its name suggests system initialisation takes place here. Interrupts are disabled, timer and prescaler is set up, I/O ports are configured, all software defined timers are cleared / reset, ident, alarm, & pip generators are initialised, and finally the system is armed.

main_loop: once initialised the system proceeds to the main loop, from this point onwards everything is accessed from within the main loop. Operating in this manor means should any routine freeze the HEARTBEAT LED will stop flashing.

status: the point at which all inputs are checked, the system is armed if CTCSS or toneburst is present, talkthrough is disabled for the duration of the toneburst, and alarms are checked.

en_tx, dis_tx, en_tt, dis_tt:  transmitter keying control and talkthrough control are dealt with by these four routines. Enabling and disabling transmitter keying is strait forward enough, however enabling talkthrough also enables transmit CTCSS and attenuates the output of the piptone generator.

cw_sequencer: this routine checks the CW timing marker prior to calling ident_send, then alarm_send, and pip_send, in that order if required. Note ident_send is called regardless of receiver status, however alarm_send and pip_send will be held off should the receiver be found to be active.

ident_init, ident_dat, & ident_send: these three routines are associated with CW identification. ident_init initialises / restarts the identification process, idend_dat contains the data array, whilst ident_send processes the data array and keys the piptone generator.

With the CW timing marker set for a Morse code dot time of 100mS which equates to a Morse code rate of 12 words per minute (12WPM). A dash equates to three dots, the pause between a dot and a dash in time equates to one dot, pause between letters equates to three dots, and pause between words equates to three dashes or nine dots.

GB3HT_C is thus encoded:

  1110111010001110101010001010101110111000101010100011100000000011101011101

With suitable pauses both prior to and post sending, and split into eight bit bytes, the data array becomes:

  00000000
  00000000
  00001110
  11101000
  11101010
  10001010
  10111011
  10001010
  10100011
  10000000
  00111010
  11101000
  00000000
  00000000

Note the sixth line of ident_send (XORLW 13), the figure contained here should equate to the number of lines of data within the ident_dat -1

alarm_init, alarm_dat, & alarm_send: these three routines are associated with alarm indication, and operate in much the same way as ident_init, ident_dat, & ident_send detailed above.

An alarm state is indicated by the sending of the characters 'ALM' prior to pips during normal use.

pip_init, pip_dat, & pip_send: these three routines are associated with pips, and operate in much the same way as ident_init, ident_dat, & ident_send detailed above.

The data array associated with pips can easily be amended to send the letter 'K' or 'R' if preferred, the data array is constructed in the same way as with ident_dat.

soft_timing: this routine generates the various timing markers required by the system. The primary timing markers are at 100mS for Morse code timing, 1S for the heartbeat LED and system arm timer, and 15m for identification cycle timing.

 

BACK  HOME