Multiplexing LED Drive and A 4x4 Keypad Sampling
Multiplexing LED Drive and A 4x4 Keypad Sampling
Multiplexing LED Drive and A 4x4 Keypad Sampling
AN529
Multiplexing LED Drive and a 4x4 Keypad Sampling
Typically applications having LEDs and keypads also
keep track of real time, in order to synchronize certain
key events. An Industrial Clock/Timer example has
been used in this application note as a demonstration of
this technique. The software overhead to keep track of
real time is minimal and the user can modify the code to
significantly expand the functionality of this circuit.
INTRODUCTION
Many applications require driving LEDs along with an
interface to a keypad. Implementing such designs
usually involves using up significant amounts of the
processors I/O lines. This application note describes a
method which uses only 16 I/O pins of a PIC16C5X
microcontroller to sample a 4x4 keypad matrix, and
directly drive four 7 segment LEDs (see Figure 1). Direct
drive of the LEDs is possible, because of the high sink
and source capabilities of the PIC16C5X microcontroller,
thus eliminating the use of external drive transistor, and
resulting in reduced cost and complexity of the overall
circuit.
DISPLAY MODULE
ALARM
AM
PM
6
7
8
9
PIC16C5X
RA0
RA1
RA2
RA3
RB0
RB1
RB2
RB3
RB4
RB5
RB6
RB7
RC0
RC1
RC2
RC3
RC4
RC5
RC6
RC7
10
11
12
13
14
15
16
17
4 x 220
18
19
20
21
22
23
24
25
4 x 10K
4 x 220
Vcc
4 x 100K
Key Pad
DS00529C-page 1
2-109
2
2
Implementation
4. A 50 ms key debounce technique has been implemented in the software, in order to eliminate multiple
key strokes.
Notes:
1. Resistors R8-R11 and R12-R14 have been selected
such that their ratio is 1:10. This will insure a 0.5 Volt
level at the input, when a key is pressed. Also
R8-R14 should have a value such that their current
contribution to the LEDs segments is negligible.
x
1
x
2
9 10 11 12
ALARM
AM
LTC 3710G*
PM
24 23 22 21 20 19 18 17 16 15 14 13
x
x
Vcc
LS1
Beeper
Vcc
x
x
x
6
7
8
9
28
1
20pF
C1
C2
20pF
27
Y1
26
4.096 MHz
PIC16C57
RA0
RA1
RA2
RA3
MCLR
RB0
RB1
RB2
RB3
RB4
RB5
RB6
RB7
RTCC
OSC1
OSC2
RC0
RC1
RC2
RC3
RC4
RC5
RC6
RC7
10
11
12
13
14
15
16
17
R4
18
19
20
21
22
23
24
25
R3
R2
R1
R0
R5
R7 4 x 220
R12
R13
R14
R15
10K
10K
10K
10K
4 x 220
Vcc
R6
R8
7
R9
6
R10
5
R11
4x4 Hex
Keypad
4x100K
DS00529C-page 2
2-110
9 10 11 12
ALARM
AM
LTC3710G*
PM
24 23 22 21 20 19 18 17 16 15 14 13
x
x
Vcc
LS1
Beeper
Vcc
x
x
x
6
7
8
9
28
20pF
C1
C2
20pF
27
Y1
26
4.096 MHz
PIC16C57
RA0
RA1
RA2
RA3
MCLR
RB0
RB1
RB2
RB3
RB4
RB5
RB6
RB7
RTCC
OSC1
OSC2
RC0
RC1
RC2
RC3
RC4
RC5
RC6
RC7
10
11
12
13
14
15
16
17
R12
R1
R2
R3
18
19
20
21
22
23
24
25
R4
R5
R6
D9 1N914
R7
D8 1N914
Vcc
R8
8 x 220
D7 1N914
D6 1N914
1N914 8
D1
1N914 7
R9
D2
R10
D3
R11
D4
1N914 6
1N914 5
4x4 Hex
Keypad
4x100K
DS00529C-page 3
2-111
2
2
Keyscan
col. 1
3 s
40 s (housekeeping delay)
Keyscan
col. 2
Keyscan
col. 3
3 s
40 s (housekeeping delay)
Keyscan
col. 4
Digit 1
5 ms
20 ms
Digit 2
Digit 3
Digit 4
FEATURES
1.
2.
3.
4.
5.
Alarm Set (must be pressed when alarm LED is flashing) Hours (tens) Hours
Minutes (tens) Minutes AM/PM Set
Enable/Disable Alarm
Disable AA alarm
Clear Alarm
Abort Entry
Clear Entry (aborts data entry mode when setting real and alarm time)
Notes:
DS00529C-page 4
2-112
Initialize RAM
2
Test LEDs for 2 secs
2
Update next digit
Yes
Key pressed?
No
Yes
Service key
AA alarm on?
Yes
Service AA alarm
No
5ms Timer = 0?
No
Yes
Update all relevant timers
FIGURE 5 - KEYPAD
DISABLE
ALARM
AM/PM
CLEAR
ALARM
ALARM
TIME
CLEAR
ENTRY
SET
DS00529C-page 5
2-113
AM
PM
8
4 x 220
NPN
4.7K
NPN
4.7K
17
18
1
2
4
16
NPN
PIC16C54/56
RA0
RA1
RA2
RA3
MCLR
RB0
RB1
RB2
RB3
RB4
RB5
RB6
RB7
OSC1
RTCC
4.7K
17
6
7
8
9
10
11
12
13
3
4 x 220
10K
OSC2
NPN
4.7K
10K
10K
10K
Vcc
4 x 100K
SUMMARY
CODE SIZE
2.
3.
4.
DS00529C-page 6
2-114
OBJECT CODE
CLK.ASM
7-15-1994
13:15:10
PAGE
0001
TITLE
Alarm Clock
0002
LIST P = 16C57,f=inhx8m
0003 ;
0004 ;Define Equates:
0005 ;
07FF
0006
PIC57
EQU
7FFH
0007
;************************************************************************
0008 ;External Ossc. used = 4.096Mhz. Prescaler of 32 used, which gives a
0009 ;31.25 microSec increment of the RTCC. If RTCC is intially loaded with
96,
0010 ;it would overflow to 0 in 5.000 milliSecs. Giving a 0.00% error.
0060
0011
MSEC5
EQU
D96'
0012
;*************************************************************************
0000
0013
C
EQU
0
0000
0014
BEP
EQU
0
0000
0015
RTATS
EQU
0
0001
0016
DC
EQU
1
0001
0017
HR10
EQU
1
0002
0018
Z
EQU
2
0002
0019
HR
EQU
2
0003
0020
MIN10
EQU
3
0004
0021
MIN
EQU
4
0004
0022
FLASH
EQU
4
0005
0023
PA0
EQU
5
0005
0024
KEY_BEEP EQU
5
0005
0025
AMPM
EQU
5
0006
0026
PA1
EQU
6
0000
0027
F0
EQU
0
0006
0028
KEY_HIT EQU
6
0006
0029
ALED
EQU
6
0007
0030
AM_PM
EQU
7
0003
0031
COLON
EQU
3
0002
0032
ALRMLED EQU
2
0007
0033
SERVICED EQU
7
0000
0034
ALONOF EQU
0
0001
0035
INAL
EQU
1
0002
0036
SILNC
EQU
2
0003
0037
INAA
EQU
3
0005
0038
INKEYBEP EQU
5
0039 ;
0040 ;DEFINE RAM LOCATIONS:
0001
0041
RTCC
EQU
1
0002
0042
PC
EQU
2
0003
0043
STATUS EQU
3
0004
0044
FSR
EQU
4
0005
0045
PORT_A EQU
5
0006
0046
PORT_B EQU
6
0007
0047
PORT_C EQU
7
0048 ;DEFINE REAL TIME MODE REGS (RTM)
0008
0049
MSTMR
EQU
8
;MILLI SEC. TIMER
0009
0050
STMR
EQU
9
;SEC. TIMER
0051 ;*****************************************************
0052 ;DO NOT CHANGE RELATIVE POSITION OF NEXT 6 BYTES
000A
0053
MTMR
EQU
0A
;MIN. TIMER
000B
0054
HTMR
EQU
0B
;HOUR TIMER
0055 ;DEFINE ALARM TIME MODE REGS (ATM)
000C
0056
MALARM EQU
0C
;MIN. ALARM
000D
0057
HALARM EQU
0D
;HOUR ALARM
0058 ;DEFINE DATA ENTRY MODE REGS (DEM)
DS00529C-page 7
2-115
2
2
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
001A
0059
0060
0061
0063
0064
0065
0066
0067
0068
0069
0070
0071
0072
0073
0074
0075
0076
0077
0078
0079
0080
0081
0082
0083
0084
0085
0086
0087
0088
0089
0090
0091
0092
0093
0094
0095
0096
0097
0098
0099
0100
0101
0102
0103
0104
0105
0106
0107
0108
0109
0110
0111
0112
0113
0114
0115
0116
0117
0118
0119
0120
0121
0122
0123
0124
0125
0126
0127
0128
MENTRY EQU
0E
;MIN. ENTRY
HENTRY EQU
0F
;HOUR ENTRY
;*****************************************************
;
;DEFINE FLAG REG AND FUNCTION:
FLAG
EQU
10
;
BIT # 7|6|5|4|3|2|1|0|
;|-|-|-|-|-|-|-|
;
X|X|X|X|X|X|0|0| > REAL TIME MODE (RTM)
;
X|X|X|X|X|X|0|1| > ALARM TIME MODE(ATM)
;
X|X|X|X|X|X|1|0| > DATA ENTRY M0DE(DEM)
;
X|X|X|X|X|X|1|1| > TEST MODE (TM)
;
X|X|X|X|X|Y|X|X| > ALRMLED ON/OFF
;
X|X|X|X|Y|X|X|X| > COLON LED ON/OFF
;
X|X|X|Y|X|X|X|X| > FLASH DISPLAY
;
X|X|Y|X|X|X|X|X| > KEY_BEEP
;
X|Y|X|X|X|X|X|X| > KEY_HIT (0/1)
;
Y|X|X|X|X|X|X|X| > SERVICED
; X = DEFINED ELSEWHERE IN TABLE
; Y = DEFINED AS SHOWN (0/1)
;
TEMP
EQU
11
DIGIT
EQU
12
NEW_KEY EQU
13
KEY_NIBL EQU
14
DEBOUNCE EQU
15
MIN_SEC EQU
16
;MIN/SECONDS TIMER
ENTFLG EQU
17
;flag dedicated to the key entry mode
;
BIT # 7|6|5|4|3|2|1|0|
;|-|-|-|-|-|-|-|
;
X|X|X|X|X|X|X|Y| > REAL/ALARM TIME STATUS
;
X|X|X|X|X|X|Y|X| > HR10 DONE
;
X|X|X|X|X|Y|X|X| > HR DONE
;
X|X|X|X|Y|X|X|X| > MIN10 DONE
;
X|X|X|Y|X|X|X|X| > MIN DONE
;
X|X|Y|X|X|X|X|X| > INKEYBEP
;
X|Y|X|Y|X|X|X|X| > NOT USED
;
Y|X|X|X|X|X|X|X| > NOT USED
;
;
ALFLAG EQU
18
;flag dedicated to the alarm
;
BIT # 7|6|5|4|3|2|1|0|
;|-|-|-|-|-|-|-|
;
X|X|X|X|X|X|X|Y| > ALONOF
;
X|X|X|X|X|X|Y|X| > INAL
;
X|X|X|X|X|Y|X|X| > SILNC
;
X|X|X|X|Y|X|X|X| > INAA
;
X|X|X|Y|X|X|X|X| > NOT USED
;
X|X|Y|X|X|X|X|X| > NOT USED
;
X|Y|X|Y|X|X|X|X| > NOT USED
;
Y|X|X|X|X|X|X|X| > NOT USED
;
AAFLAG EQU
19
;flag dedicated to the AA alarm
AATMR
EQU
1A
;
;Port pin definitions:
;
;PORT_A:
;
BIT 0
> BEEPER (ACTIVE LOW) OUTPUT
;
BIT 1-3 > unused I/O
;
;PORT_B: ALL OUTPUTS
;
BIT 0&4 > MSB DIGIT COMMON CATHODE & ALARM
;
BIT 1&5 > 2ND DIGIT COMMOM CATHODE & COLON
;
BIT 2&6 > 3RD DIGIT COMMON CATHODE & PM
;
BIT 3&7 > LSB DIGIT COMMON CATHODE & AM
DS00529C-page 8
2-116
0000 0AFC
0001 0C02
0002 0036
0003
0004
0005
0006
0007
0008
0009
000A
0216
0643
0A0B
0925
05A3
0900
04A3
0A03
000B 0410
000C 0430
000D
000E
000F
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
001A
001B
0925
05C3
0900
05A3
0900
04C3
0900
04A3
04C3
0210
0E03
0F01
0643
091C
0A0D
001C
001D
001E
001F
0020
0021
0022
0023
0024
0216
0E0F
0743
0800
0410
0450
0618
0550
0800
0025 0C00
0129
0130
0131
0132
0133
0134
0135
0136
0137
0138
0139
0140
0141
0142
0144
0145
0146
0147
0148
0149
0150
0151
0152
0153
0154
0155
0156
0157
0158
0159
0160
0161
0162
0163
0164
0165
0166
0167
0168
0169
0170
0171
0172
0173
0174
0175
0176
0177
0178
0179
0180
0181
0182
0183
0184
0185
0186
0187
0188
0189
0190
0191
0192
0193
0194
0196
0197
0198
0199
;
;PORT_C:
;IN DISPLAY MODE ALL SEG/ANNN SET AS OUTPUTS
;IN KEY SCAN MODE COLS ARE OUTPUTS ROWS ARE INPUTS
;
BIT 0
> SEGMENT A & COL 4
;
BIT 1
> SEGMENT B & COL 3
;
BIT 2
> SEGMENT C & COL 2
;
BIT 3
> SEGMENT D & COL 1
;
BIT 4
> SEGMENT E & ROW 4
;
BIT 5
> SEGMENT F & ROW 3
;
BIT 6
> SEGMENT G & ROW 2
;
BIT 7
> CA OF ALL ANNUNCIATORS & ROW 1
;
;
;
ORG
0
START
GOTO
INIT_CLK
;INITIALIZE CLOCK
;THIS ROUTINE RUNS A TEST ON THE LEDS.
;ALL THE RELEVENT LEDS ARE LIT UP FOR 2 SECS.
;
TEST_HARDWARE
MOVLW
d02'
;DISPLAY FOR 2 SECS
MOVWF
MIN_SEC
;
/
;
;
TEST_LOOP
MOVF
MIN_SEC,W
;GET MIN/SEC
BTFSC
STATUS,Z
;NOT 0 THEN SKIP
GOTO
NORM_TIME
;ELSE NORMAL TIME
CALL
UPDATE_DISPLAY ;UPDATE DISPLAY
BSF
STATUS,PA0
;GOTO PAGE 1
CALL
UPDATE_TIMERS
;WAIT AND UPDATE
BCF
STATUS,PA0
;RESET PAGE MARKER
GOTO
TEST_LOOP
;LOOP BACK
NORM_TIME
BCF
FLAG,0
;PUT IN REAL TIME
BCF
FLAG,1
TIME_LOOP
CALL
UPDATE_DISPLAY
BSF
STATUS,PA1
;GOTO PAGE 2
CALL
SERVICE_KEYS
BSF
STATUS,PA0
;GOTO PAGE 3
CALL
SOUND_AA
;CHECK ALARM
BCF
STATUS,PA1
;GOTO PAGE 1
CALL
UPDATE_TIMERS
;WAIT AND UPDATE TIMERS
BCF
STATUS,PA0
;RESET PAGE MARKER
BCF
STATUS,PA1
;
/
MOVF
FLAG,W
;SEE IF IN ATM
ANDLW
B00000011'
;
/
XORLW
B00000001'
;
/
BTFSC
STATUS,Z
;SKIP IF NOT
CALL
RESET_ATM
GOTO
TIME_LOOP
;
RESET_ATM
MOVF
MIN_SEC,W
;GET MIN/SEC
ANDLW
B00001111'
;
/
BTFSS
STATUS,Z
;Z THEN SKIP
RETLW
0
;ELSE RETURN
BCF
FLAG,0
;SET TO RTM
BCF
FLAG,ALRMLED
;CLEAR LED
BTFSC
ALFLAG,ALONOF
;TEST STAT
BSF
FLAG,ALRMLED
;SET LED
RETLW
0
;RETURN
;
;
UPDATE_DISPLAY
MOVLW
B00000000'
;CLEAR SEG DRIVE
2
2
DS00529C-page 9
2-117
0027
0C3F
0186
0643
0A6F
002B
002C
002D
002E
002F
0030
0031
0032
0033
0034
0035
0036
0246
0643
0CC0
0031
0271
0503
0371
0703
0371
0371
0211
0026
0037
0038
0039
003A
003B
003C
003D
003E
003F
0040
0041
0042
0043
0044
0045
0046
0047
0048
0049
004A
0C0A
0024
0210
0E03
0031
0F03
0643
0A4B
0403
0371
0211
01E4
0954
0032
09D1
0690
094E
0212
0027
0800
004B 0CFF
004C 0027
004D 0800
004E 0770
004F 0A51
0050 0800
0051 0C00
0052 0032
0053 0800
0054
0055
0056
0057
0058
0059
0246
0EF0
0643
02A4
0200
0031
0200
0201
0202
0203
0204
0205
0206
0207
0208
0209
0210
0211
0212
0213
0214
0215
0216
0217
0218
0219
0220
0221
0222
0223
0224
0225
0226
0227
0228
0229
0230
0231
0232
0233
0234
0235
0236
0237
0238
0239
0240
0241
0242
0243
0244
0245
0246
0247
0248
0249
0250
0251
0252
0253
0254
0255
0257
0258
0259
0260
0261
0262
0263
0264
0265
0266
0267
0268
0269
MOVWF
PORT_C
;
/
MOVLW
B00111111'
;SEE IF LAST DIGIT
XORWF
PORT_B,0
;
/
BTFSC
STATUS,Z
;NO THEN SKIP
GOTO
SCAN_KP
;ELSE SCAN KEYPAD
UP_DSP_1
;SELECT DIGIT TO BE DISPLAYED
COMF
PORT_B,0
;GET COMPL. PORT B IN W
BTFSC
STATUS,Z
;NO DIGIT SELECTED?
MOVLW
B11000000'
;THEN SELECT DEFAULT
MOVWF
TEMP
;SAVE IN TEMP
COMF
TEMP
;COMPLEMENT VALUE
BSF
STATUS,C
;SET CARRY
RLF
TEMP
;SHIFT LEFT
BTFSS
STATUS,C
;IF C=1 THEN SKIP
RLF
TEMP
;ELSE 3 TIMES...
RLF
TEMP
;THRU CARRY
MOVF
TEMP,0
;GET IN W
MOVWF
PORT_B
;OUTPUT TO PORT
;NOW THAT DIGIT IS SELECTED, SELECT SEG VALUES FOR THAT DIGIT
;FIRST FIND MODE OF OPERATION.
MOVLW
MTMR
;LOAD FSR WITH MTMR
MOVWF
FSR
;
/
MOVF
FLAG,0
;GET FLAG IN W
ANDLW
B00000011'
;MASK OTHER BITS
MOVWF
TEMP
;SAVE IN TEMP
XORLW
B00000011'
;IN TEST MODE
BTFSC
STATUS,Z
;NO THEN SKIP
GOTO
DO_TM
;ELSE TEST MODE
BCF
STATUS,C
;CLEAR CARRY
RLF
TEMP
;LEFT SHIFT TEMP
MOVF
TEMP,0
;GET IN W
ADDWF
FSR
;CHANGE INDIRECT POINTER
CALL
GET_7_SEG
;GET 7 SEG DATA IN W
MOVWF
DIGIT
;SAVE IN DIGIT LOC.
CALL
MASK_ANNC
;MASK ANNC TO DIGIT
BTFSC
FLAG,FLASH
;NO FLASH THEN SKIP
CALL
CHK_HALF_SEC
;ELSE CHK. IF ON
MOVF
DIGIT,0
;GET BACK DIGIT
MOVWF
PORT_C
;OUTPUT TO PORT
RETLW
0
;RETURN
;
DO_TM
MOVLW
B11111111'
;LIGHT ALL SEGMENTS
MOVWF
PORT_C
;
/
RETLW
0
;RETURN FROM UPDATE DISPLAY
;
CHK_HALF_SEC
BTFSS
FLAG,COLON
;IF COLON ON THEN DO
GOTO
BLANK_DSP
;ELSE BLANK DISPLAY
RETLW
0
BLANK_DSP
MOVLW
B00000000'
;MAKE PORT C LOW
MOVWF
DIGIT
RETLW
0
;
;
;ON ENTRY FSR POINTS TO THE REAL TIME MODES MINUTES REGISTER.
;ON RETURN FSR POINTS TO THE TIMER REGISTER TO BE DISPLAYED.
;W REG. CONTAINS THE DECODED 7 SEG. INFO OF THE DIGIT
;TO BE DISPLAYED
;
GET_7_SEG
COMF
PORT_B,0
;COMPLEMENT B > W
ANDLW
B11110000'
;MASK LO NIBBLE
BTFSC
STATUS,Z
;NZ THEN SKIP
INCF
FSR
;INC POINTER
MOVF
F0,0
;MOVE INDIRECT TO W
MOVWF
TEMP
;GET INTO TEMP
DS00529C-page 10
2-118
0246
0EF0
0643
04F1
0246
0ECC
0643
03B1
0C0F
0151
01E2
083F
0806
085B
084F
0866
086D
087D
0807
087F
0867
006F
0070
0071
0072
0073
0074
06D0
0A2B
0CFF
0026
0CF7
0031
0075
0076
0077
0078
0079
007A
007B
007C
007D
007E
007F
0080
0081
0082
0C00
0007
0211
0E0F
0027
0CF0
0007
0211
0027
0207
0EF0
0FF0
0743
0A8D
0083
0084
0085
0086
0087
0088
0503
0331
0603
0A75
0073
00F3
0089
008A
008B
008C
0067
0C00
0007
0A2B
008D
008E
008F
0090
0091
0293
0743
0A89
0207
0D0F
0270
0271
0272
0273
0274
0275
0276
0277
0278
0279
0280
0281
0282
0283
0284
0285
0286
0287
0288
0289
0290
0291
0292
0293
0294
0295
0296
0297
0298
0299
0300
0301
0302
0303
0304
0305
0306
0307
0308
0309
0310
0311
0312
0313
0314
0315
0316
0317
0318
0319
0320
0321
0322
0323
0324
0325
0326
0327
0328
0329
0330
0331
0332
0333
0334
0335
0336
0337
0338
COMF
ANDLW
BTFSC
BCF
COMF
ANDLW
BTFSC
SWAPF
MOVLW
ANDWF
ADDWF
RETLW
RETLW
RETLW
RETLW
RETLW
RETLW
RETLW
RETLW
RETLW
RETLW
PORT_B,0
B11110000'
STATUS,Z
TEMP,AM_PM
PORT_B,0
B11001100'
STATUS,Z
TEMP
B00001111'
TEMP,0
PC
B00111111'
B00000110'
B01011011'
B01001111'
B01100110'
B01101101'
B01111101'
B00000111'
B01111111'
B01100111'
;COMPL.B > W
;MASK LO NIBBLE
;IF D1/2 THEN
;CLEAR AM/PM BIT
;GET PORT B AGAIN
;SEE IF D2 OR D4
;YES THEN SKIP
;SWAP TEMP
;MASK HI NIBBLE
;ADD TO PC
;CODE FOR 0
;CODE FOR 1
;CODE FOR 2
;CODE FOR 3
;CODE FOR 4
;CODE FOR 5
;CODE FOR 6
;CODE FOR 7
;CODE FOR 8
;CODE FOR 9
2
2
;
;This routine scans the 4x4 hex key pad for a key hit.
;If key is pressed, KEY_HIT flag is set and the value of
;the hex key is returned in reg NEW_KEY
;If no key is detected, then a 0xff value is returned in
;register NEW_KEY and the flag KEY_HIT is reset.
;
SCAN_KP
BTFSC
FLAG,KEY_HIT
;KEY UNDER SERVICE?
GOTO
UP_DSP_1
;YES SKIP ROUTINE
MOVLW
B11111111'
;SET DIGIT SINKS ...
MOVWF
PORT_B
;TO HIGH
MOVLW
B11110111'
;SET KEY COL LOW
MOVWF
TEMP
;SAVE IN TEMP
SKP1
MOVLW
B00000000'
;SET PORT C AS OUTPUTS
TRIS
PORT_C
;
/
MOVF
TEMP,W
ANDLW
B00001111'
;DISCHARGE PINS
MOVWF
PORT_C
;
/
MOVLW
B11110000'
;SET AS I/O
TRIS
PORT_C
;
/
MOVF
TEMP,W
;GET OLD VALUE
MOVWF
PORT_C
;OUTPUT TO PORT
MOVF
PORT_C,W
;INPUT PORT VALUE
ANDLW
B11110000'
;MASK LO BYTE
XORLW
B11110000'
;SEE IF KEY HIT
BTFSS
STATUS,Z
;NO KEY THEN SKIP
GOTO
DET_KEY
;LOAD KEY VALUE
SKP3
BSF
STATUS,C
;SET CARRY
RRF
TEMP
;MAKE NEXT COL. LOW
BTFSC
STATUS,C
;ALL DONE THEN SKIP
GOTO
SKP1
CLRF
NEW_KEY
;SET NEW_KEY = FF
DECF
NEW_KEY
;
/
SKP2
CLRF
PORT_C
;SETPORT C AS ...
MOVLW
B00000000'
;OUTPUTS
TRIS
PORT_C
;
/
GOTO
UP_DSP_1
;RETURN
DET_KEY
;key is detected
INCF
NEW_KEY,W
;CHK IF KEY ...
BTFSS
STATUS,Z
;WAS RELEASED
GOTO
SKP2
;NO THEN RETURN
MOVF
PORT_C,W
;GET RAW KEY...
IORLW
B00001111'
;VALUE.
DS00529C-page 11
2-119
0151
0033
0998
0033
05D0
0A89
0098
0099
009A
009B
0E0F
0034
0C04
0031
009C
009D
009E
009F
00A0
00A1
0503
0334
0703
0AA5
02F1
0A9C
00A2 05A3
00A3 05C3
00A4 0BFF
00A5
00A6
00A7
00A8
00A9
00AA
00AB
00AC
00AD
00AE
00F1
0393
0E0F
0034
0211
01E2
0AAF
0AB8
0ABA
0ABC
00AF 0C04
00B0 0031
00B1
00B2
00B3
00B4
00B5
00B6
00B7
0503
0334
0703
0ABE
02F1
0AB1
0AA2
0339
0340
0341
0342
0343
0344
0345
0347
0348
0349
0350
0351
0352
0353
0354
0355
0356
0357
0358
0359
0360
0361
0362
0363
0364
0365
0366
0367
0368
0369
0370
0371
0372
0373
0374
0375
0376
0377
0378
0379
0380
0381
0382
0383
0384
0385
0386
0387
0388
0389
0390
0391
0392
0393
0394
0395
0396
0397
0398
0399
0400
0401
0402
0403
0404
0405
0406
0407
0408
ANDWF
MOVWF
CALL
MOVWF
BSF
GOTO
TEMP,W
NEW_KEY
GET_KEY_VAL
NEW_KEY
FLAG,KEY_HIT
SKP2
;
/
;SAVE IN NEW_KEY
;GET ACTUAL KEY ...
;VALUE
;SET KEY HIT FLAG
;RETURN
;
;This routine decodes the hex value from the raw data got
;from scanning the rows and cols.
;
actual key value
raw hex value
;
ONE
EQU
77
;
TWO
EQU
7B
;
THREE
EQU
7D
;
C
EQU
7E
;
FOUR
EQU
0B7
;
FIVE
EQU
0BB
;
SIX
EQU
0BD
;
D
EQU
0BE
;
SEVEN
EQU
0D7
;
EIGHT
EQU
0DB
;
NINE
EQU
0DD
;
E
EQU
0DE
;
A
EQU
0E7
;
ZERO
EQU
0EB
;
B
EQU
0ED
;
F
EQU
0EE
;
;
GET_KEY_VAL
ANDLW
B00001111'
;GET LO NIBBLE
MOVWF
KEY_NIBL
;SAVE
MOVLW
4
;SET COUNT TO 4
MOVWF
TEMP
;
/
GKV1
BSF
STATUS,C
;SET CARRY
RRF
KEY_NIBL
;ROTATE NIBBLE
BTFSS
STATUS,C
;SKIP IF NOT Z
GOTO
GET_HI_KEY
;GOTO NEXT PART
DECFSZ TEMP
;DEC COUNT
GOTO
GKV1
;LOOP
GO_RESET
BSF
STATUS,PA0
;SET MSB
BSF
STATUS,PA1
;
/
GOTO
SYS_RESET
;ELSE BIG ERROR
GET_HI_KEY
DECF
TEMP
;REDUCE BY 1
SWAPF
NEW_KEY,W
;GET HI NIBBLE
ANDLW
B00001111'
;
/
MOVWF
KEY_NIBL
;SAVE
MOVF
TEMP,W
;GET OFFSET TO TBL
ADDWF
PC
;LOAD IN PC
GOTO
GET147A
;JUMP TO NEXT PART
GOTO
GET2580
;
/
GOTO
GET369B
;
/
GOTO
GETCDEF
;
/
;
GET147A
MOVLW
4
;SET COUNT TO 4
GETCOM
MOVWF
TEMP
;
GETCOM1
BSF
STATUS,C
;SET CARRY
RRF
KEY_NIBL
;ROTATE RIGHT
BTFSS
STATUS,C
;CHECK IF DONE
GOTO
KEY_TBL
;JUMP TO TABLE
DECFSZ TEMP
;DEC COUNT
GOTO
GETCOM1
;LOOP
GOTO
GO_RESET
;ELSE ERROR
;
DS00529C-page 12
2-120
00BA 0C0C
00BB 0AB0
00BC 0C10
00BD 0AB0
00BE
00BF
00C0
00C1
00C2
00C3
00C4
00C5
00C6
00C7
00C8
00C9
00CA
00CB
00CC
00CD
00CE
00CF
00D0
00F1
0211
01E2
0801
0804
0807
080A
0802
0805
0808
0800
0803
0806
0809
080B
080C
080D
080E
080F
00D1
00D2
00D3
00D4
00D5
00D6
00D7
00D8
00D9
00DA
00DB
00DC
0CFC
0186
0643
0AE5
0CF3
0186
0643
0AE8
0CCF
0186
0643
0AE1
00DD
00DE
00DF
00E0
02A4
07E0
05F2
0AEB
00E1
00E2
00E3
00E4
02A4
06E0
05F2
0AEB
00E5 0650
00E6 05F2
00E7 0AEB
00E8 0670
00E9 05F2
00EA 0AEB
00EB 0210
00EC 0E03
0409
0410
0411
0412
0413
0414
0415
0416
0417
0418
0419
0421
0422
0423
0424
0425
0426
0427
0428
0429
0430
0431
0432
0433
0434
0435
0436
0437
0438
0439
0440
0441
0442
0444
0445
0446
0447
0448
0449
0450
0451
0452
0453
0454
0455
0456
0457
0458
0459
0460
0461
0462
0463
0464
0465
0466
0467
0468
0469
0470
0471
0472
0473
0474
0475
0476
0477
0478
0479
GET2580
MOVLW
GOTO
8
GETCOM
;SET COUNT TO 8
MOVLW
GOTO
D12'
GETCOM
;SET COUNT TO 12
MOVLW
GOTO
D16'
GETCOM
;SET COUNT TO 16
DECF
MOVF
ADDWF
RETLW
RETLW
RETLW
RETLW
RETLW
RETLW
RETLW
RETLW
RETLW
RETLW
RETLW
RETLW
RETLW
RETLW
RETLW
RETLW
TEMP
TEMP,W
PC
1
4
7
0A
2
5
8
0
3
6
9
0B
0C
0D
0E
0F
;REDUCE BY 1
;GET IN W
;JUMP TO TABLE
;KEY 1
;KEY 4
;KEY 7
;KEY A
;KEY 2
;KEY 5
;KEY 8
;KEY 0
;KEY 3
;KEY 6
;KEY 9
;KEY B
;KEY C
;KEY D
;KEY E
;KEY F
B11111100'
PORT_B,0
STATUS,Z
MASK_ALARM
B11110011'
PORT_B,0
STATUS,Z
MASK_COLON
B11001111'
PORT_B,0
STATUS,Z
MASK_PM
;CHK IF DIGIT 1
;
/
;NO THEN SKIP
;ELSE MASK ALARM
;CHK IF DIGIT 2
;
/
;NO THEN SKIP
;ELSE MASK COLON
;CHK IF DIGIT 3
;
/
;NO THEN SKIP
;ELSE MASK PM
FSR
F0,AM_PM
DIGIT,7
BLNK_LEAD_0
;INC FSR
;IF 0 THEN AM
;SET MSB
;NEXT
FSR
F0,AM_PM
DIGIT,7
BLNK_LEAD_0
;INC FSR
;IF 1 THEN PM
;SET MSB
;NEXT
FLAG,ALRMLED
DIGIT,7
BLNK_LEAD_0
FLAG,COLON
DIGIT,7
BLNK_LEAD_0
FLAG,W
B00000011'
;GET IN W
;SEE IF IN DEM
;
GET369B
;
GETCDEF
;
KEY_TBL
;
;
MASK_ANNC
MOVLW
XORWF
BTFSC
GOTO
MOVLW
XORWF
BTFSC
GOTO
MOVLW
XORWF
BTFSC
GOTO
MASK_AM
INCF
BTFSS
BSF
GOTO
MASK_PM
INCF
BTFSC
BSF
GOTO
MASK_ALARM
BTFSC
BSF
GOTO
MASK_COLON
BTFSC
BSF
GOTO
;
BLNK_LEAD_0
MOVF
ANDLW
DS00529C-page 13
2-121
0F02
0643
0800
0CFC
0186
0743
0800
0C3F
0152
0F3F
0743
0800
0C80
0172
0800
00FC
00FD
00FE
00FF
0C0F
0025
0C00
0005
0100
0101
0102
0103
0CFF
0026
0C00
0006
0104
0105
0106
0107
0C00
0027
0C00
0007
0108 0C04
0109 0002
010A
010B
010C
010D
010E
010F
0110
0111
0112
0113
0114
0115
0116
0117
0118
0C60
0021
0068
0069
006A
0C12
002B
002D
006C
0C03
0030
0078
0079
0077
0A01
0200
0201
0202
0203
0204
0205
0206
0207
0201
0743
0A00
0C60
0021
02A8
06D0
0A70
0480
0481
0482
0483
0484
0485
0486
0487
0488
0489
0490
0491
0492
0493
0494
0495
0496
0497
0499
0500
0501
0502
0503
0504
0505
0506
0507
0508
0509
0510
0511
0512
0513
0514
0515
0516
0517
0518
0519
0520
0521
0522
0523
0524
0525
0526
0527
0528
0529
0530
0531
0532
0533
0534
0535
0536
0537
0538
0540
0541
0542
0543
0544
0545
0546
0547
0548
0549
0550
XORLW
BTFSC
RETLW
MOVLW
XORWF
BTFSS
RETLW
MOVLW
ANDWF
XORLW
BTFSS
RETLW
MOVLW
ANDWF
RETLW
B00000010'
STATUS,Z
0
B11111100'
PORT_B,0
STATUS,Z
0
B00111111'
DIGIT,0
B00111111'
STATUS,Z
0
B10000000'
DIGIT
0
;CHECK
;NO THEN DO
;ELSE RETURN
;SEE IF DIGIT 1
;
/
;YES THEN SKIP
;RETURN
;ELSE MASK G AND ANUNC
;GET IN W
;SEE IF 0
;YES THEN SKIP
;RETURN
;ELSE BLANK D1
;
/
;RETURN
;
;
;
;
;THIS ROUTINE SETS UP PORTS A,B,C AND THE INTERNAL
;REAL TIME CLOCK COUNTER.
INIT_CLK
MOVLW
B00001111'
;MAKE ACTIVE HIGH
MOVWF
PORT_A
;
/
MOVLW
B00000000'
;SET PORT A AS OUTPUTS
TRIS
PORT_A
;
MOVLW
B11111111'
;SET LEVELS HIGH
MOVWF
PORT_B
;
/
MOVLW
B00000000'
;SET PORT B AS OUTPUTS
TRIS
PORT_B
;
MOVLW
B00000000'
;SET LEVELS LOW
MOVWF
PORT_C
;
/
MOVLW
B00000000'
;SET PORT C AS OUTPUTS
TRIS
PORT_C
;
/
;
MOVLW
B00000100'
;SET UP PRESCALER
OPTION
;
/
;
MOVLW
MSEC5
;RTCC = 5 mSEC
MOVWF
RTCC
;
/
CLRF
MSTMR
;CLEAR MSTMR
CLRF
STMR
; & SEC TMR
CLRF
MTMR
;& MINUTES
MOVLW
12H
;MAKE HRS = 12
MOVWF
HTMR
;
/
MOVWF
HALARM
;MAKE HRS = 12
CLRF
MALARM
;
/
MOVLW
B00000011'
;SET TO TEST MODE
MOVWF
FLAG
;
/
CLRF
ALFLAG
;CLEAR ALL FLAG
CLRF
AAFLAG
;
/
CLRF
ENTFLG
;
/
GOTO
TEST_HARDWARE
;
;All routines related to timer updates are located at
;address 200 and above.
ORG
0200
;
UPDATE_TIMERS
MOVF
RTCC,W
;SEE IF RTCC = 0
BTFSS
STATUS,Z
;IF 0 THEN SKIP
GOTO
UPDATE_TIMERS
;ELSE LOOP
MOVLW
MSEC5
;RTCC = 5 mSEC
MOVWF
RTCC
;
/
INCF
MSTMR
;INC 5 MILLI SEC
BTFSC
FLAG,KEY_HIT
;NO KEY HIT THEN SKIP
GOTO
CHK_DE_BOUNCE
;ELSE DEBOUNCE
DS00529C-page 14
2-122
0210
0E03
0F01
0743
0A14
0550
0570
0C64
0088
0703
0450
0A19
0214
0215
0216
0217
0218
0570
0C64
0088
0703
0470
0219
021A
021B
021C
0208
0FC8
0743
0800
021D
021E
021F
0220
0221
0222
0223
0224
0225
0226
0227
0068
0216
0E0F
0743
00F6
0C09
0024
0955
0D00
0743
0A38
0228
0229
022A
022B
022C
022D
022E
022F
0230
0231
0232
0233
0234
03B6
0216
0E0F
0743
00F6
03B6
0966
0C0A
0024
0955
0D00
0743
0A38
0235 0C0B
0236 0024
0237 0989
0238
0239
023A
023B
023C
023D
0718
0800
0658
0800
0638
0A4D
023E
023F
0240
0241
0242
0243
020D
018B
0743
0800
020C
018A
0551
0552
0553
0554
0555
0556
0557
0558
0559
0560
0561
0562
0563
0564
0565
0566
0567
0568
0569
0570
0571
0572
0573
0574
0575
0576
0577
0578
0579
0580
0581
0582
0583
0584
0585
0586
0587
0588
0589
0590
0591
0592
0593
0594
0595
0596
0597
0598
0599
0600
0601
0602
0603
0604
0605
0606
0607
0608
0609
0610
0611
0612
0613
0614
0615
0616
0617
0618
0619
UP_TMR_1
MOVF
FLAG,W
ANDLW
B00000011'
XORLW
B00000001'
BTFSS
STATUS,Z
GOTO
UP_TMR_2
BSF
FLAG,ALRMLED
BSF
FLAG,COLON
MOVLW
D100'
SUBWF
MSTMR,0
BTFSS
STATUS,C
BCF
FLAG,ALRMLED
GOTO
UP_TMR_3
UP_TMR_2
BSF
FLAG,COLON
MOVLW
D100'
SUBWF
MSTMR,0
BTFSS
STATUS,C
BCF
FLAG,COLON
UP_TMR_3
MOVF
MSTMR,0
XORLW
D200'
BTFSS
STATUS,Z
RETLW
0
;INC SECONDS COUNT
CLRF
MSTMR
MOVF
MIN_SEC,W
ANDLW
B00001111'
BTFSS
STATUS,Z
DECF
MIN_SEC
MOVLW
STMR
MOVWF
FSR
CALL
INC_60
IORLW
0
BTFSS
STATUS,Z
GOTO
CHK_AL_TIM
;INC MINUTES COUNT
SWAPF
MIN_SEC
MOVF
MIN_SEC,W
ANDLW
B00001111'
BTFSS
STATUS,Z
DECF
MIN_SEC
SWAPF
MIN_SEC
CALL
CHK_SILNC_TIM
MOVLW
MTMR
MOVWF
FSR
CALL
INC_60
IORLW
0
BTFSS
STATUS,Z
GOTO
CHK_AL_TIM
;INC HOUR COUNT
MOVLW
HTMR
MOVWF
FSR
CALL
INC_HR
;
CHK_AL_TIM
BTFSS
ALFLAG,ALONOF
RETLW
0
BTFSC
ALFLAG,SILNC
RETLW
0
BTFSC
ALFLAG,INAL
GOTO
CHK_1_MIN
;
RETLW
0
MOVF
HALARM,W
XORWF
HTMR,W
BTFSS
STATUS,Z
RETLW
0
MOVF
MALARM,W
XORWF
MTMR,W
;ALARM MODE?
;
/
;
/
;SKIP IF YES
;DO NEXT
;LIGHT LED
;
/
;IF 1/2 SEC
; BLINK
; /
;ALARM LED
;SKIP
;TURN ON
;<100 BLINK COLON
;
/
;YES THEN SKIP
;ELSE TURN OFF
;GET MSTMR IN W
;= 200 THEN SKIP
;
/
;CLEAR MS_TMR
;GET MIN_SEC TIMER
;MASK MINUTES
;ZERO THEN SKIP
;REDUCE SECONDS
;LOAD FSR WITH S_TMR
;
/
;INC SECONDS
;DO AN OPERATION
;IF RETURN = 0 SKIP
;CHK ALRM
;SWAP MIN SEC
;GET MIN_SEC IN W
;MASK SECONDS
;SKIP IF NOT SET
;ELSE DEC
;SWAP BACK
;SILNCE ON?
;INC MINUTES
;
/
;
/
;DO AN OPERATION
;IF 0 THEN SKIP
;CHECK ALRAM TIME
;GET HTMR IN FSR
;INC HOURS
DS00529C-page 15
2-123
0743
0800
0209
0743
0800
0538
0C10
0036
0800
024D
024E
024F
0250
0251
0252
0253
0254
0396
0E0F
0743
0800
0438
0478
0505
0800
0255
0256
0257
0258
0259
025A
025B
025C
025D
025E
025F
0260
0261
0262
0263
0264
0265
02A0
0200
0E0F
0F0A
0743
0801
0CF0
0160
03A0
02A0
0200
03A0
0F06
0743
0801
0060
0800
0266
0267
0268
0269
026A
026B
026C
026D
026E
026F
0758
0800
0396
0E0F
0743
0800
0458
0C10
0036
0800
0270
0271
0272
0273
0274
0275
06B7
0A76
07B0
0A7F
0678
0A86
0276
0277
0278
0279
027A
027B
027C
027D
05B7
0215
0643
0C14
0035
0405
02F5
0A08
0620
0621
0622
0623
0624
0625
0626
0627
0628
0629
0630
0631
0632
0633
0634
0635
0636
0637
0638
0639
0640
0641
0642
0643
0644
0645
0646
0647
0648
0649
0650
0651
0652
0653
0654
0655
0656
0657
0658
0660
0661
0662
0663
0664
0665
0666
0667
0668
0669
0670
0671
0672
0673
0674
0675
0676
0677
0678
0679
0680
0681
0682
0683
0684
0685
0686
0687
0688
0689
BTFSS
RETLW
MOVF
BTFSS
RETLW
BSF
MOVLW
MOVWF
RETLW
;
CHK_1_MIN
SWAPF
ANDLW
BTFSS
RETLW
BCF
BCF
BSF
RETLW
;
INC_60
INCF
MOVF
ANDLW
XORLW
BTFSS
RETLW
MOVLW
ANDWF
SWAPF
INCF
MOVF
SWAPF
XORLW
BTFSS
RETLW
CLRF
RETLW
;
;
CHK_SILNC_TIM
BTFSS
RETLW
SWAPF
ANDLW
BTFSS
RETLW
BCF
MOVLW
MOVWF
RETLW
;
;
CHK_DE_BOUNCE
BTFSC
GOTO
BTFSS
GOTO
BTFSC
GOTO
CHK_DEB_1
BSF
MOVF
BTFSC
MOVLW
MOVWF
BCF
DECFSZ
GOTO
STATUS,Z
0
STMR,W
STATUS,Z
0
ALFLAG,INAL
10
MIN_SEC
0
MIN_SEC,W
B00001111'
STATUS,Z
0
ALFLAG,INAL
ALFLAG,INAA
PORT_A,BEP
0
;SWAP IN W
;CHK MINUTES
;0 THEN SKIP
;ELSE RET
;CLR IN ALARM
;CLR IN AA
;STOP BEEPER
F0
F0,0
B00001111'
B00001010'
STATUS,Z
1
B11110000'
F0
F0
F0
F0,0
F0
D6'
STATUS,Z
1
F0
0
ALFLAG,SILNC
0
MIN_SEC,W
B00001111'
STATUS,Z
0
ALFLAG,SILNC
10
MIN_SEC
0
;CHK IF IN SILENCE
;NO THEN SKIP
;GET MIN IN W
;MASK SECS
;ZERO?
;NO THEN RET
;RESET SILENCE
;SET I MIN TIMER
;
/
ENTFLG,INKEYBEP
CHK_DEB_1
FLAG,KEY_BEEP
CHK_SERV
ALFLAG,INAA
CHK_BEP_ON
ENTFLG,INKEYBEP
DEBOUNCE,W
STATUS,Z
D20'
DEBOUNCE
PORT_A,BEP
DEBOUNCE
UP_TMR_1
;SET FLAG
;GET IN W
;NZ THEN SKIP
;ELSE DB 100 mSEC
;
/
;TURN ON BEEPER
;DEC AND CHK
;GO BACK
DS00529C-page 16
2-124
027F
0280
0281
0282
0283
0284
0285
07F0
0A08
04F0
04D0
04B0
04B7
0A08
0286 0705
0287 0A08
0288 0A76
0289
028A
028B
028C
028D
028E
028F
0290
0291
0292
02A0
0200
0031
0E0F
0F0A
0743
0A93
0C10
0020
0AA3
0293
0294
0295
0296
0297
0298
0299
029A
029B
04E0
0200
0F12
0743
0A9D
07F1
0A9C
04E0
0800
029C 05E0
029D
029E
029F
02A0
0200
0F13
0743
0AA3
02A1 0C01
02A2 0020
02A3 06F1
02A4 05E0
02A5 0800
000A
000B
000C
000D
000E
000F
0400 07D0
0401 0800
0690
0691
0692
0693
0694
0695
0696
0697
0698
0699
0700
0701
0702
0703
0704
0705
0706
0707
0708
0709
0710
0711
0712
0713
0714
0715
0716
0717
0718
0719
0720
0721
0722
0723
0724
0725
0726
0727
0728
0729
0730
0731
0732
0733
0734
0735
0736
0737
0738
0739
0740
0741
0742
0743
0744
0745
0747
0748
0749
0750
0751
0752
0753
0754
0755
0756
0757
0758
0759
BSF
PORT_A,BEP
CHK_SERV
;
CLRF
DEBOUNCE
;
BSF
PORT_A,BEP
BTFSS
FLAG,SERVICED
GOTO
UP_TMR_1
BCF
FLAG,SERVICED
BCF
FLAG,KEY_HIT
BCF
FLAG,KEY_BEEP
BCF
ENTFLG,INKEYBEP
GOTO
UP_TMR_1
;
CHK_BEP_ON
BTFSS
PORT_A,BEP
GOTO
UP_TMR_1
GOTO
CHK_DEB_1
;
;
INC_HR
INCF
F0
MOVF
F0,W
MOVWF
TEMP
ANDLW
B00001111'
XORLW
D10'
BTFSS
STATUS,Z
GOTO
INC_AM_PM
MOVLW
B00010000'
MOVWF
F0
GOTO
RESTORE_AM_PM
INC_AM_PM
BCF
F0,AM_PM
MOVF
F0,W
XORLW
12H
BTFSS
STATUS,Z
GOTO
CHK_13
BTFSS
TEMP,AM_PM
GOTO
SET_AM_PM
BCF
F0,AM_PM
RETLW
0
SET_AM_PM
BSF
F0,AM_PM
CHK_13
MOVF
F0,W
XORLW
13H
BTFSS
STATUS,Z
GOTO
RESTORE_AM_PM
SET_1_HR
MOVLW
B00000001'
MOVWF
F0
RESTORE_AM_PM
BTFSC
TEMP,AM_PM
BSF
F0,AM_PM
RETLW
0
;
;
;
ORG
400
;
;KEY DEFINITIONS
ALARM_KEY
EQU
CE_KEY
EQU
SNOOZE_KEY
EQU
AM_PM_KEY
EQU
CLR_ALARM_KEY
EQU
SET_KEY
EQU
;
SERVICE_KEYS
BTFSS
FLAG,KEY_HIT
RETLW
0
2
;INC HOUR TIMER
;GET HR TMR IN W
;SAVE IN TEMP
;CHK LO BYTE = 10
;
/
;YES THEN SKIP
;ELSE CHK 12
;LOAD 1 IN MSB
;RESTORE AM/PM
;CLEAR AM/PM
;GET IN W
;SEE IF 12 HEX
;YES THEN SKIP
;ELSE CHK 13
;IF SET, SKIP
;ELSE SET
;CLEAR FLAG
;RETURN
;SET FLAG
;GET IN W
;SEE IF 13
;YES THEN SKIP
;SET TO 1
;SKIP IF AM
;ELSE SET TO PM
0A
0B
0C
0D
0E
0F
DS00529C-page 17
2-125
06F0
0800
05F0
0210
0E03
0643
0A10
0031
02F1
0A0D
0A1D
040D 02F1
040E 0800
040F 0A2A
0410
0411
0412
0413
0414
0415
0416
0417
0418
0419
041A
041B
09BA
0D00
0643
0800
0C0F
0193
0643
0A91
0C0A
0193
0643
0AAB
041C 0800
041D
041E
041F
0420
0421
0422
0423
0424
0425
0426
0427
0428
0429
09BA
0D00
0643
0800
0C0F
0193
0643
0A9C
0C0A
0193
0643
0AA2
0A1C
042A
042B
042C
042D
042E
042F
0430
0431
0432
0433
0434
0435
0436
0437
0438
0439
043A
043B
09BA
0D00
0643
0800
0C0F
0193
0643
0A3F
0C0B
0193
0643
0A48
0737
0A54
0757
0A5F
0777
0A72
0760
0761
0762
0763
0764
0765
0766
0767
0768
0769
0770
0771
0772
0773
0774
0775
0776
0777
0778
0779
0780
0781
0782
0783
0784
0785
0786
0787
0788
0789
0790
0791
0792
0793
0794
0795
0796
0797
0798
0799
0800
0801
0802
0803
0804
0805
0806
0807
0808
0809
0810
0811
0812
0813
0814
0815
0816
0817
0818
0819
0820
0821
0822
0823
0824
0825
0826
0827
0828
BTFSC
RETLW
BSF
MOVF
ANDLW
BTFSC
GOTO
MOVWF
DECFSZ
GOTO
GOTO
FLAG,SERVICED
0
FLAG,SERVICED
FLAG,W
B00000011'
STATUS,Z
RTMKS
TEMP
TEMP
SK1
ATMKS
DECFSZ
RETLW
GOTO
TEMP
0
DEMKS
;REDUCE TEMP
;11 THEN RETURN
;10, DATA ENTRY MODE
SK1
;
;REAL TIME MODE KEY SERVICE
RTMKS
CALL
CHK_AL_KEYS
IORLW
0
BTFSC
STATUS,Z
RETLW
0
MOVLW
SET_KEY
XORWF
NEW_KEY,W
BTFSC
STATUS,Z
GOTO
SERV_SET_RTM
MOVLW
ALARM_KEY
XORWF
NEW_KEY,W
BTFSC
STATUS,Z
GOTO
SERV_ALARM_RTM
IGNORE_KEY
RETLW
0
;
;ALARM TIME MODE KEY SERVICE
ATMKS
CALL
CHK_AL_KEYS
IORLW
0
BTFSC
STATUS,Z
RETLW
0
MOVLW
SET_KEY
XORWF
NEW_KEY,W
BTFSC
STATUS,Z
GOTO
SERV_SET_ATM
MOVLW
ALARM_KEY
XORWF
NEW_KEY,W
BTFSC
STATUS,Z
GOTO
SERV_ALARM_ATM
GOTO
IGNORE_KEY
;
;DATA ENTRY MODE KEY SERVICE
DEMKS
CALL
CHK_AL_KEYS
IORLW
0
BTFSC
STATUS,Z
RETLW
0
MOVLW
SET_KEY
XORWF
NEW_KEY,W
BTFSC
STATUS,Z
GOTO
DEMKS_END
MOVLW
CE_KEY
XORWF
NEW_KEY,W
BTFSC
STATUS,Z
GOTO
DEMKS_END_1
BTFSS
ENTFLG,HR10
GOTO
ENT_HR_10
BTFSS
ENTFLG,HR
GOTO
ENT_HRS
BTFSS
ENTFLG,MIN10
GOTO
ENT_MIN_10
DS00529C-page 18
2-126
0717
0A4D
020E
002C
020F
002D
0450
0618
0550
0448 0410
0449 0430
044A 0490
044B 05B0
044C 0800
044D
044E
044F
0450
0451
0452
0453
020E
002A
020F
002B
0068
0069
0A48
0454
0455
0456
0457
0458
0459
045A
045B
0213
0643
0A5C
02D3
0A1C
058F
0537
0A4B
045C 048F
045D 0537
045E 0A4B
045F
0460
0461
0462
0463
0464
0465
0466
0C0F
0024
068F
0A6D
0C0A
0093
0603
0A1C
0467 0557
0468
0469
046A
046B
046C
0200
0EF0
0113
0020
0A4B
046D
046E
046F
0470
0471
0C03
0093
0603
0A1C
0A67
0472 0C0E
0829
0830
0831
0832
0833
0834
0835
0836
0837
0838
0839
0840
0841
0842
0843
0844
0845
0846
0847
0848
0849
0850
0851
0852
0853
0854
0855
0856
0857
0858
0859
0860
0861
0862
0863
0864
0865
0866
0867
0868
0869
0870
0871
0872
0873
0874
0875
0876
0877
0878
0879
0880
0881
0882
0883
0884
0885
0886
0887
0888
0889
0890
0891
0892
0893
0894
0895
0896
0897
BTFSS
GOTO
GOTO
DEMKS_END
BTFSS
GOTO
MOVF
MOVWF
MOVF
MOVWF
BCF
BTFSC
BSF
DEMKS_END_1
BCF
BCF
BCF
SERV_COM_RET
BSF
RETLW
;
LD_RTM
MOVF
MOVWF
MOVF
MOVWF
CLRF
CLRF
GOTO
;
ENT_HR_10
MOVF
BTFSC
GOTO
DECFSZ
GOTO
BSF
BSF
GOTO
LD_HENTRY_0
BCF
BSF
GOTO
ENT_HRS
MOVLW
MOVWF
BTFSC
GOTO
MOVLW
SUBWF
BTFSC
GOTO
ENT_LO_COM1
BSF
ENT_LO_COM
MOVF
ANDLW
IORWF
MOVWF
GOTO
ALLOW0_2
MOVLW
SUBWF
BTFSC
GOTO
GOTO
;
ENT_MIN_10
MOVLW
ENTFLG,MIN
ENT_MIN
ENT_AM_PM
;MIN DONE?
;NO THEN GET
;NO THEN GET
ENTFLG,RTATS
LD_RTM
MENTRY,W
MALARM
HENTRY,W
HALARM
FLAG,ALRMLED
ALFLAG,ALONOF
FLAG,ALRMLED
FLAG,0
FLAG,1
FLAG,FLASH
;RTM MODE
;
/
;STOP FLASH
FLAG,KEY_BEEP
0
;RETURN
MENTRY,W
MTMR
HENTRY,W
HTMR
MSTMR
STMR
DEMKS_END_1
;LD IN RTM
;
/
;
/
;
/
;CLR TIME
; /
;GO BACK
NEW_KEY,W
STATUS,Z
LD_HENTRY_0
NEW_KEY,0
IGNORE_KEY
HENTRY,4
ENTFLG,HR10
SERV_COM_RET
;SEE IF 0
;NZ THEN SKIP
;LOAD 0
;1 THE SKIP
;ELSE IGNORE KEY
;SET TO 1
;SET FLAG
;GO GET NEXT
HENTRY,4
ENTFLG,HR10
SERV_COM_RET
;SET TO 0
HENTRY
FSR
HENTRY,4
ALLOW0_2
D10'
NEW_KEY,W
STATUS,C
IGNORE_KEY
ENTFLG,HR
;SET FLAG
F0,W
B11110000'
NEW_KEY,W
F0
SERV_COM_RET
;LD HRS
;MASK LO NIBL
;OR NEW KEY
;SAVE BACK
;GET NEXT
D3'
NEW_KEY,W
STATUS,C
IGNORE_KEY
ENT_LO_COM1
;SEE IF 0 - 2
;
/
;<3 THEN SKIP
MENTRY
2
2
DS00529C-page 19
2-127
047F
0480
0481
0482
0483
0484
0485
0486
0487
0488
0489
048A
048B
048C
048D
048E
0024
0C06
0093
0603
0A1C
0380
0EF0
0113
0020
03A0
0577
0A4B
0C0E
0024
0C0A
0093
0603
0A1C
0597
0A68
0C0D
0193
0743
0A1C
07EF
0A8F
04EF
0A4B
048F 05EF
0490 0A4B
0491
0492
0493
0494
020A
002E
020B
002F
0495
0496
0497
0498
0499
049A
049B
0210
0E01
0037
0CF2
0130
0410
0800
049C
049D
049E
049F
04A0
04A1
020C
002E
020D
002F
0518
0A95
04A2
04A3
04A4
04A5
0718
0AA6
0418
0AA7
04A6 0518
04A7 05B0
0898
0899
0900
0901
0902
0903
0904
0905
0906
0907
0908
0909
0910
0911
0912
0913
0914
0915
0916
0917
0918
0919
0920
0921
0922
0923
0924
0925
0926
0927
0928
0929
0930
0931
0932
0933
0934
0935
0936
0937
0938
0939
0940
0941
0942
0943
0944
0945
0946
0947
0948
0949
0950
0951
0952
0953
0954
0955
0956
0957
0958
0959
0960
0961
0962
0963
0964
0965
0966
MOVWF
MOVLW
SUBWF
BTFSC
GOTO
SWAPF
ANDLW
IORWF
MOVWF
SWAPF
BSF
GOTO
FSR
D6'
NEW_KEY,W
STATUS,C
IGNORE_KEY
F0,W
B11110000'
NEW_KEY,W
F0
F0
ENTFLG,MIN10
SERV_COM_RET
;
/
;ALLOW 0 - 5
;
/
;IF C THEN SKIP
;ELSE IGNORE
;SWAP AND GET
;MASK LO NIBL
;OR NEW KEY
;SAVE BACK
;SWAP BACK
MOVLW
MOVWF
MOVLW
SUBWF
BTFSC
GOTO
BSF
GOTO
MENTRY
FSR
D10'
NEW_KEY,W
STATUS,C
IGNORE_KEY
ENTFLG,MIN
ENT_LO_COM
;DO INDIRECT
;
/
;ALLOW 0 - 9
;SEE IF >
;NO THEN SKIP
;ELSE IGNORE
;SET FLAG
;
/
AM_PM_KEY
NEW_KEY,W
STATUS,Z
IGNORE_KEY
HENTRY,AM_PM
SETAMPM
HENTRY,AM_PM
SERV_COM_RET
;AM/PM KEY?
;
/
;YES THEN SKIP
HENTRY,AM_PM
SERV_COM_RET
;SET FLAG
MTMR,W
MENTRY
HTMR,W
HENTRY
;TRANSFER TIME
;TO DATA ENTRY
;
/
;
/
FLAG,W
B00000001'
ENTFLG
B11110010'
FLAG
FLAG,0
0
;SAVE IN W
;ATM OR RTM MODE?
;SAVE IN ENTFLG
;FORCE 1S
;
/
;
/
MALARM,W
MENTRY
HALARM,W
HENTRY
ALFLAG,ALONOF
SERV_COM
;TRANSFER ALARM
;TO DATA ENTRY
;
/
;
/
;SET FLAG
;GOTO COMMON
ALFLAG,ALONOF
SET_ALONOF
ALFLAG,ALONOF
SERV_ATM_COM
;TEST ON/OFF
;SET ON/OF FLG
;CLEAR FLAG
;RET THRO COM
ALFLAG,ALONOF
;SET FLAG
FLAG,KEY_BEEP
;BEEP
;GET NEXT
;
ENT_MIN
;
ENT_AM_PM
MOVLW
XORWF
BTFSS
GOTO
BTFSS
GOTO
BCF
GOTO
SETAMPM
BSF
GOTO
;
;
;
SERV_SET_RTM
MOVF
MOVWF
MOVF
MOVWF
SERV_COM
MOVF
ANDLW
MOVWF
MOVLW
IORWF
BCF
RETLW
;
SERV_SET_ATM
MOVF
MOVWF
MOVF
MOVWF
BSF
GOTO
;
SERV_ALARM_ATM
BTFSS
GOTO
BCF
GOTO
SET_ALONOF
BSF
SERV_ATM_COM
BSF
DS00529C-page 20
;TEST BIT
;ELSE SET
;CLEAR FLAG
;GOTO END
2-128
04AB
04AC
04AD
04AE
04AF
04B0
05B0
0510
0430
0C05
0036
0800
04B1 0CA0
04B2 0036
04B3 0558
04B4
04B5
04B6
04B7
04B8
04B9
05B0
007A
0079
0478
0505
0800
04BA
04BB
04BC
04BD
04BE
04BF
04C0
04C1
04C2
04C3
04C4
04C5
04C6
0718
0801
0738
0801
0C0E
0193
0643
0AC7
0C0C
0193
0743
0801
0AB1
04C7
04C8
04C9
04CA
04CB
0438
0458
0C0F
0176
0AB4
0600
0601
0602
0603
0604
0605
0738
0800
0658
0800
06B7
0A55
0606 0778
0607
0608
0609
060A
060B
060C
060D
060E
060F
0919
0719
0A21
0739
0A29
0759
0A31
0779
0A39
0967
0968
0969
0970
0971
0972
0973
0974
0975
0976
0977
0978
0979
0980
0981
0982
0983
0984
0985
0986
0987
0988
0989
0990
0991
0992
0993
0994
0995
0996
0997
0998
0999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
MOVLW
ANDWF
RETLW
B11110000'
MIN_SEC
0
;
SERV_ALARM_RTM
BSF
FLAG,KEY_BEEP
;SET BEEP FLAG
BSF
FLAG,0
;SET TO ALARM TIME
BCF
FLAG,1
;
/
MOVLW
D05'
;SAVE 5 IN MIN_SEC
MOVWF
MIN_SEC
;
/
RETLW
0
;
SERV_SNOOZE
MOVLW
0A0
;SNOOZE FOR 10 MINS
MOVWF
MIN_SEC
;
/
BSF
ALFLAG,SILNC
;SET FLAG
CLR_AL_COM
BSF
FLAG,KEY_BEEP
;SET BEEP FLAG
CLRF
AATMR
;RESET AA TIMER
CLRF
AAFLAG
;CLEAR AA FLAGS
BCF
ALFLAG,INAA
;RESET INAA FLAG
BSF
PORT_A,BEP
;TURN OFF BEEPER
RETLW
0
;RET
;
CHK_AL_KEYS
BTFSS
ALFLAG,ALONOF
;ALARM ON?
RETLW
1
;NO THEN RET
BTFSS
ALFLAG,INAL
;IN ALARM?
RETLW
1
;NO THEN SKIP
MOVLW
CLR_ALARM_KEY
;CHECK IF CLR ALARM
XORWF
NEW_KEY,W
;
/
BTFSC
STATUS,Z
;NO THEN SKIP
GOTO
CLR_ALARM
;ELSE CLEAR ALARM
MOVLW
SNOOZE_KEY
;SEE IF SNOOZE HIT
XORWF
NEW_KEY,W
;
/
BTFSS
STATUS,Z
;YES THEN SKIP
RETLW
1
GOTO
SERV_SNOOZE
;
CLR_ALARM
BCF
ALFLAG,INAL
;CLEAR ALARM
BCF
ALFLAG,SILNC
;CLEAR SILENCE
MOVLW
B00001111'
;CLEAR MINS
ANDWF
MIN_SEC
;
/
GOTO
CLR_AL_COM
;
ORG
600
;If the AA alarm is set, then this routine takes care of
;the timing in sounding the alarm.
;
SOUND_AA
BTFSS
ALFLAG,INAL
;SKIP IF IN ALRM
RETLW
0
;ELSE RETURN
BTFSC
ALFLAG,SILNC
;SKIP IF NOT IN SIL
RETLW
0
;ELSE RET
BTFSC
ENTFLG,INKEYBEP ;SKIP IF NOT IN KEY BEP
GOTO
CHK_COLSN
;CHK COLLISION
SND_AA_0
BTFSS
ALFLAG,INAA
;SKIP IF IN AA
SND_AA_1
CALL
INIT_AA
;INIT ALL
BTFSS
AAFLAG,0
;SKIP IF DONE
GOTO
DO_CYCL0
;DO FIRST CYCL
BTFSS
AAFLAG,1
;SKIP IF DONE
GOTO
DO_CYCL1
;ELSE 2ND CYCLE
BTFSS
AAFLAG,2
;SKIP IF DONE
GOTO
DO_CYCL2
;ELSE DO 3RD CYCLE
BTFSS
AAFLAG,3
;SKIP IF DONE
GOTO
DO_CYCL3
;DO CYCLE 4
2
2
DS00529C-page 21
2-129
0799
0A3E
07B9
0A43
07D9
0A48
07F9
0A50
0A07
0619 0079
061A 0578
061B 0A2D
061C
061D
061E
061F
0620
00FA
021A
0743
0801
0800
0621
0622
0623
0624
091C
0743
0800
0519
0625
0626
0627
0628
0505
0C14
003A
0800
0629
062A
062B
062C
091C
0743
0800
0539
062D
062E
062F
0630
0405
0C14
003A
0800
0631
0632
0633
0634
0635
0636
0637
0638
091C
0743
0800
0559
0505
0C64
003A
0800
0639
063A
063B
063C
063D
091C
0743
0800
0579
0A2D
063E
063F
0640
0641
0642
091C
0743
0800
0599
0A25
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
BTFSS
GOTO
BTFSS
GOTO
BTFSS
GOTO
BTFSS
GOTO
GOTO
AAFLAG,4
DO_CYCL4
AAFLAG,5
DO_CYCL5
AAFLAG,6
DO_CYCL6
AAFLAG,7
DO_CYCL7
SND_AA_1
;SKIP IF DONE
;DO CYCLE 5
;SKIP IF DONE
;DO CYCLE 6
;SKIP IF DONE
;DO CYCLE 6
;SKIP IF DONE
;DO CYCLE 7
;GO BACK
CLRF
BSF
GOTO
AAFLAG
ALFLAG,INAA
PUT_ON_100
AATMR
AATMR,W
STATUS,Z
1
0
;REDUCE TIMER
;GET IN W
;CHECK IF Z
;NO THEN NZ
;ELSE 0
DEC_AA_TMR
STATUS,Z
0
AAFLAG,0
;REDUCE TIMER
;IF NZ THEN RET
PORT_A,BEP
D20'
AATMR
0
DEC_AA_TMR
STATUS,Z
0
AAFLAG,1
;REDUCE TIMER
;IF NZ THEN RET
PORT_A,BEP
D20'
AATMR
0
;TURN ON BEEPER
;FOR 100 MSECS
;
/
DEC_AA_TMR
STATUS,Z
0
AAFLAG,2
PORT_A,BEP
D100'
AATMR
0
;REDUCE TIMER
;IF NZ THEN RET
;
/
;SET DONE FLAG
;TURN OFF BEEPER
;FOR 500 MSECS
;
/
DEC_AA_TMR
STATUS,Z
0
AAFLAG,3
PUT_ON_100
;REDUCE TIMER
;IF NZ THEN RET
;
/
;SET DONE FLAG
;DO NEXT CYCLE
DEC_AA_TMR
STATUS,Z
0
AAFLAG,4
PUT_OFF_100
;REDUCE TIMER
;IF NZ THEN RET
;
/
;SET DONE FLAG
;DO NEXT CYCLE
;
INIT_AA
;
DEC_AA_TMR
DECF
MOVF
BTFSS
RETLW
RETLW
;
DO_CYCL0
CALL
BTFSS
RETLW
BSF
PUT_OFF_100
BSF
MOVLW
MOVWF
RETLW
;
DO_CYCL1
CALL
BTFSS
RETLW
BSF
PUT_ON_100
BCF
MOVLW
MOVWF
RETLW
;
DO_CYCL2
CALL
BTFSS
RETLW
BSF
BSF
MOVLW
MOVWF
RETLW
;
DO_CYCL3
CALL
BTFSS
RETLW
BSF
GOTO
;
DO_CYCL4
CALL
BTFSS
RETLW
BSF
GOTO
;
DO_CYCL5
DS00529C-page 22
2-130
091C
0743
0800
05B9
0A2D
0648
0649
064A
064B
064C
064D
064E
064F
091C
0743
0800
05D9
0505
0CC8
003A
0800
0650
0651
0652
0653
0654
091C
0743
0800
05F9
0A2D
0655
0656
0657
0658
0659
065A
065B
0605
0A06
021A
0643
0A5C
00FA
0800
065C 02BA
065D 0800
07FF 0A00
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
CALL
BTFSS
RETLW
BSF
GOTO
;
DO_CYCL6
CALL
BTFSS
RETLW
BSF
BSF
MOVLW
MOVWF
RETLW
;
DO_CYCL7
CALL
BTFSS
RETLW
BSF
GOTO
;
CHK_COLSN
BTFSC
GOTO
MOVF
BTFSC
GOTO
DECF
RETLW
LD_AAT_1
INCF
RETLW
;
ORG
SYS_RESET
GOTO
;
END
DEC_AA_TMR
STATUS,Z
0
AAFLAG,5
PUT_ON_100
;REDUCE TIMER
;IF NZ THEN RET
;
/
;SET DONE FLAG
;DO NEXT CYCLE
DEC_AA_TMR
STATUS,Z
0
AAFLAG,6
PORT_A,BEP
D200'
AATMR
0
;REDUCE TIMER
;IF NZ THEN RET
;
/
;SET DONE FLAG
;TURN OFF BEEPER
;FOR 1000 MSECS
;
/
DEC_AA_TMR
STATUS,Z
0
AAFLAG,7
PUT_ON_100
;REDUCE TIMER
;IF NZ THEN RET
;
/
;SET DONE FLAG
;DO NEXT CYCLE
PORT_A,BEP
SND_AA_0
AATMR,W
STATUS,Z
LD_AAT_1
AATMR
0
AATMR
0
;INC TIMER
;RET
2
2
PIC57
START
- = Unused)
DS00529C-page 23
2-131
Errors
:
Warnings :
0
0
DS00529C-page 24
2-132
AMERICAS (continued)
EUROPE
Corporate Office
Microchip Technology Inc.
2355 West Chandler Blvd.
Chandler, AZ 85224-6199
Tel: 602 786-7200 Fax: 602 786-7277
Technical Support: 602 786-7627
Web: http://www.mchip.com/microhip
Atlanta
Microchip Technology Inc.
500 Sugar Mill Road, Suite 200B
Atlanta, GA 30350
Tel: 770 640-0034 Fax: 770 640-0307
Boston
Microchip Technology Inc.
5 Mount Royal Avenue
Marlborough, MA 01752
Tel: 508 480-9990
Fax: 508 480-8575
Chicago
Microchip Technology Inc.
333 Pierce Road, Suite 180
Itasca, IL 60143
Tel: 708 285-0071 Fax: 708 285-0075
Dallas
Microchip Technology Inc.
14651 Dallas Parkway, Suite 816
Dallas, TX 75240-8809
Tel: 214 991-7177 Fax: 214 991-8588
Dayton
Microchip Technology Inc.
35 Rockridge Road
Englewood, OH 45322
Tel: 513 832-2543 Fax: 513 832-2841
Los Angeles
Microchip Technology Inc.
18201 Von Karman, Suite 455
Irvine, CA 92715
Tel: 714 263-1888 Fax: 714 263-1338
New York
Microchip Technology Inc.
150 Motor Parkway, Suite 416
Hauppauge, NY 11788
Tel: 516 273-5305 Fax: 516 273-5335
San Jose
Microchip Technology Inc.
2107 North First Street, Suite 590
San Jose, CA 95131
Tel: 408 436-7950 Fax: 408 436-7955
United Kingdom
Arizona Microchip Technology Ltd.
Unit 6, The Courtyard
Meadow Bank, Furlong Road
Bourne End, Buckinghamshire SL8 5AJ
Tel: 44 0 1628 851077 Fax: 44 0 1628 850259
France
Arizona Microchip Technology SARL
2 Rue du Buisson aux Fraises
91300 Massy - France
Tel: 33 1 69 53 63 20 Fax: 33 1 69 30 90 79
Germany
Arizona Microchip Technology GmbH
Gustav-Heinemann-Ring 125
D-81739 Muenchen, Germany
Tel: 49 89 627 144 0 Fax: 49 89 627 144 44
Italy
Arizona Microchip Technology SRL
Centro Direzionale Colleoni
Palazzo Pegaso Ingresso No. 2
Via Paracelso 23, 20041
Agrate Brianza (MI) Italy
Tel: 39 039 689 9939 Fax: 39 039 689 9883
ASIA/PACIFIC
Hong Kong
Microchip Technology
Unit No. 3002-3004, Tower 1
Metroplaza
223 Hing Fong Road
Kwai Fong, N.T. Hong Kong
Tel: 852 2 401 1200 Fax: 852 2 401 3431
Korea
Microchip Technology
168-1, Youngbo Bldg. 3 Floor
Samsung-Dong, Kangnam-Ku,
Seoul, Korea
Tel: 82 2 554 7200 Fax: 82 2 558 5934
Singapore
Microchip Technology
200 Middle Road
#10-03 Prime Centre
Singapore 188980
Tel: 65 334 8870 Fax: 65 334 8850
Taiwan
Microchip Technology
10F-1C 207
Tung Hua North Road
Taipei, Taiwan, ROC
Tel: 886 2 717 7175 Fax: 886 2 545 0139
JAPAN
Microchip Technology Intl. Inc.
Benex S-1 6F
3-18-20, Shin Yokohama
Kohoku-Ku, Yokohama
Kanagawa 222 Japan
Tel: 81 45 471 6166 Fax: 81 45 471 6122
9/22/95