CHAPTER 6 PERIPHERAL HARDWARE FUNCTION
183
User’s Manual U10676EJ3V0UM
6.5.3 Programmable threshold port application
(1) An analog input voltage input to the PTH00 pin is A/D converted with 4-bit resolution.
Figure 6-51. Application Example of Programmable Threshold Port
PTH00 input voltage
Reference voltage (V
REF
)
AV
REF
7.5/16
⋅
AV
REF
V
SS
Conversion
start
Conversion
end
Comparison result
1
0
1
0
<Program example>
The conversion result is stored in bit sequential buffer BSB0 (refer to
6.6 Bit Sequential
Buffer
).
ADCONV: SET
MBE
SEL
MB15
MOV
HL, #0D3H
; H
←
higher 4 bits of PTH0, L
←
bit 3 specification
MOV
XA, #0C0H
MOV
BSB0, A
; BSB0
←
0
LOOP:
SET1
BSB0, @L
MOV
A, BSB0
MOV
PTHM, XA
; Comparison start
MOV
A, #04H
; 36-machine-cycle wait
WAIT:
INCS
A
BR
WAIT
MOV1
CY, @H+PTH0.0 ; Conversion result input
MOV1
BSB0, @L, CY
; Conversion result store
DECS
L
BR
LOOP
; Conversion end
Содержание PD754144
Страница 2: ...2 User s Manual U10676EJ3V0UM MEMO ...