Menu

temperature controller using DS18B20 & 3x7segment LED displays

JANIS
2017-08-28
2017-12-04
  • JANIS

    JANIS - 2017-08-28

    Hallo!
    Here is my digital thermometer using 7-segment LED displays. Only the dot that comes next to "C" should be created as a separate point (LED) at the top, because the standard point is at the bottom.
    Thank you to everyone who helped me with this code.

     #chip 16F886,4
      #config osc = int
    'support for Common Cathode
        #define 7Seg_CommonAnode
        #define DISP_SEG_A PORTB.0
        #define DISP_SEG_B PORTB.1
        #define DISP_SEG_C PORTB.2
        #define DISP_SEG_D PORTB.3
        #define DISP_SEG_E PORTB.4
        #define DISP_SEG_F PORTB.5
        #define DISP_SEG_G PORTB.6
        #define DISP_SEG_DOT PORTB.7
    
        #define Disp_Sel_1 PortA.1
        #define Disp_Sel_2 PortA.2
        #define Disp_Sel_3 PortA.3
        dir portb out
        dir porta.1 out
        dir porta.2 out
        dir porta.3 out
    
    #include <DS18B20.h>
    ' DS18B20 port settings
    #define DQ PortC.4
    
    InitTimer0 Osc, PS0_16
    On Interrupt Timer0Overflow Call showdigit
    dim Nun2, Num3 as integer
    
    dig =1
    
     main:
    ReadDigitalTemp
    
      If RxData.7 = 1 Then
        sign=1
        DSint = 0 - DSint
        ''Negative numbers are represented in two's complement plus one format.
        '' For example, -1 is really 65535, -2 is 65534, and so forth.
        Else
        DSint =DSint
        sign=0
        end if
    Num3 = DSInt/10
    Num2 = DSInt%10
    goto main
    
    sub  showdigit
        Select Case dig
    case 1
     If sign =1 Then
    Displaychar 1, 45 
    Else
    Displaychar 1, "C", 1 'display, character, dot 1=yes)
    end if                 ''two undocumented ascii characters for the 7 segment display,
    ''space and minus (32 and 450). Otherwise the DisplayChar function must be a letter or ''number.
        Case 2
         DisplayValue 2, Num3
        Case 3
     DisplayValue 3, Num2
        Case Else
            dig = 1
        End Select
        dig++
        If dig > 3 then dig =1
    end sub
    
     
  • JANIS

    JANIS - 2017-08-30

    I accidentally placed this code under the theme Demonstration code but it was need below the topic User submitted projects. How can i change (Delete from here)?

     
  • Anobium

    Anobium - 2017-08-30

    By magic ...moved

     
  • JANIS

    JANIS - 2017-08-30

    :) Thank you!

     
  • JANIS

    JANIS - 2017-12-04

    Hello to all! However, using this code still revealed weaknesses that I do not know how to fix. The problem is that the sensor is not read from time to time, at that point the indication shows value of 0. This is due to overflow of Timer 0. If prescaler changes to PS0_32 or higher, this problem disappears. But then the displays flash, the frequency is low. Video attached https://youtu.be/le9v-fbVRbc

    Help .please!

     

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.