Lecture07-AD_handout - ADC1CF |= 0x01; Enable converter:...

Info iconThis preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon
Note: Don’t attempt an A/D conversion until 2ms after AD_Init
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
22 February 2, 2009 Lecture #7 A/D Conversion SFR Summary In program initialization: ± Configure analog input pins – set desired A/D pins in P1MDOUT to “0” and P1 to “1” and PIMDIN to “0” ± Configure Reference – set internal reference by clearing REF0CN pin 3: REF0CN = 0x03; ± Configure A/D converter gain – set to gain of 1:
Background image of page 2
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: ADC1CF |= 0x01; Enable converter: ADC1CN = 0x80; Conduct A/D conversion: Set pin to convert with AMUX1SL: AMUX1SL = XX ; //XX: 0-7 Clear conversion complete bit: ADC1CN &= ~0x20; Start conversion: ADC1CN |= 0x10; Wait for conversion complete: while((ADC1CN & 0x20) == 0x00); Read Results: Access results register: ADresult = ADC1;...
View Full Document

Page1 / 2

Lecture07-AD_handout - ADC1CF |= 0x01; Enable converter:...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online