What is the digital result for a given input and given

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: result for a given input and given voltage reference Remember that an inp Remember that an input voltage below 0V returns a belo 0V ret result result of 0 Remember that an input voltage above Vref returns a result of 255 Lecture #8 8 February 23, 2010 Lecture #8 7 February 23, 2010 2 Lecture #8 February 23, 2010 Configuration Example Pin 5, Port 1 Gain = 2 Use the internal Vref (with x2 amp) P1MDIN &= ~0x20 P1MDOUT &= ~0x20 P1 |= 0x20 REF0CN = 0x03 ADC1CF &= ~0x01, ADC1CF |= 0x02 ADC1CN = 0x80 AMX1SL = 0x05 February 23, 2010 Lecture #8 9 Starting an A/D Conversion Conduct A/D conversion: Clear conversion complete bit: Clear conversion complete bit: ADC1CN ADC1CN &= ~0x20; Start conversion: ADC1CN ADC1CN |= 0x10; Wait for conversion complete: while((ADC1CN while((ADC1CN & 0x20) == 0x00); Or: while(!(ADC1CN &= 0x20));...
View Full Document

Ask a homework question - tutors are online