In the last tutorial we learn about the multiplexing technique used with seven segment displays. We learnt how it saves i/o line by using persistence of vision. Only one digit is lit at a time, but to a human eye it is too fast to catch, so we see all four digit lit the same time. In this tutorial we will make a practical use of multiplexed seven segment displays. We will use them to show current room temperature using a LM35 temperature sensor.
Before reading further make sure you know the following concepts
- Multiplexing Seven Segment Display with PIC Micro.
- Using ADC of PIC Micro.
- Interfacing LM35 temperature sensor with PIC Micro.
Schematic for PIC Thermometer
Please note that this schematic is slightly different from our previous schematic on multiplexed seven segment display. The display select i/o pins were RA0,RA1,RA2,RA3 on that schematic. But in this schematic the display lines are RA1,RA2,RA3,RA4 this is because RA0 is used as analog input channel for LM35′s output.
PIC Thermometer using LM35
Multiplexed Seven Segment wiring
We use our PIC Development Board for making the above demo project. The PIC Development Board has all the core circuitry to sustain the MCU while the project specific part is developed on the expansion board.
Multiplexed Seven Segment Display Setup
HI-TECH C Code for Thermometer Project
/********************************************************************
LM35 Temperature Sensor INTERFACING TEST PROGRAM
---------------------------------------------------------
Simple Program to connect with LM temperature sensor using the
internal ADC of PIC MCU.
The program displays the current environment temperature on
LED Module.
MCU: PIC18FXXXX Series from Microchip.
Compiler: HI-TECH C Compiler for PIC18 MCUs (http://www.htsoft.com/)
Copyrights 2008-2011 Avinash Gupta
eXtreme Electronics, India
For More Info visit
http://www.eXtremeElectronics.co.in
Mail: [email protected]
********************************************************************/
#include <htc.h>
#include <math.h>
#include "types.h"
#define _XTAL_FREQ 20000000ul
//Chip Settings
__CONFIG(1,0x0200);
__CONFIG(2,0X1E1F);
__CONFIG(3,0X8100);
__CONFIG(4,0X0081);
__CONFIG(5,0XC00F);
For more detail: Thermometer with PIC Microcontroller