User manual
PICDEM
TM
Mechatronics Demo Board User’s Guide
DS51557C-page 28 © 2006 Microchip Technology Inc.
FIGURE 2-9: PROJECT 4: SCHEMATIC
Instructions
Use Switch 2 to set the hours and Switch 3 to set the minutes. Pressing and holding
either of these switches will make the hours or minutes increment at a fast rate. Toggle
between displaying the time (hours and minutes) and displaying the seconds by
pressing Switch 4.
Discussion
The 32.768 kHz crystal is used to take the guess work out of creating a clock display.
You may recognize this frequency as being 2
15
kHz. This makes it very easy to convert
clock pulses to seconds in the binary world of a microcontroller. Every time bit 15 in
Timer1 changes, one second has elapsed. A crystal is used because an RC oscillator
will have an unacceptable degree of error after several days.
PIC16F917
T1OSI
T1OSO
V
SS
COMX
VDD
11/32
14
12/31
SEGX
Common pins
Segment pins
LCD1
VIM-332-DP
R8
SW4
10 kΩ
VDD
1 kΩ
R9
RA3
RA1
RA0
13
2
3
5
C35
22 pF
C34
22 pF
Y1
32.768 kHz
R4
SW2
10 kΩ
VDD
1 kΩ
R5
R6
SW3
10 kΩ
VDD
1 kΩ
R7