DatasheetQ Logo
Electronic component search and free download site. Transistors,MosFET ,Diode,Integrated circuits

P87LPC779 Ver la hoja de datos (PDF) - Philips Electronics

Número de pieza
componentes Descripción
Fabricante
P87LPC779 Datasheet PDF : 74 Pages
First Prev 11 12 13 14 15 16 17 18 19 20 Next Last
Philips Semiconductors
P87LPC779
CMOS single-chip 8-bit microcontroller
9397 750 13213
Product data
When an A/D conversion is started, Power-down or Idle mode must be activated
within two machine cycles in order to have the most accurate A/D result. These two
machine cycles are counted at the CPU clock rate. When using the A/D with either
Power-down or Idle mode, care must be taken to insure that the CPU is not restarted
by another interrupt until the A/D conversion is complete. The possible causes of
wake-up are different in Power-down and Idle modes.
A/D accuracy is also affected by noise generated elsewhere in the application, power
supply noise, and power supply regulation. Since the P87LPC779 power pins are
also used as the A/D reference and supply, the power supply has a very direct affect
on the accuracy of A/D readings. Using the A/D without Power-down mode while the
clock is divided through the use of CLKR or DIVM has an adverse effect on A/D
accuracy.
8.4.2 Code examples for the A/D
The first piece of sample code shows an example of port configuration for use with
the A/D. This example sets up the pins so that all four A/D channels may be used.
Port configuration for analog functions is described in Section 8.2 “Analog functions”
on page 12.
; Set up port pins for A/D conversion, without affecting other pins.
mov PT0AD,#78h ; Disable digital inputs on A/D input pins.
anl P0M2,#87h ; Disable digital outputs on A/D input pins.
orl P0M1,#78h ; Disable digital outputs on A/D input pins.
Following is an example of using the A/D with interrupts. The routine ADStart begins
an A/D conversion using the A/D channel number supplied in the accumulator. The
channel number is not checked for validity. The A/D must previously have been
enabled with sufficient time to allow for stabilization.
The interrupt handler routine reads the conversion value and returns it in memory
address ADResult. The interrupt should be enabled prior to starting the conversion.
; Start A/D conversion.
ADStart:
orl ADCON,A ; Add in the new channel number.
setb ADCS
; Start an A/D conversion.
; orl PCON,#01h ; The CPU could be put into Idle mode here.
; orl PCON,#02h ; The CPU could be put into Power-down mode here if
RCCLK = 1.
ret
; A/D interrupt handler.
ADInt:
push ACC
; Save accumulator.
mov A,DAC0
; Get A/D result, by reading DAC0 SFR
mov ADResult,A ; and save it in memory.
clr ADCI
; Clear the A/D completion flag.
anl ADCON,#0fch ; Clear the A/D channel number.
pop ACC
; Restore accumulator.
ret
Following is an example of using the A/D with polling. An A/D conversion is started
using the channel number supplied in the accumulator. The channel number is not
checked for validity. The A/D must previously have been enabled with sufficient time
to allow for stabilization. The conversion result is returned in the accumulator.
Rev. 02 — 03 May 2004
© Koninklijke Philips Electronics N.V. 2004. All rights reserved.
16 of 74

Share Link: 

datasheetq.com  [ Privacy Policy ]Request Datasheet ] [ Contact Us ]