免电源的电话使用计时器
p;DESCRIPTION:
; USING TCC TO GET 1 SEC INTERRUPT
; 32768/(2*64*256)= 1 SEC
; CRYSTAL MODE 32768 Hz 
; 2 CYCLE AND 2 CLOCK MODE
;
PC == 02
P5 == 0X05 ;PORT 5
P6 == 0X06 ;PORT 6
SEC == 0X10 ;SECOND
ORG 0
0000 JMP INIT ;PROGRAM START
ORG 8
;TCC INTERRUPT-------------------------------------------------
TCCI:
0008 INC SEC
TCCE:
0009 BC 0X0F,0 ;CLEAR TCC_INT
000A RETI
;TABLE 7 SEGEMENT-----------------------------------------
T7:
000B ADD PC,A ; GFE DCBA
000C RETL @0B01000000 ;0 0100 0000
000D RETL @0B01111001 ;1 0111 1001
000E RETL @0B00100100 ;2 0010 0100
000F RETL @0B00110000 ;3 0011 0000
0010 RETL @0B00011001 ;4 0001 1001
0011 RETL @0B00010010 ;5 0001 0010
0012 RETL @0B00000010 ;6 0000 0010
0013 RETL @0B01011000 ;7 0101 1000
0014 RETL @0B00000000 ;8 0000 0000
0015 RETL @0B00010000 ;9 0001 0000
;INIT -----------------------------------------------------------------
INIT:
0016 MOV A,@0X00
0017 MOV SEC,A
0018 IOW 0X0E ;DISABLE WDT
0019 IOW P5 ;PORT 5 OUTPUT
001A IOW P6 ;PORT 6 OUTPUT
001B MOV A,@0X01
001C IOW 0X0F ;ENABLE TCC_INT
001D MOV A,@0X05 ;1/64
001E CONTW
001F ENI
;SCAN --------------------------------------------------------------
SCAN:
0020 MOV A,SEC
0021 CALL T7
0022 IOW P6
0023 MOV P6,A
0024 MOV A,@255 ;DISPLAY DIGIT 0
0025 MOV P5,A
0026 MOV A,SEC
0027 CALL T7
0028 IOW P6
0029 XOR A,@0XFF
002A MOV P6,A
002B MOV A,@00 ;DISPLAY DIGIT 1
002C&nbs 《免电源的电话使用计时器(第7页)》
本文链接地址:http://www.oyaya.net/fanwen/view/146413.html
; USING TCC TO GET 1 SEC INTERRUPT
; 32768/(2*64*256)= 1 SEC
; CRYSTAL MODE 32768 Hz 
;
; 2 CYCLE AND 2 CLOCK MODE
;
PC == 02
P5 == 0X05 ;PORT 5
P6 == 0X06 ;PORT 6
SEC == 0X10 ;SECOND
ORG 0
0000 JMP INIT ;PROGRAM START
ORG 8
;TCC INTERRUPT-------------------------------------------------
TCCI:
0008 INC SEC
TCCE:
0009 BC 0X0F,0 ;CLEAR TCC_INT
000A RETI
;TABLE 7 SEGEMENT-----------------------------------------
T7:
000B ADD PC,A ; GFE DCBA
000C RETL @0B01000000 ;0 0100 0000
000D RETL @0B01111001 ;1 0111 1001
000E RETL @0B00100100 ;2 0010 0100
000F RETL @0B00110000 ;3 0011 0000
0010 RETL @0B00011001 ;4 0001 1001
0011 RETL @0B00010010 ;5 0001 0010
0012 RETL @0B00000010 ;6 0000 0010
0013 RETL @0B01011000 ;7 0101 1000
0014 RETL @0B00000000 ;8 0000 0000
0015 RETL @0B00010000 ;9 0001 0000
;INIT -----------------------------------------------------------------
INIT:
0016 MOV A,@0X00
0017 MOV SEC,A
0018 IOW 0X0E ;DISABLE WDT
0019 IOW P5 ;PORT 5 OUTPUT
001A IOW P6 ;PORT 6 OUTPUT
001B MOV A,@0X01
001C IOW 0X0F ;ENABLE TCC_INT
001D MOV A,@0X05 ;1/64
001E CONTW
001F ENI
;SCAN --------------------------------------------------------------
SCAN:
0020 MOV A,SEC
0021 CALL T7
0022 IOW P6
0023 MOV P6,A
0024 MOV A,@255 ;DISPLAY DIGIT 0
0025 MOV P5,A
0026 MOV A,SEC
0027 CALL T7
0028 IOW P6
0029 XOR A,@0XFF
002A MOV P6,A
002B MOV A,@00 ;DISPLAY DIGIT 1
002C&nbs 《免电源的电话使用计时器(第7页)》