mpc82g516a Megawin Technology, mpc82g516a Datasheet - Page 83
mpc82g516a
Manufacturer Part Number
mpc82g516a
Description
8-bit Microcontroller
Manufacturer
Megawin Technology
Datasheet
1.MPC82G516A.pdf
(144 pages)
Available stocks
Company
Part Number
Manufacturer
Quantity
Price
Company:
Part Number:
mpc82g516aE
Manufacturer:
MEGAWIN
Quantity:
1 200
Part Number:
mpc82g516aF
Manufacturer:
MEGAWIN
Quantity:
20 000
- Current page: 83 of 144
- Download datasheet (2Mb)
Prior to using the ADC function, the user should:
1) Turn on the ADC hardware by setting the ADCON bit,
2) Configure the conversion speed by bits SPEED1 and SPEED0,
3) Select the analog input channel by bits CHS1 and CHS0,
4) Configure the selected input (shared with P1) to the Input-Only mode by P1M0 and P1M1 registers, and
5) Configure ADC result arrangement using ADRJ bit.
Now, user can set the ADCS bit to start the A-to-D conversion. The conversion time is controlled by bits SPEED1
and SPEED0. Once the conversion is completed, the hardware will automatically clear the ADCS bit, set the
interrupt flag ADCI and load the 10 bits of conversion result into ADCH and ADCL (according to ADRJ bit)
simultaneously.
As described above, the interrupt flag ADCI, when set by hardware, shows a completed conversion. Thus two
ways may be used to check if the conversion is completed: (1) Always polling the interrupt flag ADCI by software;
(2) Enable the ADC interrupt by setting bits EADC (in AUXIE register) and EA (in IE register), and then the CPU
will jump into its Interrupt Service Routine when the conversion is completed. Regardless of (1) or (2), the ADCI
flag should be cleared by software before next conversion.
16.3 Sample Code for ADC
83
start:
wait_loop:
;...
;...
MOV
ORL
ANL
ANL
;now, suppose the analog input is ready on AIN2 (P1.2)
ORL
MOV
JNB
;now, the 10-bit ADC result is in the ADCH and ADCL.
;...
;...
ADCTL,#0E2h
P1M0,#00000100B
P1M1,#11111011B
AUXR,#10111111B
ADCTL,#00001000B ;ADCS=1
ACC,ADCTL
ACC.4,wait_loop
MPC82G516A Data Sheet
;ADCON=1, turn on ADC hardware
;(SPEED1,SPEED0)=(1,1), Conv. Time= 270 clock cycles
;select AIN0 (P1.2) as analog input
;P1M0,bit2=1 ;configure P1.2 as Input-Only Mode
;P1M1,bit2=0 ;
;ADRJ=0: ADCH contains B9~B2; ADCL contains B1,B0
;wait until ADCI=1
Start A-to-D conversion
conversion completed
MEGAWIN
Related parts for mpc82g516a
Image
Part Number
Description
Manufacturer
Datasheet
Request
R
Part Number:
Description:
8 Bit Micro-Controller with Voice Synthesizer and Melody
Manufacturer:
Megawin Technology Co., Ltd.
Part Number:
Description:
8-bit micro-controller
Manufacturer:
Megawin Technology
Datasheet:
Part Number:
Description:
8-bit micro-controller
Manufacturer:
Megawin Technology
Datasheet:
Part Number:
Description:
8-bit micro-controller
Manufacturer:
Megawin Technology
Datasheet:
Part Number:
Description:
8-bit micro-controller
Manufacturer:
Megawin Technology
Datasheet:
Part Number:
Description:
1-channel 350v, 50ma/80ma Constant Current Dc Led Driver
Manufacturer:
Megawin Technology
Datasheet:
Part Number:
Description:
Universal Pwm Type Led Driver
Manufacturer:
Megawin Technology
Datasheet:
Part Number:
Description:
8 Bits Microcontroller
Manufacturer:
Megawin Technology
Datasheet:
Part Number:
Description:
8-bit Micro-controller
Manufacturer:
Megawin Technology
Datasheet:
Part Number:
Description:
A Single-chip Microcontroller Based On A High Performance 1-t Architecture 80c51
Manufacturer:
Megawin Technology
Datasheet:
Part Number:
Description:
8-bit Microcontroller
Manufacturer:
Megawin Technology
Datasheet:
Part Number:
Description:
Full-speed Usb Micro-controller
Manufacturer:
Megawin Technology
Datasheet:
Part Number:
Description:
Full-speed Usb Micro-controller
Manufacturer:
Megawin Technology
Datasheet:
Part Number:
Description:
8-bit Micro-controller
Manufacturer:
Megawin Technology
Datasheet: