DOC PREVIEW
Berkeley ELENG 40 - ADC LABORATORY

This preview shows page 1 out of 4 pages.

Save
View full document
View full document
Premium Document
Do you want full access? Go Premium and unlock all 4 pages.
Access to all documents
Download any document
Ad free experience
Premium Document
Do you want full access? Go Premium and unlock all 4 pages.
Access to all documents
Download any document
Ad free experience

Unformatted text preview:

EECS 100 ADC Laboratory B. Boser Page 1 University of California Berkeley Department of Electrical Engineering and Computer Sciences EECS 100, Professor Bernhard Boser LABORATORY 10 v1 ADC LABORATORY Microcontrollers (and computers in general, for that matter) operate with digital data. However, many “real world signals” such as temperature are analog in nature. An analog-to-digital converter is needed to input such signals into a microcontroller. Analog-to-digital converters, or ADCs for short, are available as standalone electronic components or built into more complex devices. Fortunately our microcontroller has an ADC built in. In this laboratory we will use this ADC to interface the weight scale designed in an earlier laboratory to the microcontroller and have the bar graph display the number of weights put on the scale. ADCs compare an analog input Vin, e.g. 1.387V, to a reference voltage Vref to produce a digital number representing the ratio of the analog input to the reference rounded to the nearest integer. For example, the ADC in our microcontroller converts analog voltages to digital numbers according to the following equation: 󰇧1023󰇨 For example, with Vref =3V and Vin =1.387V, N= 473. Negative input voltages and inputs exceeding the reference produce are clipped to zero and 1023, respectively. The program skeleton below shows the code for using the ADC and configures P1.7 as its input. Conversion results are stored in the variable ADC10MEM. int main( void ) { // Stop watchdog timer to prevent time out reset WDTCTL = WDTPW + WDTHOLD; ADC10CTL1 = INCH_7; // P1.7 is ADC input ADC10CTL0 = SREF_0 // reference is VCC + ADC10SHT_2 // sample rate + ADC10ON; // enable ADC P1OUT = 0; // initialize P1SEL = BIT7; // P1.0 ... 6 are digital IOs, P1.7 is A7 P1DIR = 0x7f; // P1 direction is output for (;;) { ADC10CTL0 |= ENC + ADC10SC; // enable and start conversion while (ADC10CTL1 & ADC10BUSY); // wait for conversion to complete if (ADC10MEM > ...) bar(1); // display result on bar graph ... } } EECS 100 ADC Laboratory B. Boser Page 2 LAB REPORT Lab Session: Name 1: SID: Name 2: SID: 1. Testing the ADC Complete the program such that the bar graph represents graphically the input voltage of the ADC for Vref =3V. I.e. no LEDs on for Vin <50mV and LEDs 0 to 6 on for Vin >2950mV with linear interpolation in-between. Hand in your program at the beginning of the lab. Completed program: ___ of 10 P Test your program in the laboratory by attaching a 500Ω potentiometer between VCC and GND with the slider connected to port P1.7. Do not forget to remove the LED jumper for P1.7! 2. Weight Scale Rebuild the weight scale from Laboratory 4 and connect the output of the instrumentation amplifier to P1.7. Use the laboratory supply to power the weight scale and connect its ground to the ground of the microcontroller board. Modify your program such that the bar graph indicates the number of weights placed on the scale. Show the result to the laboratory GSI. Weight scale with bar graph output: ___ of 10 MEECS 100 ADC Laboratory B. Boser Page 3 SUGGESTIONS AND FEEDBACK Time for completing prelab: Time for completing lab: Please explain difficulties you had and suggestions for improving this laboratory. Be specific, e.g. refer to paragraphs or figures in the write-up. Explain what experiments should be added, modified (how?), or dropped.EECS 100 ADC Laboratory B. Boser Page 4 PRELAB SUMMARY Lab Session: Name 1: SID: Name 2: SID: Summarize your prelab (P) results here and turn this in at the beginning of the lab session. Completed ADC test


View Full Document

Berkeley ELENG 40 - ADC LABORATORY

Documents in this Course
Lecture 3

Lecture 3

73 pages

Lecture 1

Lecture 1

84 pages

Guide 4

Guide 4

8 pages

Diodes

Diodes

7 pages

Quiz

Quiz

9 pages

Load more
Download ADC LABORATORY
Our administrator received your request to download this document. We will send you the file to your email shortly.
Loading Unlocking...
Login

Join to view ADC LABORATORY and access 3M+ class-specific study document.

or
We will never post anything without your permission.
Don't have an account?
Sign Up

Join to view ADC LABORATORY 2 2 and access 3M+ class-specific study document.

or

By creating an account you agree to our Privacy Policy and Terms Of Use

Already a member?