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

Build a Key Operated Gate Locking System Circuit

This simple key-operated gate locking system allows only those persons who know the preset code to open the gate. The code is to be entered from the keypad within the preset time to operate the motor fitted in the gate. If anyone trying to open the gate presses a wrong key in the keypad, the system is disabled and, at the same time, sounds an alarm to alert you of an unauthorized entry. Figs 1 and 2 show the block and circuit diagrams of the key-operated code locking system, respectively. Connect points A, B, C, D, E, F and ground of the circuit to the respective points of the keypad. Keys S7, S16, S14 and S3 are used here for code entry, and the remaining keys are used for disabling the system. It is very important to press the keys in that order to form the code. To start the motor of the gate, press switches S7, S16, S14 and S3 sequentially. If the keys are pressed in a different order from the preset order, the system will lock automatically and the motor will not start. Fig. 1: Bl...

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