| Electronic Components Datasheet Search |
|
P87LPC779FDH Datasheet(PDF) 16 Page - NXP Semiconductors |
|
|
|||||||||||||||||||||||||||||
P87LPC779FDH Datasheet(HTML) 16 Page - NXP Semiconductors |
|
16 / 74 page ![]() Philips Semiconductors P87LPC779 CMOS single-chip 8-bit microcontroller Product data Rev. 02 — 03 May 2004 16 of 74 9397 750 13213 © Koninklijke Philips Electronics N.V. 2004. All rights reserved. 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. |
|
Link URL |
| Does ALLDATASHEET help your business so far? [ DONATE ] |
About Alldatasheet | Advertisement | Contact us | Privacy Policy | Link to Datasheet | Link Exchange | Manufacturer List All Rights Reserved©Alldatasheet.com |
| Russian : Alldatasheetru.com | Korean : Alldatasheet.co.kr | Spanish : Alldatasheet.es | French : Alldatasheet.fr | Italian : Alldatasheetit.com Portuguese : Alldatasheetpt.com | Polish : Alldatasheet.pl | Vietnamese : Alldatasheet.vn Indian : Alldatasheet.in | Mexican : Alldatasheet.com.mx | British : Alldatasheet.co.uk | New Zealand : Alldatasheet.co.nz |
|
Family Site : ic2ic.com |
icmetro.com |