LcdClock

From BlinkenArea Wiki
Revision as of 22:17, 29 November 2020 by ArneRossius (talk | contribs)
Jump to: navigation, search
zur Projektübersicht
English Version of this Page
LcdClock.jpg
Jahr 2020
Anzahl Pixel 29
Graustufen / Farben 2
Leuchtmittel LCD
Leistungsaufnahme 4.5 V, 100 µA
Kontaktperson Arne Rossius
Projekt-Website

Die CMOS-LCD-Uhr ist eine einfacher 24-Stunden-Uhr mit CMOS-Logik-ICs aus der 4000-Serie. Die Schaltung ist so entworfen, dass möglichst wenige ICs benötigt werden, ohne dass die Uhr schwieriger zu benutzen ist. Die Zeit (Stunden und Minuten) wird auf einer großen Siebensegment-Flüssigkristallanzeige angezeigt, außerdem gibt es zwei Taster zum Stellen. Die Uhr wird mit 3 AAA-Batterien versorgt und verwendet einen Standard-Uhrenquarz als Zeitbasis.

Hardware

Rev. 1.0

Funktionsbeschreibung

Die Uhr besteht aus 5 Funktionsblöcken:

  • Quarzoszillator
  • Vorteiler
  • Minuten- und Stundenzähler
  • Stelltaster
  • Anzeigetreiber und LCD

Quarzoszillator

Der Quarzoszillator basiert auf einem 4060, welcher den Großteil der Oszillator-Schaltung und einen 14-stufigen Binärteiler enthält. Mit einem gewöhnlichen 32768-Hz-Uhrenquarz ergibt sich daher eine Ausgangsfrequenz von 2 Hz. Außerdem stellt das IC die Ausgänge einiger Zwischenstufen zur Verfügung, die vom LCD verwendet werden (siehe unten). Die Frequenz des Oszillators kann durch verändern der Lastkapazität am Quarz feinjustiert werden. Damit die Uhr so genau wie möglich geht, ist ein Trimmer-Kondensator verbaut, mit dem die Lastkapazität einfach justiert werden kann. Beim Einbau des Trimmer-Kondensators ist es wichtig, dass die Metallspindel mit Masse verbunden ist, andernfalls wird die Lastkapazität beim Justieren mit einem Metall-Schraubendreher beeinflusst und die tatsächliche Frequenz kann erst nach dem Wegnehmen des Schraubendrehers gemessen werden.

Vorteiler

Der Vorteiler bekommt das 2-Hz-Signal vom 4060 und teilt es auf 1/60 Hz, also einen Impuls pro Minute, herunter. Für diese Funktion wird das recht ungewöhnliche IC 40102 verwendet. Es enthält einen Voreinstellbaren 2-stelligen BCD-Abwärtszähler. Der Zählerstand ist zwar nicht als Ausgang verfügbar, jedoch geht der CO/ZO-Ausgang (count out/zero out) auf low, wenn der Zählerstand Null erreicht. Da der Zähler das BCD-System (binary coded decimal) verwendet, ist der maximal voreinstellbare Zählerstand eigentlich 99, eine Division durch 120 (von 2 Hz auf 1/60 Hz) erscheint also erstmal unmöglich. Es ist jedoch problemlos möglich, den Zähler mit einem Wert größer als 9 zu laden, und ein Voreinstell-Wert von 0xB9 resultiert in einem Zählerstand von 119.

Nach dem Voreinstellen sind 119 Takt-Impulse notwendig, bis der Zähler auf 0 steht. Der ZO-Ausgang ist mit dem SPE-Eingang (synchronous programming enable) verbunden, so dass sich der Zähler beim nächsten (120.) Taktimpuls nicht auf 99 zurückstellt, sondern mit dem extern verdrahteten Wert von 119 geladen wird. Das CO-Ausgangssignal ist also einmal pro Minute für 0.5 s (eine 2-Hz-Periode) low und eignet sich daher als Takt für den Minutenzähler.

Der Vorteiler wird auch sofort auf 119 gesetzt, wenn der APE-Eingang low gemacht wird. Taktimpulse werden ignoriert, bis der APE-Eingang wieder high ist. Diese Funktion wird verwendet, um die Uhr sekundengenau stellen zu können.

Minuten- und Stundenzähler

