MouseClock Project Rev. 1.22 13-Jan-94 Copyright (C) 1993 Adriano De Minicis WHAT IS IT? =========== MouseClock is a hardware/software project of a low cost, very small external battery backed up clock calendar for all Amigas (especially for A1200, A500, A600). It is connected to the mouse port #2. REQUIREMENTS ============ It works on all Amigas with OS1.2 or greater (tested on A1200, A2000, A500). Some practice is required to build MouseClock. If you have never built an electronic circuit it's better to ask a friend for help. CONTENTS ======== 1. Description 2. Shareware notice 3. Distribution 4. Disclaimer 5. Usage of MouseClock (hardware) 6. Usage of SetMClock (software) 7. Error messages and suggestions 8. Hardware description 9. Construction 10. Calibration 11. Thanks 1. DESCRIPTION ============== MouseClock, as stated before, is a very small external clock. The advantages of an external clock are: - Installing it does not void warranty. - It is compatible with all Amigas: if, for example, you have an A500 and you plan to buy an A1200 you can move MouseClock from one computer to the other in a few seconds. - It may be used as an emergency replacement for a damaged internal clock. Someone may suppose that external is cumbersome and/or occupies the joystick port: - It's very small (the dimensions of my prototype are: 44 x 35 x 16 millimeters). - Adding a few parts you can build a "pass trough" joystick version. With a switch you select MouseClock or the joystick. How much it costs? - Much less than an internal clock: about 15$ This archive contains the documentation (this file) and the software (SetMClock) to read/write the clock (included source in assembler). The circuit diagram and the detailed mounting plan will be sent to you on receipt of the shareware donation (see Distribution). 2. SHAREWARE NOTICE =================== MouseClock is SHAREWARE. If you want to receive the complete circuit diagram and the mechanical construction plan, send me the shareware fee in one of the ways listed below. Please specify that money is for MouseClock (because I'm working on other shareware projects). Payment ------- If you pay with an International Money Order send me 10000 Italian Lire (LIT). Make sure I receive Italian Lire (the exchange is done at your post office). Specify "MouseClock" as cause. If you pay cash send me (in closed envelope) 10000 LIT or 7 US$ or 12 DM or 5 GBP. Remember to include your address and the cause "MouseClock". Cash payment is at your risk. Use two envelopes for safety's sake. DO NOT SEND Cheques, US or Canadian Postal orders, COD, ... , because I can't cash them. Use only International Money Order or cash. Thank you. My address is: Adriano De Minicis Via Latisana 37 33054 Lignano Sabbiadoro UD ITALY Why is this project shareware?. Because I've spent much more time to write the documentation, diagrams, and rewriting in assembly SetMClock (originally in GFA Basic: 17KB compiled!) than to design and build the prototype for my new A1200. I think that 7$ is quite reasonable. If there will be enough feedback to this project, I'll publish the projects on which I'm working: - a 4-ways parallel port switch (completely electronic: no mechanical switches), controlled by Amiga (also from Arexx), with all pins bidirectional. - a simplified 8-bit logic analyzer. 3. DISTRIBUTION =============== The files in this archive may be copied and distributed freely (also on networks) as long as all the files remain unmodified and intact, and as long as there is no charge for them except a reasonable copying and media fee. The circuit diagram you will receive sending me the shareware donation is Copyright by Adriano De Minicis and MUST NOT BE DISTRIBUTED (in any form). You are not allowed to sell MouseClock in commercial way (contact me for agreements). 4. DISCLAIMER ============= SetMClock sets as outputs some lines of the mouse port #2 (GamePort). Remove any peripheral from that connector before running SetMClock, to avoid damages to the peripheral and/or the Amiga. Note: when SetMClock ends, the mouse port returns to the standard configuration. It is possible to connect a joystick to an auxiliary connector if you'll build the pass-through version of MouseClock (only few additional parts required). WARNING ------- NEVER insert or remove MouseClock when the Amiga is on, especially if you haven't removed the metallic shield of the DB9 connector of MouseClock. In fact, pin 7 and 8 (+5V, GND) of the mouse port may be shorted by the metallic shield of the other connector, shorting the Amiga!. I STRONGLY SUGGEST to cut the metallic shield from the DB9 female connector of MouseClock (not Amiga!). If you'll do this, there is no risk to short the Amiga, however is always better not to insert/remove MouseClock when the Amiga is on. I CANNOT BE HELD RESPONSIBLE FOR ANY KIND OF DAMAGE CAUSED BY THIS PROJECT. BUILD AND USE IT AT YOUR OWN RISK..ETC... 5. USAGE OF MouseClock (hardware) ================================= Using MouseClock is simple: connect it to the mouse port #2 (gameport) when the Amiga is off (read the warning notes above!). Base version of MouseClock -------------------------- Simply use SetMClock to access the clock (see below). Joystick version of MouseClock ------------------------------ This version allows you to connect a joystick (not an analog joystick or paddle) to the auxiliary DB9 connector. Set the switch to the 'Clock' position before calling SetMClock (otherwise SetMClock doesn't see the clock!). No damage occurs if you use a joystick when the switch is in the 'Clock' position or vice versa. 6. USAGE OF SetMClock (software) ================================ SetMClock is the software to set the system time from MouseClock or vice versa. It's the replacement of SetClock. Being written 100% in assembler, it is quite compact (about 3K). SetMClock requires the file "MClock.upd" (4 bytes) in the directory "S:" to work properly. This file is created the first time with the option 'save'. It is necessary because the clock chip I've used doesn't save the year, which must be saved on disk. The year is automatically updated comparing the current date with the date stored in the file (day, month any year of the last 'save'). If the current date (read from MouseClock) precedes the date stored in the file, then the year must be increased. The only situation that can cheat MouseClock is when the computer remains off from the beginning of the new year to the month and day stored in the file. For example, if "MClock.upd" contains '15 Jan 1993' and MouseClock reads '10 Jan', then year is 1994; but if MouseClock reads '15 Jan' or later the year is 1993, with the exception above mentioned. To avoid this situation, update the clock for example at the end of January, so that SetMClock has an entire month to notice that the year is changed. If you don't have a hard-disk, it's better to copy the file "S:MClock.upd" in all the boot disks that make use of SetMClock. WARNING: Do not run SetMClock if a peripheral other than MouseClock is connected to the mouse port #2. See the Disclaimer chapter. NOTE: Do not run multiple copies of SetMClock since they interfere, giving wrong results (but there is no damage). CLI/Shell Usage --------------- SetMClock load Set system time/date from MouseClock. Requires file "S:MClock.upd". If you want to set system time every time you boot the Amiga, include this command in the startup-sequence (or user-startup). SetMClock save Store system time/date into MouseClock and into the file "S:MClock.upd" (creating it if it doesn't exist). Use the AmigaDOS command 'date' or the 'Time' prefs (WB 2.0 or higher) to set the system time. Example: date 1-jun-93 12:34 setmclock save Note: when saving, seconds are reset. To reduce the error, wait for seconds being near zero before running SetMClock (or use the 'zero' option to correct seconds). SetMClock zero Reset seconds of MouseClock. If the seconds counter was at position 30..59, time is advanced by one minute (seconds are always reset). SetMClock Shows some help. WorkBench Usage --------------- Use a project icon which default tool is "SetMClock" (with path) and which tooltypes are: MODE=load \ MODE=save } Use ONLY ONE of this (equivalent to CLI option) MODE=zero / The default tooltype is 'load'. You can use the three icons I've supplied as examples. Attention: if you move SetMClock to another directory (for example C:) you must modify the default tool of those icons, including the complete path to SetMClock. It's useful to start SetMClock from WB if you have booted the Amiga from a disk that doesn't call SetMClock in the startup-sequence. 7. ERROR MESSAGES AND SUGGESTIONS ================================= Can't find battery backed up clock ---------------------------------- MouseClock is not connected to the mouse port #2, or it doesn't work. If you have the joystick version of MouseClock probably the switch is not set to the 'clk' position. Battery backed up clock not set ------------------------------- MouseClock is found, but date and time are not set. This happens every time the battery power fails, and thus also the first time. If this error occurs every time you switch off the Amiga, then the battery may be low or not connected. Check it (battery voltage must be greater than 2.2V). Can't open S:MClock.upd ----------------------- File "S:MClock.upd" does not exist or can't be opened. Can't save S:MClock.upd ----------------------- Probably the system disk is write protected. Bad data in S:MClock.upd ------------------------ Garbage found in "S:MClock.upd". Restore with SetMClock save. 8. HARDWARE DESCRIPTION ======================= To reduce the number of I/O lines (so that MouseClock can be connected to the mouse port instead of the parallel port) I've used a clock chip with the I²C bus (IC1). The other chip (IC2) interfaces the Amiga and the I²C bus. Diodes D1 and D2, connected to the I²C feedback lines, avoid an excessive current flow from the battery to the Amiga when the Amiga is off. If the diodes are shorted, the current drawn from the battery would be much higher than the current consumption of IC1, descharging the battery too quickly. 9. CONSTRUCTION =============== Together with the circuit diagram you'll receive the mechanical mounting plans on veroboard (2.54mm step, 1/10"). These drawings refer only to the base version of MouseClock. If you want to build the joystick extension you have to make the few modifications shown by the circuit diagram. I suggest to use a thin wire-wrap wire (for example AWG 28) to make the connections. You can transform directly the connection map to a printed circuit board (because there are no intersections) if you don't want to use the veroboard. The NiCd battery I've used has a diameter of about 15mm, a height of 7mm; the compensator has a diameter of 7mm. If you use different sized parts you may have to make some small modification to the connection layout. I suggest to use sockets for the two ICs, and to cut with a hack-saw the metallic shield of the DB9 female connector. Start by fitting the sockets, the two pins for the jumper, all resistors and capacitors, the quartz, and the transistor. Next fit the DB9 connector, the diodes and the additional parts for the joystick extension (if used). Do not mount the battery. Make a first check of all connections, making sure that there are no short circuits, expecially between the 5V line and ground (pins 7 and 8 of the DB9 connector). A short circuit between these lines can damage your Amiga. Be careful!. Don't be in a hurry to test the clock! When you are sure that it's all ok, mount the battery (with the jumper not inserted). Make sure not to short the battery (use a insulated cable to connect the negative pin of the battery, and don't lean the circuit on metallic objects: NiCd batteries don't like to be shorted!). Make a second check of all connections. If there are no errors, insert the two integrated circuits in their sockets, making sure they have the correct orientation and they are not swapped. Another check, and then insert the jumper (that supplies the circuits). If you have built the joystick version set the switch to the 'clock' position. Switch off the Amiga, connect MouseClock to the mouse port #2, and switch on the Amiga. From the WB, double click on the ClkLoad icon: if appears the requester "Can't find battery backed up clock" you have done some error in the circuit. Switch off the Amiga, and check the circuit (may be the switch is not in the 'clk' position). If the circuit works properly you should see the requester "Battery backed up clock not set" or "Can't open S:MClock.upd". Try to double click on the ClkSave icon: there shouldn't be any message. Retry with ClkLoad: if no message appears it's all O.K., congratulations!. To see how to use SetMClock or for an explanation of the error messages see the respective sections of this doc. If the circuit doesn't work and you can't find the error, check if there is a 1Hz square wave between pin 5 of IC1 and ground. If there isn't then the quartz oscillator doesn't work: try adjusting the compensator. NOTE: The NiCd battery is probably discharged when you build MouseClock. To recharge the battery leave the computer on for some hours (the charge time is usually 14 hrs, but it isn't necessary to leave the Amiga on for all that time, if you often use the Amiga). If you have a NiCd battery charger you can recharge the battery with it before soldering the battery to the circuit. Have a good work! :-) 10. CALIBRATION =============== The calibration of the circuit can be omitted, since the clock is quite precise. If you have a frequency meter with good resolution at low frequencies (must display fractions of Hertz), adjust the compensator until you read exactly 128 Hz on pin 8 of IC1. If you don't have a frequency meter, the procedure is longer: if you notice that the clock is too fast or slow after a week, turn the compensator a little in one direction. After another week check the error: if it is decreased, the direction of the rotation is correct, otherwise, turn the compensator in the opposite direction. Many adjustments are needed to reduce the error. 11. THANKS ========== I wish to thank Roberto Borri for his suggestions and debugging, Fred Fish for his great PD-collection, and the Commodore-Amiga for the new AGA chipset.