{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

TIPS for completing lab 3

TIPS for completing lab 3 - TIPS for completing lab 3 4 Lab...

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

View Full Document Right Arrow Icon
TIPS for completing lab 3: 4. Lab assignments: 1) ADC and LEDs: First set the analog-to-digital conversion in the Free Running mode, i.e., constantly sampling and updating the ADC Data Register. Choose the appropriate analog input channels on your board as the analog input, tune the reference voltage to an appropriate value (5V), and program your microcontroller to perform single-ended conversions for the selected input. Demonstrate the voltage value via your digital output LEDs. The LEDs should be partitioned such that they turn on corresponding to what range the analog input voltage is in. Since you have 4 LEDs, you can partition the input voltage range into 4 quadrants, i.e. 0-1.25V, 1.25- 2.5V, 2.5-3.75V, and 3.75 to 5V. As the analog voltage increases, more LEDs should turn on in a row. For example, in the third quadrant, 3 LEDs should be on. Notes: Firstly, it is not imperative that the microcontroller be in free running mode. You can simply call the read ADC subroutine, which will activate the ADC 1 time and read the specified channel. Secondly, you need to make sure that the reference voltage you select in the ADMUX register in the initADC routine is correct. You will notice from the register description there are 4 options: AREF, AVCC, and two internal values. We do not want the internal values, and AREF on our board is connected the the 3 rd potentiometer (you can see on the board it is labeled as AREF, and you can also see this on the schematic). AREF allows you to set the high reference voltage of the ADC variably via the potentiometer. All that we want is a fixed high reference of +5Volts. For this you should select AVCC. This is
Image of page 1

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

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

{[ snackBarMessage ]}