Published:2011/7/22 1:17:00 Author:Li xiao na From:SeekIC
by M. Conde de Almeida
The hardware
Figure 1 shows the complete circuit diagram of the clock. All intelligence (and a lot of logic) is vested in the PIC16F84 MCU in position IC5. Using RA0-RA4 and RB5-RB7 as input port lines and RB0-RB4 as output port lines, a fair amount of executable code run from the on-chip memory is able to take total control of the circuit, requiring just a 5-V supply voltage and a clock signal generated with the aid of an external 4-MHz quartz crystal, XI.
Components RIO and Cll guarantee that the microcontroller is reset at power-on.
Switches S1-S5 are connected to the microcontroller’s PORTA pins (all configured as inputs). Resistors R3-R7 guarantee a High logic level at the PORTA pins when the switches are open. When closed, these keys will force a LOW state on the PORTA pin they are connected to, triggering the execution of specific clock control routines.
PORTB.6 and PORTB.7 are also configured as inputs. R8 and R9 guarantee a High logic level at these inputs when the associated switch S6 or S7 is open. S7, when closed, will activate the ’Snooze’ function. Similarly, S6 will temporarily activate the display. This function is only available when the clock is operating in the battery mode.
Resistors Rll and R12 form a voltage divider fed by the main 12 VDC source. They guarantee a High logic level at PORTB.5 when the main supply voltage is available. In this situation the display will be permanently on. If for some reason the main power is not available (AC power failure) there will be a Low logic level at PORTB.5 and the entire display will be turned off by the software.
Looking at the output devices controlled by the PIC, the alarm buzzer Bzl is driven via PORTB.2 while PORTB.3 controls LED1 and LED2, the Hour/Minute separator in the readout.
Four common-cathode 7-segment displays, LD1-LD4 constitute the clock readout. These displays are driven by four 74HCT164 shift registers (IC1-IC4) connected in series. R2 only serves to guarantee a High level to the enable pins of the shift registers. PORTB.l drives the CLOCK pin (8) of the shift registers while PORTB.O drives the DATA line of the first shift register in the chain (IC1, pin 1). The microcontroller program will clock 32-bit strings into the shift registers whenever a display update is necessary. PORTB.4 controls the RESET pin of the shift registers. This port line will be held Low when the display is to be turned off.
The regular 12 VDC power may be supplied by a standard AC or DC adapter. Diodes D3 and D4 will guarantee exclusive operation of either the 9 V battery or the 12 VDC power source. They will also guarantee that Rll and R12 are only powered by the 12 VDC source.
The 5 V supply voltage for the logic circuitry is provided by a 7805 regulator (IC6). Capacitors C3, C4, C5 and C6-C9 help to keep the supply voltage as clean as possible.
Current consumption of the clock in normal use (i.e., powered by the mains adapter) is of the order of 75 mA. The current from the 9-V backup battery amounts to about 5 mA.
Reprinted Url Of This Article: http://www.seekic.com/blog/project_solutions/2011/07/22/Digital_Alarm_Clock___Based_on_a_PIC_micro_(2).html
Print this Page | Comments | Reading(2368)
Author:Ecco Reading(30204)
Author:Ecco Reading(3463)
Author:Ecco Reading(3183)
Author:Ecco Reading(3662)
Author:Ecco Reading(5234)
Author:Ecco Reading(3249)
Author:Ecco Reading(3390)
Author:Ecco Reading(3531)
Author:Ecco Reading(3937)
Author:Ecco Reading(3709)
Author:Ecco Reading(3678)
Author:Ecco Reading(3715)
Author:Ecco Reading(6029)
Author:Ecco Reading(3694)
Author:Ecco Reading(4480)