KS57C0302
USER'S MANUAL ERRATA
JUNE 1998
9. COMPARATOR (Page 12-5)
The
PROGRAMMING TIP - Programming the Comparator
must be changed as follows:
+
PROGRAMMING TIP - Programming the Comparator
The following code converts the analog voltage input at the CIN0-CIN3 pins into 4-bit digital code.
BITR
EMB
LD
A,#0FH
LD
P1MOD,A
; Analog input selection (CIN0-CIN3)
LD
EA,#0CXH
; x = 0-F, comparator enable
; Internal reference, conversion time
; (30.5 us at 4.19 MHz)
LD
CMOD,EA
WAIT0
LD
L,#1H
WAIT1
LD
W,A
LD
A,#0H
WAIT2
INCS
A
JR
WAIT2
LD
A,CMPREG
; Read the result
DECS
L
JR
WAIT1
CPSE
A,W
JR
WAIT0
LD
P2,A
; Output the result from port 2