| Electronic Components Datasheet Search |
|
PFS123 Datasheet(PDF) 65 Page - PADAUK Technology. |
|
|
|||||||||||||||||||||||||||||
PFS123 Datasheet(HTML) 65 Page - PADAUK Technology. |
|
65 / 104 page ![]() PFS123 8bit MTP MCU with 12-bit R-Type ADC ©Copyright 2020, PADAUK Technology Co. Ltd Page 65 of 104 PDK-DS-PFS123-EN_V000-Aug. 26, 2020 5.15.4 Configure the analog pins There are 14 analog signals can be selected for AD conversion, 13 analog input signals come from external pins and one is from internal band-gap reference voltage 1.2V. For those external pins defined as analog input, to avoid leakage current from the digital circuit of the shared IO ports, please always remember to disable the digital input function (set the corresponding bit of padier, pbdier or pcdier register to be 0). Due to the measurement signals of ADC are very small; user should avoid the measured signal to be interfered during the measurement period. Thus, the selected pin should (1) be set to input mode (2) turn off weak pull-high and pull-low resistor (3) set the corresponding pin to analog input by port A/B/C digital input disable register (padier / pbdier / pcdier). 5.15.5 Using the ADC The following example shows how to use ADC with PB0~PB3. First, defining the selected pins: PBC = 0B_XXXX_0000; // PB0 ~ PB3 as Input PBPH = 0B_XXXX_0000; // PB0 ~ PB3 without pull-high resistor PBPL = 0B_XXXX_00XX; // PB2 ~ PB3 without pull-low resistor PBDIER = 0B_XXXX_0000; // PB0 ~ PB3 digital input is disabled Next, setting ADCC register, example as below: $ ADCC Enable, PB3; // set PB3 as ADC input $ ADCC Enable, PB2; // set PB2 as ADC input $ ADCC Enable, PB0; // set PB0 as ADC input Next, setting ADCM register, example as below: $ ADCM /16; // recommend /16 @System Clock=8MHz $ ADCM /8; // recommend /8 @System Clock=4MHz Next, delay 400us, example as below: .Delay 8*400; // System Clock=8MHz .Delay 4*400; // System Clock=4MHz Then, start the ADC conversion: AD_START = 1; // start ADC conversion while(!AD_DONE) NULL; // wait ADC conversion result Finally, it can read ADC result when AD_DONE is high: WORD Data; // two bytes result: ADCRH and ADCRL Data$1 = ADCRH; Data$0 = ADCRL; Data = Data >> 4; The ADC can be disabled by using the following method: $ ADCC Disable; or ADCC = 0; |
|
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 |