| 전자부품 데이터시트 검색엔진 |
|
P87LPC768FD 데이터시트(PDF) 14 Page - NXP Semiconductors |
|
|
|||||||||||||||||||||||||||||
P87LPC768FD 데이터시트(HTML) 14 Page - NXP Semiconductors |
|
14 / 64 page ![]() Philips Semiconductors Preliminary data 87LPC768 Low power, low price, low pin count (20 pin) microcontroller with 4 kB OTP 8-bit A/D, Pulse Width Modulator 2001 Aug 06 12 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 the section Analog Functions. ; 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, 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. reti 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. ADRead: orl ADCON,A ; Add in the new channel number. setb ADCS ; Start A/D conversion. ADChk: jnb ADCI,ADChk ; Wait for ADCI to be set. mov A,DAC0 ; Get A/D result. clr ADCI ; Clear the A/D completion flag. anl ADCON,#0fch ; Clear the A/D channel number. ret |
|
링크 URL |
| ALLDATASHEET 가 귀하에 도움이 되셨나요? [ DONATE ] |
Alldatasheet는? | 광고문의 | 운영자에게 연락하기 | 개인정보취급방침 | 링크 투 데이터시트 | 링크교환 | 제조사별 검색 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 |