REAL TIME CLOCK FOR THE CBM 128 RUNNING GEOS V1.2 OR V1.3 BY TIME G. CORCORAN TIMC4 ON Q-LINK DESCRIPTION The RTC is a fully self contained clock/calendar for the CBM machine. It offer permanent time and date and is accurate to +/- 1Min. a month at constant room temperature. It copes with leap years, months less than 31 days etc. Battery life is better than 28 years and there is a second backup battery in case of premature failure of the first. Power fail (like when you turn off your monitor for the night) is automatically detected. The RTC comes with software to support it under the GEOS operating system. The source of this code is included and the machine code to address the RTC may be examined and even used outside of GEOS to access the RTC from native 64/128 machine code. The RTC takes up no memory addressed in the system memory map, the selection is done using a 64-bit serial bit stream that has very little chance of occuring by accident. The manufacture reckons the odds are 1 in 10^19. I chose to mount the RTC internal to my 128. Originally, I designed it to plug into joystick port #2, but after a month or so of operation (and staring at the circuit sticking out of my otherwise sleek machine) I opened up the case and moved it inside. I describe both techniques, so choose whichever you prefer. If you have qualms about opening your machine then stick with the external version. The joystick port is still usable (provided that you provide the pass thru.) and construction is easy in either case. By the way, my RTC is accurate to 50 secs. per month. CONSTRUCTION The RTC has been built and tested in both formats, internal and external mounting. The external version will work on either a 64 or 128 machine. The internal version should also work in either case but only the 128 version is described because that's all I have to test it on. The entire RTC is con- tained within one module, a 28 pin IC socket. The device was originally intended for use in a PC or other machine where board space was a premium and it was designed to replace a socket for a 28 pin ROM part. It is not used in that fashion in the 128 though. I mounted it in an open space on the mother- board, upside down, 'dead-bug-style'. The I glued it in position (use a non- conductive and removable glue, just in case). For the external version the other components needed are a circuit board and some 9-pin D connectors for the joystick port. See parts list and detailed assembly instructions later. OPERATION 28 VCC The software supplied, supports the 7-----VCC ********** RTC from GEOS. The two applications * * --- allow reading and writing the RTC 1----------DATA------11* *1 RST device. The read application is an -- * * auto-execute file under V1.3. It 2----------WE--------27* * will automatically update the time -- * DALLAS * and date when GEOS boots, PROVIDED 3----------OE--------22* * that you put it on your boot disk. -- * DS1216 * The write routine copies the current 4----------CE--------20* * time and date to the RTC from GEOS. * * Setting of the time and date must be 8-----GND * * performed with the preference mana- ********** ger as normal (but of course once JOYSTICK 14 you set the RTC, you'll never have PORT #2 GROUND to bother again). I included the source to my applications so you can Figure 1. RTC for C64/128 machines. learn from them how to program the RTC should you wish to. The RTC is programmed through CIA #1. The lines I used to interface to the RTC are also used for the joystick of course as well as by the keyboard scanning routine. The RTC does not interfere with any of these activities however. The remainder of this document describes the two assembly procedures in de- tail. The parts list is also included. Construction should take a few hours with good soldering skills and careful work. Whil I have taken great pains to ensure the accuracy and safety of my design, I'm afraid I cannot be held responsible for any problems it may cause with your machine. I have built several prototypes and had no problems whatsoever and I am always willing to help if you run into difficulty. ASSEMBLY INSTRUCTIONS Choose your work surface carefully. Remember that both the RTC module AND the 128 can be harmed by static electricity discharges. I grounded the chasis of the 128 to a water faucet. Then at regular intervals during assem- bly ground yourself to the chassis to discharge any potential your clothing, etc, may generate. Ideally, purchase a grounding wrist strap at Radio Shack and follow the enclosed instructions. Use a low-power soldering iron (15-25 watt) and good quality multi-core solder. You will also need a pair of fine nose pliers, a philips head screwdriver and perhaps a solder sucker tool or desoldering braid. Light guage solid core hookup wire is ideal for the power/ground connections, a few inches of 4-conductor wire is best for the hookups to the CIA (iternal version only). INTERNAL VERSION Since this is the more complex version, I will describe it first. While my techique for mounting the module may not be too professional, I have found it to be solid and reliable. First, disconnect everything from the 128. This may be obvious but I should say it anyway. Remove the upper portion of the 128 case by removing the screws from the base of the machine. Then carefully pry the case open (finger pressure is all it takes) and unplug the keyboard and LED harnesses (remember the orientation of the plugs). The grounding strap is attached to the lower cabinet by means of a screw, which can be removed. Next remove the screws retaining the metal shroud over the motherboard. The screen is soldered to the board at one point, carefully melt this. The screen is also held in place by twisted tongues of metal from the lower half of the screen, simply straighten these gently with pliers. The screen should remove easily now. The next step is to locate the spot where you wish to mount the module. Locate the power socket in the corner of the motherboard. Nearby there is an open area of board (next to the large capacitors). I chose to glue the module upside down here, like a dead bug with it's legs in the air. The back of the module (socket side) should first be insulated with a layer of tape to avoid any possibility of a short). I used short single core wire to connect the power and ground. Don't get confused about your pin numbers now, because the chip is upside down. Mark pins 1 and 28 so you get the wiring right. I used the negative (-) lead of the 100uF capacitor C107 near the power con- nector as a ground point to connect to pin 14 of the RTC. Then I used pin 1 (marked by a square on the silk screen outline) of the resistor pack RP8 as +5v. This resistor pack is easy to find, sitting out in a clear area of the motherboard. Be VERY carefule to get these points right and to wire correct- ly, the damage you can do here is horrific so be carefule. I then wired the four signal pins of the module (11,20,22,27) to the back of the Joystick socket. The socket on my 128 has exposed pins for connector pins 1 thru 5 on the joystick ports. Carefully solder four wires to these exposed pins, and the other end of the wires to the corresponding pins of the module. If your 128 has covered pins you must find an alternate location nearby. Now double check your work. Lastly, place several layers of insulating tape on the inside surface of the metal screen, directly over the RTC module. This is to prevent shorting out the module with the screen. Now would be a good time to check for shorts in your wiring too. Be absolutely certain that you haven't confused the pinout of the module because it is upside down on the motherboard. Check for solder blobs on the joystick connector and the module itself. The last thing to do before reassembling the 128 is to reset the RTC module. This is necessary since the factory stops the clock and places the circuit in a power down mode to lower battery consumption during storage. The reset pin is pin 1 of the module. Simply short this pin briefly to ground (pin 14 of the module) and the circuit powers up and self resets. The software can take it from here. Reassemble the screen over the motherboard and don't forget the small solder bridge you undid earlier. This is important to ground the whole assembly. Carefully reconnect the ground strap between keyboard and motherboard, and attach the keyboard and LED connectors. Reassemble the two case halves and screw the retaining screws in place. If you are sure that nothing's amiss, hook up the 128 and prepare to try out your handiwork. Skip to the testing section of this document. EXTERNAL VERSION The external version of the RTC can be built in two ways, with the provision to allow normal use of joystick port #2, or not. To support normal use of the port, you must pass the 9 signals of the connector thru to a socket for a joystick, mouse or other I/O device to use. In order to achieve this pass- thru with the least trouble, you need to use a male and a female 9-pin con- nector. The GEOPAINT file RTC.DIAG shows how I mounted the module and the two D-connectors. I took a Radio Shack circuit board (Part #276-248), snapped it in half and cut one half to the desired dimensions. These dimen- sions are 7 holes by 15 holes, or about 3/4" by 1 5/8". The cutting is best done with a fine-bladed hacksaw. Next, I carefully assembled the two D-connectors and the board. I found that the board fits snugly between the two rows of solder tails on the connectors. The 5-pin row of solder tails should be on the copper side of the board and the tails should align as closely as possible to the solder pads on the board. The alignment isn't perfect so be careful to avoid a short between two ajacent solder tails. Carefully solder the 5 tails to their respective pads. This will keep the connectors in place during the rest of the assem- bly. Now, it is necessary to cut straight lengths of wire to run between the solder tails of one connector to the other, pin 1 to pin 1, 2 to 2... 9 to 9, etc. These wires provide the pass thru of the joystick port for the second input device. If you have elected to dedicate joystick port #2 to the RTC then of course you don't need these wires and can skip to the next paragraph. The wires should be exactly the length needed to run straight between the connectors. This serves two purposes, one to keep the wire straight, since the RTC module fits over the row of 4 wires on the non-copper side of the board, and two, to provide more mechanical strength to the whole assembly. You can solder these wires in place now. Remember though, that the wires to connect the module to the joystick lines must also be soldered to one end of these wires. If you're tidy, the soldering can be done now, and the second wire inserted when you are ready (see later). Now you should have a fully functional joystick port extender. Check your solder for shorts and blobs. If you're happy then proceed, otherwise rework as necessary but remember that the connectors are housed in plastic. Too much soldering heat and this plastic can melt, destroying your handiwork. Next, solder wires to pins 7 and 8 (the middle two solder tails of 4) on the connectors. These pins are power and ground respectively. Since you are soldering these wires on the non-copper side of the board you will need to be neat and not obstruct the mounting of the RTC module later. These wires should be soldered, one to each connector. This is because the power and ground pins are at opposite ends of the module. Figure out where the power pin (#28) will be inserted and run the free end of the wire soldered to solder tail 7 through that hole. Similarly for the ground pin/hole (#14). What this means is that the RTC module power and ground pins will be sharing their board holes with the power and ground wires, thus allowing a single soldering job to connect power and ground to the module. Taking care to handle the pins as little as possible, and grounding yourself to avoid static damage, take the RTC module and gently mount it on the board, the row of four wires between the connectors on the non-copper side of the board should fit neatly beneath the module, and the power and ground pins of the module (28 & 14) should be in the same holes as the wires you soldered to pins 7 and 8. Now you are ready to wire the four interface pins of the RTC module to solder tails 1 thru 4. All of these wires are on the solder/copper side of the board. Carefully measure the length of wire you need, solder it to the con- nector pin and poke the free end of the wire through the hole corresponding to the RTC module pin you need to connect to. Now carefully apply solder to this junction. Repeat for the three other wires and carefully recheck your work. A short could damage the port on your computer so get it right. If you have come this far and are convinced your handiwork is good, then there is only one more step, resetting the RTC module. This is accomplished by briefly shorting pin 1 (RESET) to pin 14 (GROUND) on the module. You may need to do this after plugging the RTC into the joystick port #2 on your machine and powering up. It seems that som modules will reset while in the battery powered mode, others only when fully powered up by the 5V supply from your machine. In either case be careful and don't short anything else out, just pins 1 and 14. I can't over-stress the importance of double and triple checking your work. Time taken to locate shorts and open joints now can save many hours (and $$$) later. Using a meter, test for shorts bewteen the pins of the connectors, in particular there should not be a short (just a low impedence) between power and ground (solder tails 7 & 8). If you pass this test also, then you can proceed to try out the S/W. TESTING THE RTC Instert the RTC into joystick port #2 and power up your machine. If you fail to get the familiar screen, immediately turn off the power and remove the RTC. Otherwise boot GEOS. The S/W comes as two applications, READ#2 and WRITE#2. These allow you to copy the current time/date info from the RTC to GEOS and from GEOS to the RTC. If you are running V1.3 the READ#2 applica- tion is an auto-execute file and performs the time/date setting on boot up. Otherwise, do it manually as part of your start up process. You will need to keep READ#2 on your boot disk(s) but WRITE#2 will only be needed once (I hope). Go to the preference manager and set the current time and date. Exit the preference manager and double click on the WRITE#2 icon. The screen will blank for a few seconds and then desktop will reload. Hopefully you have now set the current time/date from GEOS into the RTC. Let's see! Now double click on READ#2. Again, a few seconds of blank screen and then desktop returns. Now reload preference manager and check the time. Is it still current? If so then the RTC is probably working but just to be sure, change the time/date to some other value and exit. Rerun READ#2 and then check the time/date with preference manager. If it's correct, CONGRADULA- TIONS! YOU DID IT! Otherwise, power down and carefully check your work again. The circuit is simple so take your time and locate what is probably a simple error. If all else fails, contact Mystic Jim or TIMC4 on QLink. PARTS LIST FOR RTC 1 X DALLAS SEMICONDUCTOR DS1216 "SMARTWATCH" SINGLE CONDUCTOR HOOKUP WIRE (LIGHT GUAGE) 4 CONDUCTOR FLEXIBLE HOOKUP WIRE (INT) 1 X RADIO SHACK CIRCUIT BOARD (P/M 276-148) (EXT) 1 X RADIO SHACK 9-PIN D CONNECTOR, MALE (276-1537) (EXT) 1 X RADIO SHACK 9-PIN D CONNECTOR, FEMALE (276-1538) (EXT) (EXT) MEANS EXTERNAL VERSION ONLY - (INT) MEANS INTERNAL VERSION ONLY ........9-pin D connectors........ . . ! 4 Pass-Thru wires . RTC Module.... . ! . . . . ! . .! ------------------.--------- !. ! ! ------------.--------------- ! -!-! ---------------.------ !-!- ! -!-! . !-!- ! ! ! ! . ! ! ! ! ! ! ! >----------.-------------< ! ! ! ! ! ! DS1216 . ! ! ! ! ! ! ! >----------.-------------< ! ! ! ! ! ! ! ! ! ! ! ! ! >----------.-------------< ! ! ! ! ! ! ! ! ! ! ! ! ! >----------.-------------< ! ! -!-! ---------------------- !-!- ! -!-! !-!- ! ---------------------------- ! ! ! ---------------------------- ! ! RTC MODULE MOUNTED ON ! CIRCUIT BOARD BEFORE CIRCUIT BOARD ! MODULE WAS INSTALLED ! 1!2 --------------------------------------!-------------------------------------- 3!4 5 PASS-THRU WIRES ! -- -- -- . ! 15 CE OE WE 28 ! -------------.-------------- ! ! ! ----------------------------- ! -!-! . !-!- ! -!- ! ! ! ! ! . ! . ! ! ! ! . ! -!- ! ! >-----------.------------< ! ! ! ! ! > . . . < ! ! ! ! >-----------.------------< ! ! ! ! ! ............ . . < ! ! ! ! >-----------.------------< ! ! ! ! ! ................ . < ! ! ! ! >-----------.------------< ! ! ! ! ! > . < ! ! ! ! >-----------.------------< ! ! ! ! ! ........ .... ! ! -!-! !-!- ! -!- ! ! ! . ! ! ! ! ! ! ! ! ! ! -!- ! ---------------------------- ! ! ! ---------------------------- ! ! 14 DATA 1 ! SOLDER/COPPER SIDE ! SOLDER/COPPER SIDE OF THE RTC, OF THE RTC CIRCUIT ! SHOWING THE 4 INTERFACE WIRES BOARD ! SOLDERED TO THE PINS OF THE RTC ! MODULE. (NOTE: FOR CLARITY THE 5 ! PASS-THRU WIRES ARE NOT SHOWN.)