CK3 Alarm Clock and Thermometer
(C) Lucid Technologies
6
is ON, which means a computer is connected to the RS-232 serial port (J2). If RTS is ON then
program control jumps to label HOST_COM. Host communications is discussed in the next section.
The program then reads and stores all 16 bits from the input shift registers, which includes the
TEMP bit. If TEMP bit is zero then program control goes to TEMP_MODE, otherwise it goes to
CLOCK_MODE.
In TEMP_MODE the program first calls the temperature read routine which reads the
Celsius temperature from the DS18S20, converts it to Fahrenheit, and stores both values in RAM. If
there is no response from the DS18S20 the display will show the message “Err1". This could
happen if a DS18S20 is not installed or is installed backwards. Next the program checks the CENT
(Centigrade or Celsius) bit from the previous read of the input shift registers. If CENT bit is zero
then the Celsius temperature is displayed, otherwise the Fahrenheit temperature is displayed. The
program then delays for approximately 9 seconds then jumps back to LOOP.
In CLOCK_MODE the program checks the A1ENB (Alarm1 Enabled) bit from the previous
read of the input shift registers. If Alarm1 is disabled the program clears the flags for the Alarm1
LED and the Alarm1 audio, then program control jumps to check Alarm2. If Alarm1 is enabled the
program set the flag for the Alarm1 LED and tests the Alarm1 interrupt bit from the previous read
of the input shift registers. If the Alarm1 interrupt is active the program sets the Alarm1 audio flag,
resets the Alarm1 interrupt on the DS1305, then adds 30 to the current minute count and stores the
sum in variable A1end. The program then follows the same process for Alarm2. Next the program
checks the Alarm1 set bit (A1set), from the previous read of the input shift registers, and if active
branches to the set Alarm1 subroutine. The program then checks the Alarm2 set and Time set bits.
The program then reads the current time from the DS1305 and displays. If the Alarm1 audio flag is
set and A1end time has not been reached the program calls the Alarm1 audio routine then jumps to
LOOP. If Alarm1 is inactive the program then checks Alarm2 in the same way. The alarm audio
routines produces about one second of audio before control jumps to LOOP. The time between calls
of the active alarm audio routine is about 160 microseconds so there is no audible interruption of
the sound.
3.5 Serial host communications
When the CK3 is connected via J2 to host computer running a terminal program setup as
shown in Appendix F, the clock display will blank and the following menu should appear in the
host computer’s terminal window.
Lucid Technologies - Clock3
Firmware B.03
1 Set alarm 1
2 Set alarm 2
3 Set clock
4 Display time
5 Display temperature
6 Display settings
7 Exit
?
Menu options are selected by typing the corresponding single number. In the following examples
Summary of Contents for CK3-1
Page 17: ...CK3 Alarm Clock and Thermometer C Lucid Technologies 17 APPENDIX B CK3 BOARD LAYOUT ...
Page 28: ...CK3 Alarm Clock and Thermometer C Lucid Technologies 28 ...
Page 29: ......
Page 30: ......
Page 31: ......
Page 32: ......
Page 33: ......