EasyManua.ls Logo

STC micro STC8A8K64D4 Series - Page 454

Default Icon
901 pages
Print Icon
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Loading...
STC8A8K64D4 Series Manual
- 438 -
P5M1 DATA 0C9H
P5M0 DATA 0CAH
ORG 0000H
LJMP MAIN
ORG 00ABH
LJMP CMPISR
ORG 0100H
CMPISR:
PUSH ACC
ANL CMPCR1,#NOT 40H ; Clear interrupt flag
MOV A,CMPCR1
JB ACC.0,RSING
FALLING:
CPL P1.0 ; Falling edge interrupt test port
POP ACC
RETI
RSING:
CPL P1.1 ; Rising edge interrupt test port
POP ACC
RETI
MAIN:
MOV SP, #5FH
MOV P0M0, #00H
MOV P0M1, #00H
MOV P1M0, #00H
MOV P1M1, #00H
MOV P2M0, #00H
MOV P2M1, #00H
MOV P3M0, #00H
MOV P3M1, #00H
MOV P4M0, #00H
MOV P4M1, #00H
MOV P5M0, #00H
MOV P5M1, #00H
MOV P_SW2,#80H
MOV DPTR,# CMPEXCFG
CLR A
ANL A,#NOT 03H ; P3.7 is CMP+ input pin
; ORL A,#01H ; P5.0 is CMP+ input pin
; ORL A,#02H ; P5.1 is CMP+ input pin
; ORL A,#03H ; ADC input pin is CMP+ input pin
ANL A,#NOT 04H ; P3.6 is CMP- input pin
; ORL A,# 04H ; Internal reference voltage is CMP- input pin
MOVX @DPTR,A
MOV P_SW2,#00H
MOV CMPCR2,#00H
ANL CMPCR2,#NOT 80H ; Comparator forward output
; ORL CMPCR2,#80H ; Comparator inverted output
ANL CMPCR2,#NOT 40H ; Enable 0.1us filtering
; ORL CMPCR2,#40H ; Disable 0.1us filtering
; ANL CMPCR2,#NOT 3FH ; Output comparator result directly
ORL CMPCR2,#10H ; Output comparator result after 16 debounce clocks
MOV CMPCR1,#00H

Table of Contents

Related product manuals