1 / 22

EEE305 Microcontroller Systems

This lecture covers the process of analogue to digital conversion using PIC microcontrollers with a focus on C programming. The session outlines how to read ADC values, convert them into a scaled output for visual representation, and use the USART serial port for outputting results. An example is provided for creating a thermometer application that translates thermistor readings into temperature displays. Code examples, along with detailed explanations of data types and scaling, will enhance understanding of microcontroller systems in EEE305.

zulema
Télécharger la présentation

EEE305 Microcontroller Systems

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. 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

  2. Datasheet Chapter 11

  3. C Code to read ADC and O/p reading

  4. Last week’s code to use USART serial port

  5. Main code to test ADC

  6. 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.

  7. 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

More Related