220 likes | 345 Views
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.uk
E N D
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.uk My office 5B18, telephone 028 90 366364 My email IJ.McCrum@ulster.ac.uk EEE305 Microcontroller Systems http://www.eej.ulst.ac.uk/~ian/modules/EEE305
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.
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. Don’t forget to use variables of type float if they are needed 35⁰C ??⁰C 20⁰C XX ZZ YY