╔═══════════╗ ║ CMOS clock ║░ ╚═══════════╝░ ░░░░░░░░░░░░░ Alexander Mayorov Dmitry Lomov In this issue we decided to tell you about such a wonderful thing as a microcircuit CMOS clock. What kind of animal is this? what is it for, you ask? But look for yourself! This chip provides independent computer-generated time calculation, expressed a bot of interruption signals from the alarm clock, and can also be used as a small 50 byte non-volatile RAM. A special feature of CMOS watches is their extremely low power consumption! (by reference book current consumption from 0.1 until ChMA!). If you connect a re- backup power source, then calculating the time menu and safety of information in the internal it RAM will be guaranteed even when disconnected Computer Research Institute. You may ask - well, why do I need this? Indeed, under normal conditions, hours in the computer is not really needed. But! If you write from time to time letters to echoes, then this watch will save you from having to constantly look at the camera calendar and wall clock to mark time/date. Welland for BBS or "mailer" cha- sy are very, very necessary! Actually, the need for a watch arose one of the reasons for creating a new version of the BBS. Which may be discussed next current Newski rooms. Well, now let's get down to business! The microcircuit is called 512VI1, its company name is the prototype MS 146818, as well as the most larger rulez - DALLAS 1287, which has an internal early quartz and battery for 10 years. It should be said that such microcircuits cost in PCs 286 and 386, and therefore are available thanks to the great Upgrade... To begin with, pin assignments: 01 NC not used 02 OSC1 generator input 03 OSC2 generator output 04 ADO 05AD1 06 AD2 07 AD3 multiplex bus 08 ADC address/data 09ADS/ 10 ADb / 11AD7/ 12 GND ground 13 /CE crystal selection 14 AS address strobe 15 R/W read/write 16 NC not used 17 /DS data strobe 18 /RES reset input 19 /IRQ interrupt request output 20 SED frequency control CKOUT 21 CKOUT clock signal output - thots 22 PS voltage failure monitoring tania 23 SQW output program-controlled th frequency divider 24 +Ucc +3...+5volt And now in more detail: Pin 02 (OSC1) must be supplied frequency from an external generator, or connection connect to pins 02/03 (OSC1/OSC2) quar- front resonator. Pins 4...11 (ADO...AD7) - ad bus res/data, connected to the data bus processor. Pin 13 (/CE) - crystal selection. When on - personal log. "1" at this input microcircuit blocked. There is one feature: at this input where the state should be log "0" during tion of the entire cycle of access to the microcircuit. Those. simultaneously with (or before) the choice of address The value of the register at the /CE input must be set log "0" appears, and its state should not change throughout the entire cycle of access to selected register! Most convenient and easy to install at this input the state is log "0" for the entire time the computer is running. The register number is selected by submitting whose on the ADDRESS/DATA bus (ADO...AD7) and applying log "1" to input 14 (AS) To read/write data to/from register(s) pins 15 (R/W) are used - selection of re- Read/write press (respectively log. "1" and "0") and 17 (DS) - data strobe. When applying log "0" to the R/W output, data is being written to the previously selected register, and when sending log "0" to the output DS - reading data from the register. Log "0" appears on pin 19 (/IRQ) informs about the processsystem interrupt BIS. In all other cases, the data you the move is in the third logical state - NI (high impedance). Supply log "0" to the 22nd pin (/PS) in- generates an LSI indicating that a failure has occurred supply voltage, and register contents unreliable. If there is a backup power source, then apply to this input log. "1". There are pulses at pin 23 (SQW) frequency, which is obtained by dividing the hour- totes of the clock generator by the coefficient, set by software. At output 21 (CKOUT) there are pulses, the frequency of which depends on the input state 20 (SED). If there is a log there. "1" hour- the tota at the SQW output coincides with the frequency generator (OSC1-OSC2). Subject to availability log."0" at the SED input frequency at the output SQW is four times less than the generator frequency ra (OSC1-OSC2). The chip has 64 eight-bit register. When working with them you must first indicate which register to work with (record- put his number in the address register), and thus recording/reading. Register numbers #00 SECONDS #01 SECONDS (ALARM) #02 MINUTES #03 MINUTES (ALARM) #04 CLOCK #05 CLOCK (ALARM) #06 DAY OF THE WEEK #07 DAY OF THE MONTH #08 MONTH #09 YEAR #0A REGISTER A #0BREGISTER B #0C REGISTER C #0D REGISTER D #0E General purpose RAM ...general purpose RAM #3F General Purpose RAM #0C,#0D - read only #00,#0A - high-order bits read only DESCRIPTION OF REGISTERS A...D ─════════════════════════─ REGISTER A (individual bits) ──────────────────────────── 7 UIP "1" in this bit means that information is being updated and from we can't work, we have to wait for a while. Cycle duration updates depending on frequency clock pulses: ┌─────────┬──────────────────────┐ │frequency │ duration │ │ MHz │ update cycle, ms│ ├─────────┼──────────────────────┤ │4.194304 │ 248 │ │1.048576 │ 248 │ │0.032768 │ 1984 │ └─────────┴──────────────────────┘ 32768 1048576 4194304 RESET 6 DV2 frequency 0 0 0 1 5 DV1 quartz 1 0 0 1 4 DVO 0 1 0 x 3 RSЗ Setting the frequency on the output 2 RS2 SQW (23) and interrupt periods 1 RS1 IRQ (19) 0 RSO IRQ - issuing signalinterrupts or post frequency, or at the end of the rotation cycle updates, or from an alarm clock. IRQ = 1000/SQW SQW is used to provide a signal from alarm clock For example: SQW frequency = 256 Hz, period equals 1000/256 = 3.9ms D3 D2 D1 D0 FREQUENCY, Hz PERIOD, ms 0 0 1 1 8192 0.122 0 1 0 0 4096 0.244 0 1 0 1 2048 0.488 .................................... 1 1 1 0 4 250 1 1 1 1 2 500 REGISTER B (individual bits) ─────────────────────────── 7 SET "1" - update prohibited (to set the time). 6 PIE interrupt enable with period, specified in the RS bits of register A. Resets by Reset. 5 AIE alarm clock interrupt resolution ka. Resets by Reset. 4 UIE end interrupt enable update cycle. Resets by Reset. 3 SQWE permission to issue information to you SQW move. Resets by Reset. 2 DM data type: 0 - binary decimal 1 - binary 1 24/12 count: 0 - 12 hours 1 - 24 hours 0 DSE "1" enables automatic transfer change from summer to winter time and back.Daylight saving time changes at It's 3am on the last Sunday in April, and for winter at 1 am on the last Sunday e October. REGISTER C (individual bits) ──────────────────────────── All bits are reset by Reset or when reading register C. 7 IRQF interrupt request flag. Installation pours into "1" provided: (PF and PIE) or (AF and AIE) or (UF and UIE). If IRQF="1", then the IRQ output (19) is set to "0". 6 PF is set to 1 by the edge of the signal at the output of the internal divider frequency selected according to with RS bits. 5 AF is set to 1 when matching current time and wake-up time Nick. 4 UF is set to 1 after completion update cycle. 3 =0 ... 0 =0 REGISTER D (individual bits) ──────────────────────────── 7 is set to log. "0" if power was lost and information unreliable. Set to "1" by Reset or when reading register D. 6 =0 ... 0 =0 DATA FORMAT ─────────────── Sunday = 1, Monday = 2, etc. January = 1, February = 2, etc. 1997 = 97, 1998 = 98, etc. The number of days in a month is taken into account and There are leap years. If in registers #00...#09 write a number in the interval #C0...#FF is an indifferent state. Those. if the alarm clock = #FF, then it will will trigger every hour. SUBMITTING A SOUND SIGNAL WHEN THE ALARM GOES GOING ───────────────────────────── It is necessary to set in register {B} AIE=SQWE=1 UIE=PIE=0. The audio frequency at the SQW output is set RS bits of register {A}. When triggered alarm output IRQ will be set to log. "0". Those. to generate sound you need combine the SQW and IRQ outputs by OR You can put an RC chain, which after but some time after setting the IRQ in #0 will generate a reset signal and the sound will stop. is fighting. Connection schemes ─═══════════════─ If you have a SMUG controller, then all you have to do is stick- insert the CMOS clock chip into the appropriate panel panel. Well, if you are “unlucky”, then you will have to solder a little... Generator ─────────── ┌──────────── 2 (OSC1) │ │ 22M ├─▒▒▒▒──┬──── 3 (OSC2) │ │ │ ▒ 470k │ ▒ │ ▒ │ │ │ │┌┐│ │ quartz resonator: ┌┴─┤││├──┤ 10│ │└┘│ │20 32.768 kHz ┴ ┴ * 1.048576 MHz ┬ ┬ 4.194304 MHz │ │ │ │ ─┴─ ─┴─ Crystal selection and voltage control ────────────────────────────────────── 5.1K ┌─▒▒▒▒▒──── 24 (+Un) │ ┌─ │ │ /│ 5.1K /─┴────────── 13 (/CE) │/ │ │/ to ──┤ ├──▒▒▒▒▒───┤ KTZ15 +5 │ │ │ e │ │ │ KS133 │ │ ─┴─ 5.1K 24 (+Un) ─────▒▒▒▒▒──────────── 22 (PS) Chip power supply ──────────────────── │ │ │ │ +5B ───┤ /├────┬─────────── 24 (+Un) │/ │ │ │ │ │ │ │ │ │ │ ┌────│ /├────┘ ││/│ │ ──┴─── + ─┬─ 3.6V battery │ ─┴─ Connecting to a computer ────────────────────────── It is necessary to connect the ADO...AD7 signals to the processor data bus. Signal /RES (18) connect to /RESET processor (26th pin) Remaining pins - AS, R/W, /DS needed connect to address decryptors. Signal status ────────────────── AS R/W/DC nothing 0 1 1 register number selection 1 1 1 read from register 0 1 0 write to register 0 0 1 For example, on the yellow Scorpio board on pins AS, /DS, R/W signals can be supplied with m/s D54: D54/13 via inverter on AS D54/11 on /DS D54/15 on R/W In this case, the CMOS clock port addresses will be located in the TR-DOS area. With this circuit, the inclusions are analyzed only bits 1 and 7, but to avoid conf- licts with other ports are recommended which port addresses Select register #D8 Reading from register #58 Write to register #58 When using Scorpio to recordsi/data reading can be used p/p TR-DOS: #ЗFFO - OUT (C),A RET #ЗFFЗ - IN A,(C) RET On computers with TR-DOS in ROM there are no such commands, the following is recommended: Current program: ;write data to register ;in: ;[C] - CMOS clock register number ;[B] - value to be written WRREG LD A,C CALL SETREG LD A,B LD C,#58 JR OUTPAR ;reading data from register ;in ;[C] - CMOS clock register number ;out: ;[A] - value read from the register RDREG LD A,C CALL SETREG LD A,#D8 LD C,#1F CALL OUTPAR LD C,#58 LD IX,#ЗEFЗ CALL JPTR LD A,H RET SETREG LD C,#D8 OUTPAR LD IX,#2A53 JPTR PUSH IX JP #3D2F
Share your thoughts about the article