Skip to main content

Digital thermometer with LM35 and PIC16F88


This can be a complete project on its own - a simple DIY digital thermometer with 7-segment displays and only a handful of parts - the PIC16F88, LM35 and a small number of resistors and capacitors running off a regulated 5v supply.
Temperature range - 0 to 150'C
Display type - 3 digit multiplexed 7 segment or 3 individual 7 segments
Controller: PIC16F88
Programming Language: BASIC
Compiler: mikroBASIC PRO for PIC v3.20

Complete code:

'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''

program DigThermo

'Programmer: Syed Tahmid Mahbub
'Compiler: mikroBASIC PRO for PIC v3.20
'Target PIC: 16F88 - 18pin DIP
'Configuration: XT OSC, PWRTE OFF, WDT OFF, RA5 - MCLR OFF, BOR OFF, LVP OFF, CP OFF, CPD OFF, DEBUG OFF, CKMNE OFF, INTEXTSW OFF

dim data7, num7 as byte
dim temperature as longword
dim digit as byte[3]

sub procedure send7 (dim value, seven as byte) 'Common Anode Displays (2 7segments)
    PORTA = 0
    select case value
           case 0 data7 = $C0
           case 1 data7 = $F9
           case 2 data7 = $A4
           case 3 data7 = $B0
           case 4 data7 = $99
           case 5 data7 = $92
           case 6 data7 = $82
           case 7 data7 = $F8
           case 8 data7 = $80
           case 9 data7 = $90
    end select
    PORTB = data7 'send temperature
    select case seven
           case 1 num7 = 2
           case 2 num7 = 4
           case 3 num7 = 8
    end select
    PORTA = num7 'choose which 7segment
end sub

sub procedure GlobInit
    TRISA = 1
    TRISB = 0
    PORTA = 0
    PORTB = 0
    ANSEL = 1 'AN0 analog
    CCP1CON = 0 'PWM off
    CMCON = 7 'Comparator off
end sub

sub procedure delay2ms
    delay_ms(2)
end sub

main:
     GlobInit
     while true
           temperature = (ADC_Read(0) * 500) >> 10
           digit[0] = temperature div 100
           digit[1] = (temperature div 10) mod 10
           digit[2] = temperature  mod 10
           send7(digit[0],1)
           delay2ms()
           send7(digit[1],2)
           delay2ms()
           send7(digit[2],3)
           delay2ms()
     wend
end.

'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''

Schematic:




The code can be freely used and there is no copyright restrictions or anything as such. Only credit the author where necessary.

Hex file can be freely downloaded from:
http://www.4shared.com/file/o-OBjgGB/DigThermo.html

Comments

Popular posts from this blog

A basic Arduino Solar PV Monitor

I have just recently had solar pv installed, mainly to future proof my energy costs, I do not expect it to be like drilling for oil in my back garden, however the return looks to be encouraging. The install gives you another single unit meter, from this you will see the total amount the panels produce, but that is about it. I wanted to know how much the production was as it was happening, I discovered the light blinks on the front of the meter will flash 1000 times for each kWh of electricity which passes through. The rate of the flashing of the LED tells you how much power is currently passing through the meter. [ ]

Apple releases TV spot for new iPods

Apple has just released a fun commercial to showcase its new line of iPod players and the various colours they come in. The TV spot titled ‘Bounce’, has a bunch of colourful iPod touch, iPod nano and iPod shuffles er…bouncing to music. With all that colour and dancing and bouncing, you may forget that Apple’s latest gen line of iPods has some other awesome features. For instance, the fifth gen iPod touch comes with Siri, 4-inch retina display and an A5 chipset. Maybe the next ad will showcase some of these features with less bouncing.link

3 Channels Audio Splitter Amplifier Circuit Diagram using TL084

This is the schematic diagram of 3 channels audio splitter amplifier circuit which built using op-amp IC TL084. The 3 channels amplifier output distribution applies a single TL084.   3 Channels Audio Splitter Amplifier Circuit Diagram The very first step is to capacitive coupling having a p. 1.0 ~ electrolytic capacitor. The entries are railways Vee Y2 or 4.5 V. This enables working with an individual 9V power source. A voltage gain of 10 (1 M?/100 Kohm) is obtained in the first stage, as well as the other three floors are connected as a unity gain voltage followers. Every single output stage drives independently through an amplifier output 50 pF capacitor towards the resistance of 5.1 k ohm load. The response range is flat from 10 Hz to 30 kHz.