New (Undocumented) Superclock Features

Simple improvements not covered in the User Manual.

HOUR CHIME

The firmware now includes an extra output, PB6, which is lowered for one second every hour. This is the CHIME signal. The output goes low at the start of the "00" second of the "00" minute, and is raised one second later. There are several uses for this output, the most obvious being to operate a beeper. For example, a +5V powered solid state active piezo beeper could be connected between this output and +5V. The beeper would need to draw less than 10mA. Passive beepers could not be used in this way.

To use a passive piezo beeper, connect one end to the 1 kHz output PB4, and use a PNP transistor to connect the other end to +5V, connecting the collector to the beeper, and the emitter to +5V. Drive the transistor base via 10k Ohm from the CHIME output.

Another possibility would be to connect a 20 Ohm or 32 Ohm miniature speaker as the beeper. This would give a much nicer sound. The speaker can be connected via a diode to the PB6 pin, and to the 1 kHz output PB4 as a signal source. When the PB6 output is low, the diode conducts, and the 1 kHz tone is heard in the speaker. When PB6 is high, the diode does not conduct and there is no sound. An 8 Ohm speaker could be used, without causing damage to the micro, although the chime would not be very loud.

These options are documented in the drawing below.


The CHIME can also be used to operate external devices. One application would be to reset another micro, so that it always starts afresh on the hour. An example would be the LF Exciter in beacon mode. The output could also be used to trigger a voice announcement or musical chime. Note that the CHIME output is LOW when active.

The CHIME can be enabled and disabled by fitting a simple switch in series with one lead of the piezo beeper or speaker. It would not take much software effort to have the chime operate at 15 or 30 minute intervals, perhaps for a shorter duration than the hourly chime.

ALARMS AND TIMERS

There is no alarm or timer software provided at this point. The constructor could adapt the firmware to provide the necessary functionality. The CHIME output would obviously be available as an alarm signal. Another possibility would be to use the PB7 output (reserved for this purpose) as an ALARM or TIMER output for controlling external devices at pre-programmed times.

In order to generate different tones for the alarms or timers, it is recommended that these be generated by software timing in the main program, driving the PB7 output at an audio rate. In this way, the precision clock timing will not be affected, since it all takes place in interrupt routines.

Different pitches could be generated by mathematical and logical use of the content of the ICR1H:ICR1L registers, which count the main reference, and the MSECH:MSECL registers, which count milliseconds, but these must not be altered in the process. Changing the 1 kHz output pitch by changing the T1 timer compare value is not recommended as it would be difficult to achieve this without adversely affecting clock accuracy. The 1 kHz output could be changed permanently to some other value (500 Hz, 440 Hz etc), by changing the reload and making corresponding changes to the zero detection and reload of the MSECH:MSECL registers.

For alarm timing, use can be made of the MSECH:MSECL and UTCHR:UTCMIN:UTCSEC registers (which count milliseconds and hours/minutes/seconds), but these must not be altered or clock accuracy will be affected.

POWER FAIL

As already documented, when the AC mains power fails (the input PD2 goes low), the display indicates "BATT", to warn that the unit is operating from the backup battery. The software now also operates the CHIME output for one second every minute during power failure, to draw attention to the failure. This feature cannot be independently disabled. The feature will obviously be disabled when the CHIME output is disabled.

NETWORK TIME SERVER

The Superclock would make an excellent SNTP network master clock (time server). The time message provided would be fine, but it would be best to change it slightly so that it was the same as one of the standard protocols. This will avoid the need to write or adapt the SNTP driver software. The present format is:
<CR><LF>hh:mm:ss pppp
        ^

hh   = UTC hours 00-23        mm   = UTC minutes 00-59
ss   = UTC seconds 00-59      pppp = reference phase 0x0000-0x03FF
^    = UTC second event
Network time servers normally supply date (day of year) as well as time, so a small modification to include date and a means of setting it would be useful. Some formats also include such information as power supply status, which this clock can provide. Other optional data not provided can be set to zero or "?" - see the requirements for the individual drivers.

INPUTS AND OUTPUTS

There are two available user inputs, and four outputs. Use of other I/O is reserved for serial comms and LCD control. The details of user pins are as follows:

PORT/DIR  PIN    NAME      DESCRIPTION
PD2 IN     6     PFAIL     AC Power detection - low for power failure
PD3 IN     7     -         Not used
PB4 OUT   16     1KHZ      1 kHz ± 1ppm, square wave output, 50% duty
PB5 OUT   17     1HZ       1 Hz or 1 pps pulse, high 1 ms every sec
PB6 OUT   18     CHIME     Low for second zero of minute zero each hour
PB7 OUT   19     ALARM     Alarm or timer controlled output - unused

The CHIME output also goes low for second zero every minute when power failure is detected. Inputs and outputs use 5V CMOS levels. Outputs can sink or source 10mA. All inputs and outputs that can be accessed externally must be protected from potential static damage, for example by a series resistor and catch diodes, or series resistor and a shunt zener diode. See the schematic (connections to PD2) for an example.

EEPROM CONTENTS

There are only five bytes of EEPROM used.
ADDRESS         CONTENT    DESCRIPTION
0x0000-0003     0x00       Unused
0x0004          0x60       Comms baud rate (0x60 = 96, 9600 baud with 14.85 MHz reference)
0x0005-0006     0x1D00     Timer T1 reload value for 2 kHz interrupt (14.85 MHz reference)
0x0007          0x13       Local time offset

Copyright © M. Greenman 1997-2005. All rights reserved. Contact the author before using any of this material.
home HOME