Jeder der beiden Zähler verwendet ein 4518 Doppel-BCD-Zähler-IC. Jedes der ICs enthält zwei unabhängige BCD-Zähler, die jeweils von 0 bis 9 zählen und dann wieder auf 0 zurückfallen. Der Schaltplan zeigt die beiden BCD-Zähler als separate Einheiten, obwohl sie auf dem gleichen Mikrochip untergebracht sind. Die Zählweise ist für die Einerstellen korrekt, aber die Minuten-Zehner müssen bereits von 5 auf 0 zurückfallen, und der Stundenzähler muss nach einem Stand von 23 wieder auf 00 zurückgesetzt werden, es ist also eine zusätzliche Schaltung nötig. Die Zähler haben Rücksetz-Eingänge, um sie auf 0 zu stellen, so dass lediglich ein zusätzliches UND-Gatter benötigt wird. Das IC 4081 enthält vier solche Gatter. Die Zehnerstelle des Minutenzählers wird auf 0 zurückgesetzt, wenn die Ausgänge 2^1 ("B") und 2^2 ("C") gleichzeitig high sind, was bei einem Zählerstand von 6 der Fall ist. Die beiden Stundenzähler-Stellen werden auf 0 zurückgesetzt, wenn die Ausgänge 2^2 ("C") der Einerstelle und 2^1 ("B") der Zehnerstelle gleichzeitig high sind, d.h. wenn der Zählerstand 24 erreicht hat.

Die Zähler-ICs haben außerdem ein praktisches ODER-Gatter am Takteingang, mit einem direkten und einem invertierten Eingang. Dieses Gatter ist nützlich um die Stelltaster anzuschließen, für die sonst ein zusätzliches IC nötig wäre, um deren Signals mit den Ausgangssignalen der vorhergehenden Stufe (Vorteiler für den Minutentakt und Minuten-Ausgang für den Stundentakt) zu kombinieren. Die Stelltaster funktionieren nur, wenn der andere Eingang des ODER-Gatters nicht aktiv ist (aktiv bedeutet high für den direkten und low für den invertierten Eingang), andernfalls ist der Ausgang des ODER-Gatters dauerhaft high und das Signal vom Taster erreicht den Takteingang nicht. Umgekehrt müssen auch die Signale von den Tastern ihren ODER-Gatter-Eingang inaktiv halten, wenn sie nicht gedrückt sind, damit die Taktimpulse der vorhergehenden Stufe den Zähler erreichen können.

Da der Ausgang des Vorteilers nur einmal pro Minute für eine halbe Sekunde low ist, ist er mit dem invertierenden Eingang des Zählers verbunden. Der Minuten-Stelltaster ist zwar während diese halben Sekunde blockiert, es ist aber unwahrscheinlich, dass er genau zu diesem Zeitpunkt gedrückt wird, und selbst wenn, wird der nächste Tastendruck eine halbe Sekunde später wieder erkannt. Der Stundenzähler wird mit dem Zurücksetzen-Signal des Minutenzählers getaktet, welches nur so lange high ist, wie der Minutenzähler braucht, um sich auf 0 zurückzusetzen (ein paar Mikrosekunden). Da das Signal sonst immer low ist, ist es mit dem direkten Eingang des Stundenzählers verbunden.

Die Zehnerstellen-Zähler werden vom 2^3-Ausgang ("D") der dazugehörigen Einerstelle getaktet, der bei einem Zählerstand von 8 high wird und erst wieder auf low geht, wenn der Zähler von 9 auf 0 springt. Die Zehnerstelle soll beim zurückspringen der Einerstelle erhöht werden, also wird der invertierende Eingang verwendet, der Zähler wird so bei einer fallenden Flanke (high auf low) getaktet. Da der andere Eingang unbenutzt ist, stört er nicht, dass das Eingangssignal low bleibt, bis die Einerstelle wieder auf 8 steht.

Set Buttons

