Ultra Clock for NEC PC-8201A UCLK17.BA 12/27/01 George T. Pasek Jr. NEC's Memory after Cold Boot: 12374 After Line.ba & Uclk16.ba loaded and run: 2577 **** Must run LINE.ba before running Ultra Clock **** Victor Landweber's NEC-LINE.BA Club 100 M100 Library Ultra Clock's main display is comprised of both Analog and 24 hr Digital clock displays. Across the top is the current date, current time in UTC (Universal Time Coordinate) and a day countdown counter. Across the bottom are the button/indicator for the Alarm, External Control, and GPS features. Most of the clock's operation is simple. Time and Date are set via Basic before running; Time$="HH:MM:SS Date$="YY/MM/DD. The displayed UTC time is the NEC's local time plus the # of offset hours (UO) as set in line 40. Central Daylight Saving Time is 5 hours, Central Standard Time is 6 hours. The Days Till Retirement (DTR) countdown counter is set for the # of days till I can retire (as of today it's 2227... What can I say?). That date can be changed in line 110 to reflect Christmas, Birthday, End of Year or whatever. The Julian date is calculated for that date as well as the current date and the result is displayed. Hitting "A" will pop up a window for the setting of the Alarm function. "T" will allow you to set the Time via the UP/DOWN arrow keys. Any key will advance from the hour to minute setting and then out (I use the right arrow button). The time is set in the 24 hr format so there is no AM/PM indicator. "A" will set the alarm active and the main screen [A] will change to inverse video to note the status. The Space Bar will exit this window and return to the main screen. When the alarm sounds, it can be silenced via the Space Bar or will reset after 1 minute. Hitting "C" will pop up the External Control function window. This turns On/Off the cassette Recorder Motor relay. Keep in mind that these are *LOW CURRENT* contacts and *WILL NOT* directly run your Christmas Tree, Swimming Pool Heater, or probably even a common 60 watt light bulb. So if you want to run anything other than a low voltage/current device, use this cassette relay to control a larger relay and connect your device to it's contacts. The Start and End times are set in the same manor as the Alarm function. There is Manual control for the relay available. If Manual Control is ON and the Time mode is also active, the relay will turn off when the END time is reached, and then turn back on at the START time. This is handy if you want to use the Time Function, but want the relay ON now. Also, the Manual ON/OFF display will reflect the relay status when in the Time mode. Hitting the "G" will bring up the GPS window. * Picking this function WITHOUT having a active Global Positioning System receiver connected to the 25 pin Serial Port will cause a Lock-Up and require a system reset *. This function looks for the NMEA GGA Sentence coming in the Serial Port from my Garmin GPSII. Among the various information in this sentence is the UTC Time and the # of satellites in view. So in the GPS window will be displayed the GPS UTC time, the NEC's calculated UTC Time and in the upper right will be the # of Sat's currently in view. Keep in mind that the NEC's clock is keeping Local Time and that the UTC Time is calculated by adding the offset (UO) to it. So even though UTC is being displayed, the NEC's clock's local time will be correctly updated if you chose to use the [S]ynchronize feature. The GGA sentence is only one of several NMEA sentences being sent in the serial port and it takes about 2 seconds for them to loop around so the time is accurate as displayed, it's just that it takes another 2 seconds before the GGA sentence comes back around. So now for the Disclaimer part. I program, but am not a Programer any more then I am a chess player just because I know how to move the pieces. Anyone can write programs, but it takes someone special to write them flawlessly. As you look through this program, there will probably many instances where your thinking "Why the heck did he do that!!". Well, it very well might be that I felt that it was the best way to achieve the result I was looking for using a minimum amount of memory and processor time, on the other hand maybe I simply couldn't think of any good way of doing it. So with that in mind, use this program at you own risk. I corrected all the bugs I found while using it and have been using it as a my bedroom alarm clock to wake me up in the morning, but I certainly wouldn't rely on it to run a Pace Maker. Don't expect to use this program as a good example of programing because it may be a better example of confusion. With this in mind, below is some information about the program itself. If you don't like the way something works or it doesn't do something you want.... Fix it, Change it, Modify it, Just don't complain to me about it. That said, I hope it might breath some life back into the old NEC's. Good Luck George T. Pasek Jr. pasek001@tc.umn.edu Lines of interest: 40 Set UTC Offset in Hrs 110 Retirement Date 410 "DTR" Subroutines: 0 Header 10 Init 100 Retirement Days Caculation 200 Draw Clock Face 300 Keyboard Handler 400 Screen Configure 450 Screen Reset 500 Analog Clock Update 600 GPS 700 Digital Clock Display 715-760 Digit Create 765-795 7 Segment Display 800 Alarm 900 External Control 1000 Data Screen Display Locations: Analog Clock X=63 Y=63 [A]larm 12,7 Set 20,7 [C]trl 22,7 Set 29,7 [G]PS 31,7 Info Box 70,12 - 234,50 Data 12,2 - 38,5 Digital Clk 103,13 - 184,32 Hr msd 103,13 - 120,32 Hr lsd 127,13 - 134,32 Mn msd 160,13 - 177,32 Mn lsd 184,13 - 301,32 Date 12,0 UTC 20,0 DTR 32,0 Variables: Used As AA 50,300 Alarm Active AH 800 Alarm Hour AM 800 Alarm Minute AR 50,300 Alarm Reset AS 800 Alarm Set B 100 Julian Temp Value C1 900 Control Start Hour C2 900 Control Start Minute C3 900 Control End Hour C4 900 Control End Minute CA 900 Control Active CS 900 Control Set CN 900 Control Manual CM 100 Current Month (xx) CD 100 Current Day (xx) CY 100 Current Year (xxxx) D 30 Data Counter GL 600 Lenght of GH$ HC 500 Hour Current HL 500 Hour Last HM 500 Hour Mark HT 700 Hour 10's HX(60) 25,500 Hour Arm X Location HY(60) 25,500 Hour Arm Y Location JD 100 Julian Date JR 100 Julian Retirement Date JC 100 Julian Current Date MN 500 Minute MT 700 Minute 10's MX(60) 25,500 Minute Arm X Location MY(60) 25,500 Minute Arm Y Location N 100 # of days between Retirement and Current Date O 700 Offset RM 100 Retirement Month (xx) RD 100 Retirement Day (xx) RY 100 Retirement Year (xxxx) TD 700 Time Digit UT 65 UTC Time UO 10 UTC Offset W 100 Weeks X Misc Counter KB$ 300 Keyboard Input GP$ 600 GPS Serial Input line GH$ 600 GPS Hour Time GM$ 600 GPS Minute Time GS$ 600 GPS Second Time EXEC 17091 Erase Function Key Line 17124 Display Function Key Line 17016 Turns Cursor ON 17021 Turns Cursor OFF 17046 Make Cursor Block 17051 Make Cursor Underline 17006 Inhibit Screen Scroll 17011 Enable Screen Scroll 17058 Start Inverse Video 17063 Cancel Inverse Video Motor1 Turns ON Cassette Motor Relay Motor0 Turns OFF Cassette Motor Relay Digital Clock Display: Segment Line# Digit Segment Digit Line # A 765 1 B C A 751 B 770 2 A B D E G F B 752 C 775 3 A B C D G G 753 D 780 4 B C F G E C 754 E 785 5 A C D F G D 755 F 790 6 A C D E F G 756 G 795 7 A E F 757 8 A B C D E F G 757 9 A B C F G 759 0 A B C D E F 750 Cassette Port Pinout as viewed from Rear of Computer: 7 * U * 8 1- Motor Relay Contact 5- Audio In (from tape) 6 * * * 2 2- Audio High Level Out 6- Gnd 5 * 8 * 3 3- Audio Low Level Out 7- Motor Relay Contact * 4- Gnd 8- 5vdc 4