Download presentation
Presentation is loading. Please wait.
Published byDustin Ross Modified over 9 years ago
1
EEE305 Microcontroller Systems Lecture 8: Analogue to Digital Conversion using PIC microcontrollers and the C compiler (NB As of 18/04/13 this code uses the older HTC compiler, I will change it to the more modern XC8 compiler in class) Teaching resources are at www.eej.ulst.ac.ukwww.eej.ulst.ac.uk My office 5B18, telephone 028 90 366364 My email IJ.McCrum@ulster.ac.uk http://www.eej.ulst.ac.uk/~ian/modules/EEE305 1/
2
Datasheet Chapter 11
17
C Code to read ADC and O/p reading
18
Last week’s code to use USART serial port
19
Main code to test ADC
21
Further experiments If the ADC returns a number from 0 to 1024 Scale this to 80 (the width of a PUTTY screen) Use a for loop For(i=0;i<scaled_reading;i++){putchar(‘*’);} Printf(“\r\n”); This will print a “graph” across the screen.
22
Making a Thermometer Assume the thermistor initially reads 20 degrees After holding for 60 seconds assume it reads 35 degrees Scale the readings to display degrees i.e If you get a reading of XX for 20 degrees and YY for 35 degrees. 20⁰C 35⁰C XXYYZZ ??⁰C Don’t forget to use variables of type float if they are needed
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.