The set buttons advance their corresponding counters by one every time they're pressed. Mechanical buttons have "bounce", which means when it is pressed, the electrical connection closes and opens several times for a few milliseconds before the contact is permanently closed, and the same can happen when the button is released. If the button were connected to the clock input of a counter directly, every bounce would increment the counter, making button operation very erratic. To avoid this, a debouncing circuit is needed betweeen the button and the clock input. This design uses a capacitor that is rapidly discharged when the button is pressed (through the 270 Ω resistor) and slowly charged again after the button is released (through the 100 kΩ resistor). The time between bounces is too short for the capacitor to charge again, so the output doesn't change. The capacitor and charge resistor are chosen so the capacitor can't charge to a significant voltage during bounces, but charges enough between two presses of the button. With a quick finger, the time between button release and the next button press can be as low as 20 ms. The 270 Ω resistor is needed to protect the button: without it, the capacitor discharge current would only be limited by the internal resistance of the capacitor and button and the circuit board traces, exceeding the specified current for the button and severely reducing its lifetime.

The signal on the capacitor rises slowly as the capacitor is charging, but the clock input expects a quick transition between the two logic states (low, i.e. close to ground level, and high, i.e. close to the supply voltage). For this reason, resistors are connected across the two remaining AND gates, thereby creating a hysteresis. If the AND gate's output is high, it also pulls the input high through a feedback resistor, so the voltage on the input resistor must be close to ground level before the gate's input will detect a low level. Once it does detect a low level, the output starts changing to low and thereby pulls the input even lower through the feedback resistor, making the output change state even faster. This is called a Schmitt-trigger circuit. Some ICs provide logic gates with Schmitt-trigger inputs, but no AND gates with Schmitt-trigger inputs are available in the 4000 family (only NAND gates).

Display Drivers and LCD

A liquid crystal display consists of two glass plates with a liquid between them. The glass plates have transparent metal electrodes in the shape of the segments on them. If an AC waveform is applied between two electrodes, the crystals in the liquid rotates, also rotating the polarisation of any light passing through that area. Polarisation filters in front of and behind the LCD determine if the non-rotated or the rotated light can pass -- for the LCD used in the clock, the non-rotated polarisation can pass, causing the background of the LCD to appear bright and the active segments to appear dark. The display for the clock is the simplest type of LCD, called a "static" LCD. This means that one of the glass plates is completely covered with a single electrode, which is called the backplane (BP). This means there is no "multiplexing" and every segment has its own electrode (and its own pin) on the other glass plate.

It is very important that LCDs are driven with an AC waveform with no "DC component" (that means the average, over time, of the voltage between the backplane and a segment is zero) to avoid degrading. The simplest way to generate an AC waveform is to connect a square wave with 50% duty cycle (i.e. a signal that changes between high and low with a constant frequency, and the high period is exactly as long as the low period) to the backplane, and then applying the inverted signal to segments that should be visible. This causes the voltage between the electrodes to change between the supply voltage Vdd (+4.5V with fresh batteries) and the negative supply voltage −Vdd, and the average is zero (50% * +Vdd + 50% * −Vdd = 0).

Fortunately, suitable square wave signals with different frequencies are available from the various stage outputs on the 4060 IC. The frequency for the LCD should be high enough to avoid flicker (at least 30 Hz), but not too high as every time the polarity across the LCD changes, a little bit of power is consumed (the electrodes on the two glass plates form a capacitor). For the clock, output Q9 was chosen, which provides 32768 Hz / 2^9 = 64  Hz. To make the colon show up, an inverted signal would be required, but none is available without the use of an additional inverter IC. Instead, the 128 Hz output of the 4060 is connected to the colon. This signal changes its state twice as often as the backplane signal, resulting in the voltage over the colon going through 4 states during each 64 Hz cycle:

  • 00 (both low): 0 V
  • 01 (128 Hz high): +Vcc
  • 10 (64 Hz high): −Vcc
  • 11 (both high): 0 V

The average is still 0, so the LCD won't be damaged, but as the voltage is zero for half the time, this could be compared to driving an LED with a 50% PWM signal. Fortunately, the opaqueness of the LCD isn't linear with the voltage, and once fully turned on, it can't get any darker. As a result, the colon is still as dark as the segments with fresh batteries, and can even act as a low battery indicator when it becomes fainter than the segments.

The segments are driven by one 4543 IC per digit. The ICs combine two functions: decoding the 4-bit BCD input to signals for the 7 display segments, and inverting the backplane signal for signals which should be visible. Inactive segments receive the same signal as the backplane, so the voltage between the two electrodes is always zero. The backplane waveform is provided to each IC at the PH (phase) input. The ICs also have two functions which are unused in the clock: BI (blanking input) is used to turn off all segments when driven high, and LE (latch enable) can be used to store the digit internally and not react to changes on the BCD inputs while driven low.