Rev. 1.00
106
��ne ��� �01�
Rev. 1.00
10�
��ne ��� �01�
HT66FM5440
Brushless DC Motor A/D Flash MCU
HT66FM5440
Brushless DC Motor A/D Flash MCU
FFFH
FFEH
FFDH
03H
0�H
01H
0
1
�
3
4093 4094 4095 4096
AV
DD
4096
Analog Input Voltage
A/D Conversion
Result
1.5 LSB
0.5 LSB
Ideal A/D Conversion Function
A/D Conversion Programming Examples
The following two programming examples illustrate how to setup and implement an ADSTR
triggered A/D conversion. In the first example, the method of polling the EOCB bit in the ADCR0
register is used to detect when the conversion cycle is complete, whereas in the second example, the
A/D interrupt is used to determine when the conversion is complete.
Example: using an EOCB polling method to detect the end of conversion
clr
AEOCE ;
disable
A/D
interrupt
mov a,03H
mov ADCR1,a ; select f
SYS
/8 as A/D clock
clr ADOFF
mov a,01h ; setup PDPS0 to configure pin AN0
mov PDPS0,a
mov a,00h
mov ADCR0,a ; enable and connect AN0 channel to A/D converter
:
:
start_conversion:
clr ADSTR ; high pulse on start bit to initiate conversion
set ADSTR ; reset A/D
clr ADSTR ; start A/D
polling_EOC:
sz EOCB
; poll the ADCR0 register EOCB bit to detect end of A/D conversion
jmp polling_EOC ; continue polling
mov a,ADRL ; read low byte conversion result value
mov ADRL_buffer,a ; save result to user defined register
mov a,ADRH ; read high byte conversion result value
mov ADRH_buffer,a ; save result to user defined register
:
:
jmp s
tart_conversion ; start next
A/D
conversion