Temperature does not go below 0


Results 1 to 17 of 17

Threaded View

  1. #1
    Join Date
    Sep 2014
    Posts
    25

    Default Temperature does not go below 0

    IAM MAKING TEMPERATURE CONTROLLER USING ntc THERMISTOR FROM -10 DEGREE TO 50 DEGREE.BUT MY TEMPERATURE IS NOT GOING BELOW 0. PLS CHECK MY CODE AND GUIDE ME.THANKS

    Code:
     DG1 VAR BYTE       
     DG2 VAR BYTE    
     DG3 VAR BYTE
     DIGIT VAR BYTE
     DG VAR BYTE
     COUNTT VAR BYTE
     
     NUMB VAR WORD
     N VAR WORD
     adval var word
     temp var word
     TEMPP VAR WORD
     
     ADCON1=%10000000
     adcon0=%00000101 
     TRISA=1           
     TRISB=%00111000   
     TRISC=0           
     
     numb=0
     gosub mread
     'n=numb
     GOSUB DIGITCALC   
    '-------------------------------------------------------------------------
    
    
     MAIN1:
    
    
     GOSUB DISPLAY
     
     IF PORTB.3=1 THEN MREAD
     
     IF PORTB.3=0 THEN MAIN
     
       
     
     
     GOTO MAIN1
     
     
     
    
    
    
    
    
    
    '-------------------------------------------------------------------------
                         MAIN:
    
    
                            ADCON0.2=1  
    
    
                           GO:
                            IF ADCON0.2=1 THEN GO 
         
                            adval.HIGHBYTE = ADRESH                   
                            adval.lowbyte = ADRESL
                            temp=adval 
                            N=temp
                            gosub display
                            gosub digitcalc
                            
                            
                            If adval>NUMB then PORTB.7=0
                            IF ADVAL< NUMB-5 THEN PORTB.7=1
                            GOTO MAIN1
    
    
    
    
                        '_____________________________________
    
    
                         UP:
                         IF NUMB=50 THEN MAIN
                         NUMB=NUMB+1
                         N=NUMB
                         GOSUB DIGITCALC
                         IF PORTB.4=1 THEN MEMORY
                         GOTO MAIN1
                         
                         
                         memory:
                         WRITE 0,numb.HighByte    
                         
                         WRITE 1,numb.LowByte     
                         
                         GOTO MAIN1
    
    
                        '_____________________________________
    
    
                         DOWN:
                         IF NUMB=-10 THEN MAIN      'MIN LIMIT
                         NUMB=NUMB-1
                         N=NUMB
                         GOSUB DIGITCALC
                         IF PORTB.5=1 THEN MEMORY
                         GOTO MAIN1
                         
                         
                        '_____________________________________
                        MREAD:
                        READ 0,numb.HighByte    
                                                        
                        READ 1,numb.LowByte  
                        
                        n=numb
                        gosub digitcalc
                        IF PORTB.4=1 THEN UP
                        IF PORTB.5=1 THEN DOWN
                        goto main1 
                        
                        
                        
                        
              
                        
                        
                        
                          
                          
                         
           ___________________________________________________
            DISPLAY:
            
            
            FOR COUNTT=0 TO 99
    
    
            PORTC=DG1
            PORTB.2=1
            PAUSEUS 300
            PORTB.2=0
    
    
            PORTC=DG2
            PORTB.1=1
            PAUSEUS 300
            PORTB.1=0
    
    
            PORTC=DG3
            PORTB.0=1
            PAUSEUS 300 
            PORTB.0=0
    
    
            NEXT COUNTT
    
    
            RETURN
    
    
           '________________________________________________________________
    
    
    
    
    
    
    '__________________________________________________________________________
    DIGITCALC:
    
    
    DIGIT=0
    LP1:
    IF N<100 THEN DS1
    N=N-100
    DIGIT=DIGIT+1
    GOTO LP1
            DS1:
            GOSUB FND
            DG1=DG
           
    
    
    DIGIT=0
    LP2:
    IF N<10 THEN DS2
    N=N-10
    DIGIT=DIGIT+1
    GOTO LP2
    
    
            DS2:
            GOSUB FND
            DG2=DG
            
    
    
    DIGIT=N
    GOSUB FND
    DG3=DG
    
    
    
    
     
    RETURN
    
    
    
    
    
    
    
    
    '__________________________________________________________________________
    
    
    
    
    '__________________________________________________________________________
    FND:
    
    
    
    
    
    
    
    
    FND0:
    IF DIGIT>0 THEN FND1
    DG=$7E                       '%0111 1110      
    GOTO FNDEND
    
    
    FND1:
    IF DIGIT>1 THEN FND2
    DG=$48                       '%0100 1000      
    GOTO FNDEND
    
    
    FND2:
    IF DIGIT>2 THEN FND3
    DG=$3D                       '%0011 1101      
    GOTO FNDEND
    
    
    FND3:
    IF DIGIT>3 THEN FND4
    DG=$6D                       '%0110 1101      
    GOTO FNDEND
    
    
    FND4:
    IF DIGIT>4 THEN FND5
    DG=$4B                       '%0100 0011      
    GOTO FNDEND
    
    
    FND5:
    IF DIGIT>5 THEN FND6
    DG=$67                       '%0110 0111      
    GOTO FNDEND
    
    
    FND6:
    IF DIGIT>6 THEN FND7
    DG=$77                       '%0111 0111      
    GOTO FNDEND
    
    
    FND7:
    IF DIGIT>7 THEN FND8
    DG=$4C                       '%0100 1100      
    GOTO FNDEND
    
    
    FND8:
    IF DIGIT>8 THEN FND9
    DG=$7F                       '%0111 1111      
    GOTO FNDEND
    
    
    FND9:
    DG=$6F                       '%0110 1111      
    
    
    FNDEND:
    RETURN
    '_________________________________________________ _________________________
    Last edited by Archangel; - 4th June 2015 at 18:22.

Similar Threads

  1. IR Temperature Sensor
    By TravisM in forum mel PIC BASIC Pro
    Replies: 8
    Last Post: - 23rd October 2012, 15:04
  2. read temperature
    By breeno in forum General
    Replies: 16
    Last Post: - 6th October 2010, 12:55
  3. Temperature Logging
    By tonyfelloni in forum mel PIC BASIC Pro
    Replies: 3
    Last Post: - 18th June 2008, 10:29
  4. Temperature Meter
    By Mohammed Mazed in forum Schematics
    Replies: 3
    Last Post: - 18th December 2006, 02:12
  5. temperature controller
    By PoTeToJB in forum mel PIC BASIC Pro
    Replies: 3
    Last Post: - 24th April 2006, 20:01

Members who have read this thread : 1

You do not have permission to view the list of names.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts