Slideshow

Wednesday, 23 May 2012

PIC Basic Project : Graphical temperature recorder (16F628 + LCD Nokia 3310 + DS18B20)

Graphical temperature recorder

A nice graphic temperature recorder is here for a superb final year project.

TESTED OK PROJECT

component :  PIC 16F628 + LCD Nokia 3310 + DS18B20

 

 

Features :

It shows 60 samples. (new values scrolls left the plot)

Temperature is sampled every 15 Sec. and averaged.

The following parameters are configurable.
Sampling rate 15 Sec. to 3.825 Sec.(255*15)

 

Block Diagram :

Initial scale -30°C to 90°C
Scale resolution 1°C to 20°C division
Display contrast level


Configuration parameters are stored in eeprom.
To change parameter only the eeprom must be reprogrammed (NOT the code)
Refer to source code to know where they are stored.
N.B. Negative temperature for the initial scale value must be stored in 2 compliment form.

Source code given below. (c file and hex code...)

 

 

: : :start: : :

 

 

 '
'      Graphic temperature display
'
'       PIC 16F628
'
'  r.2   16/05/08
'
   DEFINE OSC 4            'internal oscillator   
'
   DEFINE INTHAND Myint   'define interrupt handler
'
 @ DEVICE PIC16F628,INTRC_OSC,WDT_ON,MCLR_OFF,BOD_Off,LVP_OFF,PROTECT_OFF
'
'
AveTEMPL    var   word $79              'average temperature accumulator low
AveTEMPH    var   word $7B              ' "                              high
Wsave       var   byte $7D  SYSTEM      'uso interrupt  sono visibili sempre
Ssave       var   byte $7E  SYSTEM      'nei 3 banchi
Psave       var   byte $7F  SYSTEM      'fino a 7F
'
TmpW        var   word
TEMPnow     var   Word           'temperatura attuale disponibile
'
Kdiv        var   word           'coefficiente divisione calcolo scala
BotSkal     var   word           'bottom scala display
TopSkal     var   word           'top scala display
'
Clk1        var   byte           'orologio int. timer1 32Hz
Secondi     var   byte           'orologio sequenziatore secondi
Sa_rate     var   byte           'sampling rate counter
'
Tmp1        var   byte       'temporanee
Tmp2        var   byte
Tmp3        var   byte
Sbr1        var   byte    
Sbr2        var   byte
'
'riservate gestione display
Nk_ris      var   byte        'riservato display
Pixpntr     var   byte        'index scrittura array PlotPix immagine punti  
Pixcntr     var   byte        'index lettura array display
X           var   byte        'posizione x display
Y           var   byte        'posizione y display
TmpY        var   byte        'copia y
Pix_pre     var   byte        'posizione Y precedente
Char        var   byte        '
Dato        var   byte        'dato al command/data register
'
Flag_V      var   byte        'flag vari
Fl_int      var Flag_V.0      'settato ogni int. Timer1
Fl_Updt     var Flag_V.1      'aggiorna grafico
Fl_Sec      var Flag_V.2      'settato ogni secondo             
Segno       var Flag_V.3      '
Fl_Err      var Flag_V.4      'Error
'           var Flag_V.5      '
'           var Flag_V.6      '
'           var Flag_V.7      '
'
Colonna     var   byte[5]           'colonna grafica display
PlotPix     var   byte[60] bank1    'copia immagine punti grafico
'
'

Dq_DIR      var  TrisA.1    'DS18b20 data direct pin
'      Port  pin number & direction
'            var  PortA.7   'pin 16 I/O                  
'            var  PortA.6   'pin 15 Output               
'            var  PortA.5   'pin 4  Input                              
Nk_res      var  PortA.4   'pin 3   Output   reset display
Mosi        var  PortA.3   'pin 2   Output   master data out      
Spick       var  PortA.2   'pin 1   Output   Spi clock
Dq          var  PortA.1   'pin 18  I/O      DQ DS18b20  
'            var  PortA.0   'pin 17  Output
'                                                      
'osc         var  PortB.7   'pin 13 Input
'osc         var  PortB.6   'pin 12 Input               
LedE        var  PortB.5   'pin 11  Output   led Error
LedA        var  PortB.4   'pin 10  Output   led Acquire DS18b20
Cs          var  PortB.3   'pin 9   Output   cs display
'Tx          var  PortB.2   'pin 8  Output   huart
'Rx          var  PortB.1   'pin 7  Output   huart
C_D         var  PortB.0   'pin 6   Output   command/data sel. register
'
'
'      COSTANTI
'
'Tmr1load  con   34304  '65536-31250+18  1e6/31250 = 32Hz = 0.03125S.
TimrH    con   $86      'timer1 high byte  aggiustato
TimrL    con   $00      'timer1 low byte
Ofst30   con   480      'offset 30 ^C. (30/.0625)
MaxSkal  con   2064     'Lim. sup = 99 + 30gradi =(99*16)+(30*16) = 2064   
AcqTIME  con   15       'lettura temperatura  15 Sec.
'
'eeprom parametri configurazione
Srate    con   6        'sample rate
Risol    con   7        'risoluzione divisioni grafico temperature
IniskaL  con   8        'temperatura inizio scala Low byte
IniskaH  con   9        'temperatura inizio scala High byte
Contrast con   10       'regolazione contrasto display
' eeprom font character
FontNum  con   16       'font numeri 0-9
Space    con   66       'spazio
Gradi    con   71       'simbolo gradi
Comma    con   76       'virgola
Sneg     con   81       'segno negativo
Dot      con   86       'punto
CharC    con   91       'carattere C
ClesF    con   96       'simbolo clessidra piena
ClesE    con   101      'simbolo clessidra vuota
Termo    con   106      'simbolo termometro
'
LEDON    con   1
LEDOF    con   0
Cr       con   13
Lf       con   10
'
'
'---------------------
'
        Goto inizio             ' Skip around interrupt handler
'
asm
Myint                           ; 2*int + 2*goto             4
        movwf   Wsave           ; Save the W register        1
        swapf   STATUS, W       ;                            1
        clrf    STATUS          ; Point to bank 0            1
        movwf   Ssave           ; Save the STATUS register   1
        movf    PCLATH, W       ;                            1
        movwf   Psave           ;                            1
;
        btfss   PIR1,TMR1IF     ;interrupt da Tmr1 ?         2
        goto    Restint         ;no skip
;                
        bcf     T1CON,0         ;STOP TIMER1                 1
        movlw   _TimrH          ;ricarica timer1             1
        movwf   TMR1H           ;                            1
        movlw   _TimrL          ;                            1
        movwf   TMR1L           ;                            1
        bsf    T1CON,0          ;Restart timer1              1
;                                                 totale    18
        bcf     PIR1,TMR1IF     ; toglie flag int.    
        bsf    _Fl_int          ; Fl_int = 1
        incf   _Clk1,F          ; clk1 = clk1 + 1
        movlw  33
        subwf  _Clk1,W          ; if clk1 > 32 then
        btfss  STATUS,c
        goto   Restint
        incf   _Secondi,F       ;secondi = secondi + 1
        clrf   _Clk1            ; clk1 = 0
        bsf    _Fl_sec          ; Fl_sec = 1
Restint
        movf   Psave, W
        movwf  PCLATH
        swapf  Ssave, W
        movwf  STATUS
        swapf  Wsave, F
        swapf  Wsave, W
        retfie                  ;riattiva GIE
endasm 
'       
'
'visualizza scala temperature
Make_skala:
            Dato = $20        'orrizontal addressing modo testo
            gosub Wr_cmnd
            gosub  NK_Clear               
            x = 0 : y = 5             'inizia dal fondo
            gosub go2xy
            read iniSkal,tmpW.byte0    'valore inizio scala temperatura
            read IniskaH,TmpW.byte1   'gestisce numeri negativi
            read risol,tmp2           'valore passo risoluzione          
            tmp3 = 0                  'contatore righe
            repeat
               if tmpW.15 = 1 then            'segno negativo
                  char = sneg
                  TEMPnow = ~TmpW + 1           'complemento 2 
               else
                  char = space            'positivo no segno
                  TEMPnow = TmpW
               endif
               gosub wr_char              'display segno    
               char = TEMPnow.byte0 dig 1
               gosub wr_num               'display  decine
               char = TEMPnow.byte0 dig 0
               gosub wr_num               'display unita
               tmp3 = tmp3 + 1            'sale di una riga
               x = 0 : y = y - 1          'muove dal basso all'alto
               gosub go2xy   
               TmpW = TmpW + Tmp2         'Iniskal + Risol    
           until tmp3 > 4
      return
'
'
'area utilizzata per grafico da 23,1 a 83,5
Plot_assi:
      Y = 1                         'grafico inizia da II riga
      Dato = $22                    'vertical addressing modo graph
      gosub Wr_cmnd
      Colonna[0] = 000001          ' D0 punto piu alto D7 basso Y = 1
      Colonna[1] = 000010          '                                2
      Colonna[2] = 001000          '                                3
      Colonna[3] = 100000          '                                4
      Colonna[4] = %10000000          '                                5
      X = 20
      gosub Go2XY                'linea vert. tratteggio
      gosub Col_copy
      X = 21
      gosub Go2XY                'ripete ancora una volta
      gosub Col_copy
'
      Colonna[0] = 255                 ' Y = 1
      Colonna[1] = 255                 '     2
      Colonna[2] = 255                 '     3
      Colonna[3] = 255                 '     4
      Colonna[4] = 255                 '     5
      X = 22
      gosub Go2XY                'linea verticale continua
      gosub Col_copy
'
      X = 23
      repeat
          gosub Clr_colonna
          Tmp1 = X & 3            'tratteggia linea
          if Tmp1 = 2 then
            Colonna[0] = 000001          ' Y = 1    frame linea tratteggio        
            Colonna[1] = 000010          '     2
            Colonna[2] = 001000          '     3
            Colonna[3] = 100000          '     4
            Colonna[4] = %10000000          '     5
          endif
          gosub Go2XY          'aggiorna posizione orrizzontali
          gosub Col_copy
          X = X + 1
      until X > 83
      return
'
'
Clr_colonna:
     Sbr1 = 0
     repeat
        Colonna[Sbr1] = 0
        Sbr1 = Sbr1 + 1
     until Sbr1 > 4
      return
'
'invia la colonna al display
'il posizionamento x y deve essere gia predisposto  Go2XY
Col_copy:
        Dato = $22                 'vertical addressing modo graph
        gosub Wr_cmnd
        sbr2 = 0
        repeat
           Dato = Colonna[sbr2]
           gosub Wr_dato         
           sbr2 = sbr2 + 1
        until sbr2 > 4
        return
'
' mantiene frame e tratteggio assi x
Keep_Frame:
        gosub Clr_colonna                    'cancella linea
        Sbr1 = X & 3
        if Sbr1 = 2 then
           Colonna[0] = 000001          ' Y = 1  alto linea
           Colonna[1] = 000010          '     2
           Colonna[2] = 001000          '     3  linee orr. spaziate di
           Colonna[3] = 100000          '     4  10 pixel
           Colonna[4] = %10000000          '     5   basso linea             
        endif
        return
'
'il primo punto va settato con Pix_On
'la posizione X deve gia essere predisposta
'raccorda il punto precedente al punto attuale y sulla stessa colonna
Join_dot:
         TmpY = Y                       'fa una copia di obiettivo
         if y = pix_pre then pix_on     ' set pixel & RETURN
'            gosub pix_on                
'            return
'         endif 
         if y > pix_pre then              'linea in salita
               repeat
                  pix_pre = pix_pre + 1
                  y = pix_pre             'passa parametro
                  gosub pix_on            'accende pixel nella colonna
               until y = tmpy             'fino a raggiungere obiettivo
         else                             'linea in discesa
               repeat
                  pix_pre = pix_pre - 1
                  y = pix_pre
                  gosub pix_on
               until y = tmpy
         endif       
         return
'
'
'Setta il pixel nella colonna in uso alla posizione Y
'eventuali bit già presenti non vengono alterati
'valori validi di y da 0 a 39
Pix_On:
         Tmp1 = 39 - Y                   'inverte verso 1=basso 40=alto
         Tmp2 = Tmp1 // 8                'localizza bit nel byte
         Tmp1 = Tmp1 >> 3                '/8 localizza array
         Tmp3 = 1                        'posiziona bit da settare
         Tmp3 = Tmp3 << Tmp2             'lo sposta in basso
         tmp2 = Colonna[Tmp1]            'recupera byte alla locazione
         tmp2 = tmp2 | Tmp3              'set pixel
         Colonna[Tmp1] = tmp2            'risalva
         return
'
'trova il punto da mettere sul grafico
'ritorna valori tra 0 e 39
Find_dot:
'controllo limiti display mantiene entro l'area grafica
        tmp1 = 39
        if TEMPnow > topskal then Puntox
        tmp1 = 0
        if TEMPnow < BotSkal then Puntox
'calcola il valore del punto = (temp attuale - inizio scala) * 10 / kdiv      
        tmpw = (TEMPnow - BotSkal) * 10
        tmp1 = TMPW / Kdiv
Puntox:          
        plotpix[pixpntr] = tmp1     'salva punto
        pixpntr = pixpntr + 1
'ATTENZIONE occorre sempre chiamare make_room per mantenere i pointer  
         return
'
'se l'array è completo fa scorrere a Sx i punti
'libera l'ultima posizione e riposiziona il pointer alla fine      
Make_room:           
        if pixpntr > 59 then
           sbr1 = 1                 'rd pointer
           sbr2 = 0                 'wr pointer
           repeat
               tmp1 = plotpix[sbr1]     'fa spazio per prossimo valore
               plotpix[sbr2] = tmp1     'scarica prima posizione
               sbr1 = sbr1 + 1
               sbr2 = sbr2 + 1
           until sbr1  > 59            'fino alla fine dell'array
           pixpntr = 59                'mantiene poiter a fine array
        endif 
        return
'
'
'LCD Initialize
NK_Init:
            Cs = 1
            Nk_res = 0            'reset active low
            pause 20
            Nk_res = 1
            pause 5
            Dato = $21           'Extended commands
            gosub Wr_cmnd
            read Contrast,dato
'            Dato = $c5           'LCD Vop contrast
            gosub Wr_cmnd
            Dato = $06           'Temp coef
            gosub Wr_cmnd
            Dato = $13           'LCD Bias 1:48
            gosub Wr_cmnd
            Dato = $20           'Standard commands
            gosub Wr_cmnd
            Dato = $0C           'Normal Mode
            gosub Wr_cmnd
'Non spostare da qui
'Clear the LCD Data memory
NK_Clear:
            Dato = 0                       'clr ram dati
            TmpW = 0
            repeat                        ' 6 rows x 84 colums
               gosub Wr_dato
               TmpW = TmpW + 1
            until TmpW > 503
            X = 0 : Y = 0                 'predispone posizioni
'            gosub Go2XY
'            return
'Non spostare da qui
'Set the current position for data (0<= x <= 83,  0<= y <= 5)
Go2XY:
         Dato = X | 128              'x or 128
         gosub Wr_cmnd
         Dato =  Y | 64              'y or 64
'         gosub Wr_cmnd
'         return
'Non spostare da qui
'Dato inviato al command register
Wr_cmnd:
         C_D = 0
         goto Tx_spi
'Dato inviato al data register
Wr_dato:
         C_D = 1
         @ nop
Tx_spi:
        Cs = 0                    'enable display
        Nk_ris = 0                'bit counter
        while nk_ris < 8          'invia 8 bit
            Spick = 0             'clock low
            nk_ris = nk_ris + 1
            Mosi = Dato.7         'uscita  Msb first
            Dato = Dato << 1      'prepara prossimo bit uscita
            Spick = 1             'clock up
        wend
        Spick = 0                 'lascia ck low
        Cs = 1                    'disable
        return
'
'       
'la posizione x y deve gia essere settata
'il numero in Char solo da 0 a 9
Wr_Num:
            Char = (Char & 15) * 5   'numeri 0 - 9
            char = Char + FontNum    'index eeprom font table
'l'ind. del font deve essere in char          
'possibili posizioni x char 0,6,12,18,24,30,36,42,48,54,60,66,72,78
Wr_Char:          
            sbr2 = 0                 'ogni carattere largo 5 pixel
            repeat
                  read char,Dato     'legge da eeprom font
'                  gosub Wr_dato     'stack oweflow ???
'???????      3 livelli di stack utilizzati
        C_D = 1
        @ nop
        Cs = 0
        Nk_ris = 0                'bit counter
        while nk_ris < 8             'invia 8 bit
            Spick = 0               'clock low
            nk_ris = nk_ris + 1
            Mosi = Dato.7           'uscita  Msb first
            Dato = Dato << 1        'prepara prossimo bit uscita
            Spick = 1               'clock up
        wend
        Spick = 0                'lascia ck low
        Cs = 1                   'disable                
'??????      
                  sbr2 = sbr2 + 1    'column counter
                  char = char + 1    'index counter
            until sbr2 > 4
            Dato = 0                 'spazio tra caratteri
            goto Wr_dato
'            gosub Wr_dato          
'            return
'
'Invia Sbr1 spazi dalla posizione corrente
Blank_L:
           repeat
            char = space
            gosub wr_char
            sbr1 = sbr1 - 1
           until sbr1 > 128
           return
'
'risoluzione DS18b20 12bit pari a 0,0625 gradi
'calcola valore in chiaro con segno della temperatura       
Temp_convert:
       TmpW = TEMPnow - ofst30           'toglie offset    
       If TmpW.15 = 1 Then               'se negativo    
          TmpW = ~TmpW
          TmpW = TmpW + 1                'complemento a 2
          Segno = 1                      'ricorda segno negativo
       Else
            Segno = 0 
       EndIf   
       Tmp1 = TmpW >> 4                 'estrae parte intera
       Tmp2 = TmpW & 15                 'estrae parte decimale
       TmpW = Tmp2 * 625                'calcola parte decimale
'ritorna in Tmp1 la parte intera ed in TmpW la parte decimale
       return
'
'Evita lettura DS18b20 durante interrupt
Syncro:
      Fl_int = 0
      while fl_int = 0
         @ nop
      wend
      return
'
'Controlla parametri scala temperatura
Chk_PAR:
         Fl_err = 0
         read iniskaL,Tmpw.byte0
         read iniskaH,Tmpw.byte1
         tmpw = tmpw << 4              'inizio scala * 16
         BotSkal = tmpw + ofst30       '+ 30 gradi  (30/0,0625)= 30*16
         read risol,tmp1
         kdiv = tmp1 << 4              'risol. * 16
         topskal = tmp1 << 6           'risol. * 4 * 16 = * 64
         topskal = BotSkal + topskal   'top scala
' lim. sup = 99 + 30gradi =(99*16)+(30*16) = 2064     
         if topskal > MaxSkal  then Fl_err = 1    'set errore
         return        
'
'     
'======================
'
Inizio:
        TRISB = %11000010        'portB configura direzione  0=out 1=in
        TRISA = %10100010        'portA configura direzione
        PortB = %11111110        'preset uscite
        PortA = %11100010      
        CMCON = 7                'per P16F628
        VRCON = 0                'per P16F628
        INTCON = 0               'spento per adesso
        RCSTA = $90              'Enable serial port & continuous receive
        TXSTA = $24              'Enable transmit, BRGH = 1
        SPBRG = 12               '19200 Baud @ 4MHz, 0,16%
'        SPBRG = 25  ' 9600 Baud @ 4MHz, 0,16%  
        OPTION_REG = %10000111
'timer1 prescale = 1,tosc=off,source=internal,tmr1stop
        T1CON = 000000  
        pause 100
        gosub Nk_init             'inizializza & clear display
        LedA = ledof
        LedE = ledof      
' chek for presence  DS18b20
Chk_DS18b:
      Low Dq            'data pin low to init
      Pauseus 500       'Wait > 480us
      Dq_DIR = 1        'Release data pin
      Pauseus 100       'Wait > 60us
      If Dq = 1 Then    'error flash led
         lede = ledon
         pause 500
         lede = ledof
         Pause 2000
         goto Chk_Ds18b    'resta in loop
      Endif
      pause 2
      OWout Dq, 1,[$CC,$4E,$7F,$80,$7F]    'set 12bit resolution
' demo plot
      gosub Plot_assi
      pause 100
      x = 23                     'inizio area grafico
      pix_pre = 20
      repeat
        gosub keep_frame
        y = Tmr0/7
        gosub Join_dot           'unisce punti
        Y = 1
        gosub Go2XY
        gosub col_copy
'        pause 20
        X = X + 1
      until X > 83
'end demo
      OWout Dq,1,[$CC,$44]     'avvia conversione
      pause 2000                 'tempo display  & conversione temperatura
'       
      Tmp1 = RCREG                 'scarica uart receiver
      Tmp1 = RCREG                 'scarica uart receiver
'
Par_chk:
      gosub chk_par                 'controlla se valori coerenti 
      gosub make_skala              'costriusce scala temperature
      gosub Plot_assi               'plotta grafico vuoto
      if Fl_Err = 1 then
         ledE = ledon
         pause 200
         ledE = ledof
         gosub Nk_clear
         pause 1000
         goto par_chk               'resta in loop
      endif 
      Flag_V = 0      
      Clk1 = 0 
      secondi = 0   
      Pixpntr = 0          
      Pixcntr = 0   
      avetempl = 0
      avetemph = 0
      sa_rate = 0
      OWout Dq,1,[$CC,$BE]                'skip rom search
      Owin Dq,2,[TmpW.BYTE0,TmpW.BYTE1]   'read temperature    
      TEMPnow = TmpW + Ofst30             'somma offset 30 gradi     
      PIE1.0 = 1                          'abilita int da Timer1
      INTCON = %11000000                  'abilita int. PEIE
      T1CON.0 = 1                         'start timer1
'    
Acquire_lpp:
      If Fl_sec = 1 Then                    'tic ogni sec  
         Fl_sec = 0
         Dato = $20            'orrizontal  addressing modo testo
         gosub Wr_cmnd
         select case secondi
           case 1                    'display Sample Rate
                x = 24 : y = 0       'posizione testo
                gosub go2xy
                Char = ClesF
                gosub wr_char
'                char = Space
'                gosub wr_char
                read Srate,Tmp1
                sbr1 = 2
                repeat
                  char = tmp1 dig sbr1
                  gosub wr_num
                  sbr1 = sbr1 - 1
                until sbr1 > 128
                sbr1 = 4
                gosub blank_l
           case 5                    'display S.Rate counter (elapsed time)
                x = 24 : y = 0        'posizione testo
                gosub go2xy
                Char = ClesE
                gosub wr_char
'                char = Space
'                gosub wr_char
                sbr1 = 2
                repeat
                  char = sa_rate dig sbr1
                  gosub wr_num
                  sbr1 = sbr1 - 1
                until sbr1 > 128
                sbr1 = 4
                gosub blank_l
           case 9                  'display temperatura reale
                 x = 24 : y = 0        'posizione testo
                 gosub go2xy
                 Char = Termo          'simbolo termometro
                 gosub wr_char
                 gosub temp_convert
                 char = space                    'se positivo blank
                 if segno = 1 then char = sneg   'segno negativo
                 gosub wr_char    
                 char = tmp1 dig 1       'decine temperatura attuale
                 gosub wr_num
                 char = tmp1 dig 0       'unita temperatura attuale
                 gosub wr_num
                 char = comma          
                 gosub wr_char
                 char = tmpw dig 3       'I decimale temperatura attuale
                 gosub wr_num
'                Char = TmpW dig 2           'II decimale temperatura attuale
'                gosub wr_num   
                 char = gradi          
                 gosub wr_char
                 char = Charc          
                 gosub wr_char
'                 sbr1 = 1
'                 gosub blank_l
           case (AcqTIME - 1)             'start conversione  al sec. 14
                 gosub syncro 
'                INTCON.7 = 0                 'disab. int.
                 OWout Dq,1,[$CC,$44]         'avvia nuova conversione
'                INTCON.7 = 1                 'riabilita int            
           case is >= AcqTIME              'read temperature al sec. 15
                 leda = ledon
                 gosub syncro
'                intcon.7 = 0
                 OWout Dq,1,[$CC,$BE]         'skip rom search
                 Owin Dq,2,[TmpW.BYTE0,TmpW.BYTE1]   'read temperature
'                INTCON.7 = 1                'enab. int.  
                 TEMPnow = TmpW + Ofst30     'somma offset 30 gradi                 
                 secondi = 0
                 Sa_rate = Sa_rate + 1      'timer sample rate
                 LedA = LEDOF                 
                 read Srate,Tmp1
                 if Sa_rate > Tmp1 then    'terminato sample rate ?
                    r2 = avetempl      '32bit / 16bit average accumulator/samples
                    r0 = avetemph
                     tempnow = div32 Tmp1   'calcola average
                    Avetemph = 0
                    avetempl = 0            'clear accumulator
                    sa_rate = 0
                    Fl_updt = 1             'nuovo dato per grafico                     
                 else
 ASM               
;_Average                                   ; 32bit + 16bit
                    movf     _TEMPnow,w     ;long add 32bit + 16bit
                    addwf    _AveTEMPL,f    ; AveTEMPL,H + TEMPnow
                    movf     _TEMPnow+1,w
                    btfsc    status,c
                    incfsz   _TEMPnow+1,w
                    addwf    _AveTEMPL+1,f
                    movlw    0
                    btfsc    status,c
                    movlw    1
                    addwf    _AveTEMPH,f
                    movlw    0
                    btfsc    status,c
                    movlw    1
                    addwf    _AveTEMPH+1,f         
 ENDASM       
                 endif 
           end select        
      endif          
'                
      If Fl_updt = 1 Then
          Fl_updt = 0
          gosub Find_dot            'mette un nuovo punto & plot grafico
          x = 23                    'posiz. X inizio grafico
          pixcntr = 0
          gosub keep_frame          'mantiene assi di fondo
          Y = plotpix[pixcntr]      'recupera punto da mettere sul grafico
          pix_pre = y               'lo conserva come precedente
          gosub pix_on            
          y = 1
          gosub Go2XY               'x e y posiziona ad inizio byte
          gosub col_copy            'traccia grafico
          x = x + 1
          pixcntr = 1
          while pixcntr < pixpntr
                gosub Keep_frame    'mantiene assi di fondo
                y = plotpix[pixcntr]
                gosub Join_dot      'unisce punti
                Y = 1
                gosub Go2XY         'posiziona ad inizio area
                gosub col_copy      'traccia grafico
                pixcntr = pixcntr + 1
                x = x + 1           'per tutte le posizioni di X attive
          wend
          gosub make_room        'mantiene i pointer aggiornati & shift display
      endif
'                    
     GoTo aCquire_lpp
'     
'
'%%%%%%%%%%%%%%%%%%%%%%%%%%%%
'
   eeprom 0,["05/08"]      '
'
'Sample rate = Srate * 15s.
'Valori validi da 1 (15S.) a 255 (3825S.)
   eeprom Srate,[001]       '6  96*15S.=1440S.=24min.*60dot=1440min.=24h.
'
'Risoluzione divisioni scala temperatura
'Valori validi da 1 a 20 corrispondono da 1°C a 20°C divisione 
   eeprom Risol,[11]        '7 risoluzione temperatura  (pixel*10)
'
'Inizio scala temperatura N.B. è una Word
'Valori validi da -30 a +(99 - Risol*4)
'se l'equazione non è rispettata viene generato un errore
'Valori negativi inseriti in complemento 2
'ex. -27 = $FFD9 , -11 = $FFEF , -5 = $FFFB
'Valori positivi si usa solo low byte high byte deve essere a 00
   eeprom IniSkaL,[$FB]      '8 inizio scala low byte
   eeprom iniSkaH,[$FF]      '9 inizio scala high byte
'
'Regolazione contrasto display
'valori suggeriti $B5 (chiaro) $DF (scuro) ma variano da display a display 
   eeprom contrast,[$c6]    '10 display contrasto

   eeprom 11,["nGn"]    '
'font numeri @41
  eeprom FontNUM,[$3E,$51,$49,$45,$3E]         '16  0
  eeprom [$00,$42,$7F,$40,$00]               '21  1
  eeprom [$42,$61,$51,$49,$46]               '26  2
  eeprom [$21,$41,$45,$4B,$31]               '31  3
  eeprom [$18,$14,$12,$7F,$10]               '36  4
  eeprom [$27,$45,$45,$45,$39]              '42  5
  eeprom [$3C,$4A,$49,$49,$30]              '46  6
  eeprom [$01,$71,$09,$05,$03]              '51  7
  eeprom [$36,$49,$49,$49,$36]              '56  8
  eeprom [$06,$49,$49,$49,$3E]              '61  9
'
  eeprom space,[$00,$00,$00,$00,$00]         '66  space      
  eeprom Gradi,[$00,$02,$05,$05,$02]         '71  °
  eeprom comma,[$00,$50,$30,$00,$00]         '76  ,
  eeprom sneg,[$08,$08,$08,$08,$08]            '81  -
  eeprom dot,[$00,$60,$60,$00,$00]            '86  .
  eeprom CharC,[$3E,$41,$41,$41,$22]         '91  C
  eeprom ClesF,[$63,$57,$4F,$57,$63]         '96  simbolo clessidra piena
  eeprom ClesE,[$63,$75,$79,$75,$63]         '101 simbolo clessidra vuota
  eeprom Termo,[$30,$7E,$79,$7E,$30]          '111 simbolo termometro
'                                          '106
'                                          '116
'                                          '121
'                                          '126

: : :end: : :

HEX code given below :

(direct load these into compatible PIC controller)

: : :start: : :

:02000000ED28E9
:10000800EE28083033190130A300A2013608840015
:10001800340847203408800484130005FF3E331D4C
:10002800A20C3319A20D32305F20A30B0C28220832
:100038000314E828A200083033190130A300A20CE9
:1000480036088400340847203408031880043C30FC
:100058005F2034088004A30B23280314E828B31C6A
:10006800E8283928B300331CE82836088400340807
:1000780047200130A100F4306020340880040130AA
:10008800A100F4306028FF3A80054A2884178005CB
:10009800E82883169B001C141A08E828A301A2006C
:1000A800FF30A207031CA307031CE8280330A100A4
:1000B800DF3060205428A101E83EA000A109FC30EF
:1000C800031C6928A00703186628A0076400A10F6D
:1000D800662820186F28A01C7328000073280800C1
:1000E800013EA7000A30A200A301B620A70B792879
:1000F800240808000310A00DA10DFF3E03187E2858
:100108002008E8280310A10CA00CFF3E031886283D
:100118002008E828A20001309728A2000630972876
:10012800A20004309728A80023082102031D9E2856
:100138002208200204300318013003190230280570
:10014800031DFF30E828A301A2002008A600240808
:10015800A0002608A4002108A6002508A10026085A
:10016800A500B828A501A4011030A600210DA40DF2
:10017800A50D2208A4022308031C230FA5020318B7
:10018800CC282208A40723080318230FA507031067
:10019800A00DA10DA60BBA282008E8281030A80049
:1001A800A101A001A70CA60C031CE0282208A007A7
:1001B80023080318230FA107A10CA00CA50CA40C5D
:1001C800A80BD6282408E828831303138312640095
:1001D80008005A2BFD00030E8301FE000A08FF00E9
:1001E8000C1C0629101086308F0000308E00101469
:1001F8000C104C14CA0A21304A02031C0629D40ADE
:10020800CA014C157F088A007E0E8300FD0E7D0E04
:1002180009002030CB009A228022D9010530DA006B
:10022800932208304D20C50009304D20C600073004
:100238004D20D600D7016400C61F30295130C900AF
:100248004509C1004609C20001304107C300420800
:100258000318013EC40036294230C9004508C300CE
:100268004608C400C1224308A000A101013074203F
:10027800C900B2224308A000A10100307420C900BF
:10028800B222D70AD901DA0393225608C507031800
:10029800C60A640005305702031C1F2908000130F4
:1002A800DA002230CB009A220130B8000230B900BF
:1002B8000830BA002030BB008030BC001430D900B0
:1002C8009322A3211530D9009322A321FF30B8002F
:1002D800FF30B900FF30BA00FF30BB00FF30BC0070
:1002E8001630D9009322A3211730D9009621033064
:1002F8005905D50064005508023C031D8D290130BD
:10030800B8000230B9000830BA002030BB00803095
:10031800BC009322A321D90A640054305902031C5B
:100328007A290800D2015208383E84000030800043
:10033800D20A640005305202031C972908002230B3
:10034800CB009A22D3015308383E84000008CB0022
:100358009C22D30A640005305302031CA729080015
:10036800962103305905D20064005208023C031D4F
:10037800C7290130B8000230B9000830BA0020306F
:10038800BB008030BC0008005A08D80064005A0836
:100398004E020319E82964005A084E020318DE29A0
:1003A800CE0A4E08DA00E82164005A085802031DF4
:1003B800D429E729CE034E08DA00E82164005A0858
:1003C8005802031DDE2908005A08273CD5005508A5
:1003D800A000A1010830A200A301B6202408D6007D
:1003E8005508A000A10103308920D5000130D700AD
:1003F8005708A000A10156088120D7005508383EAB
:1004080084000008D6005708D6045508383E8400F2
:100418005608800008002730D5004308A00044088B
:10042800A1004808A30047088E20031D432AD501D0
:100438004308A0004408A1003E08A3003D089420FA
:10044800031D432A3D084302C1003E08031C013E28
:100458004402C2004108A6004208A7000A30A200D0
:10046800A301D220C5002508C6004508A0004608FB
:10047800A1003F08A2004008A300B620D5005008FC
:10048800A03E840055088000D00A080064003C3073
:100498005002031C652A0130D200D3015208A03E45
:1004A80084000008D5005308A03E84005508800049
:1004B800D20AD30A64003C305202031C522A3B3051
:1004C800D000080086150512143052200516053094
:1004D80052202130CB009A220A304D20CB009A229C
:1004E8000630CB009A221330CB009A222030CB0062
:1004F8009A220C30CB009A22CB01C501C6019C225E
:10050800C50A0319C60A4508A0004608A10001301B
:10051800A300F7309120031D832AD901DA01803026
:100528005904CB009A2240305A04CB0006109E2A68
:10053800061400008611CD01640008304D0203182E
:10054800AF2A0511CD0ACB1B8515CB1F85110310CA
:10055800CB0D0515A02A0511861508000F30490591
:10056800C100C2014108A6004208A7000530A20048
:10057800A301D220C9001030C907D30149084D2072
:10058800CB00061400008611CD01640008304D022E
:100598000318D82A0511CD0ACB1B8515CB1F851149
:1005A8000310CB0D0515C92A05118615D30AC90AEA
:1005B800640005305302031CC22ACB019C2A423036
:1005C800C900C122D203640081305202031CE32A0D
:1005D8000800E0304302C5000130031C013E44021C
:1005E800C6006400C61FFF2AC509C609C50A031943
:1005F800C60ACC15002BCC114508A0004608A1005E
:1006080004308920D5000F304505D6005608A600CD
:10061800A7017130A2000230A300D220C50025082E
:10062800C60008004C1064004C181C2B0000172B47
:1006380008004C1208304D20C50009304D20C60076
:100648004508A0004608A10004308120C500210803
:10065800C600E0304507BD0001300318013E4607DB
:10066800BE0007304D20D5005508A000A101043078
:100678008120BF002108C0005508A000A101063054
:100688008120C7002108C8003D08C7073E08031895
:10069800013EC8074708A0004808A1000830A30089
:1006A80010309120031D592B4C1608008316C230B8
:1006B8008600A23085008312FE308600E230850075
:1006C80007309F0083169F0183128B01903098009A
:1006D8008316243098000C309900873081008312EB
:1006E8009001643052206622061286128510831605
:1006F800851083120130A100F43060208316851420
:10070800643083125F206400851C952B86160130A7
:10071800A300F430532086120730A300D0305320B2
:100728007A2B023052200530B6000230B400013076
:100738003620CC301E204E301E207F301E208030C8
:100748001E207F301E203320532164305220173062
:10075800D9001430CE00B4210108A000A10107304F
:10076800A200A301B620DA00C8210130DA009322E2
:10077800A321D90A640054305902031CAF2B053059
:10078800B6000230B40001303620CC301E20443090
:100798001E2033200730A300D03053201A08D5007C
:1007A8001A08D5001D230D21532164004C1EE62B89
:1007B8008616C8305220861280220330A300E83003
:1007C8005320D62BCC01CA01D401D001CF01F901A5
:1007D800FA01FB01FC01D1010530B6000230B4007A
:1007E80001303620CC301E20BE301E20332005308C
:1007F800B6000230B400023036200520C5000520BE
:10080800C6003320E0304507C30001300318013E1D
:100818004607C40083160C148312C0308B001014D2
:1008280064004C1DF52C4C112030CB009A2264003A
:100838005408013C031D3D2C1830D900DA019322DD
:100848006030C900C12206304D20D5000230D200E8
:100858005508A000A10152087420C900B222D20391
:10086800640081305202031C2C2C0430D200E32295
:10087800F52C64005408053C031D5C2C1830D90085
:10088800DA0193226530C900C1220230D200510832
:10089800A000A10152087420C900B222D20364004A
:1008A80081305202031C4B2C0430D200E322F52C79
:1008B80064005408093C031D912C1830D900DA0152
:1008C80093226A30C900C122ED224230C900640077
:1008D800CC1D702C5130C900C1225508A000A101BF
:1008E80001307420C900B2225508A000A1010030CF
:1008F8007420C900B2224C30C900C1224508A000AA
:100908004608A10003307420C900B2224730C9004C
:10091800C1225B30C900C122F52C640054080E3C8A
:10092800031DA32C16230530B6000230B400013095
:100938003620CC301E2044301E203320F52C640095
:100948000F305402031CF52C061616230530B6008A
:100958000230B40001303620CC301E20BE301E20BC
:1009680033200530B6000230B400023036200520AE
:10097800C5000520C6003320E0304507C30001301C
:100988000318013E4607C400D401D10A06120630F6
:100998004D20D5006400510855020318E72C79084A
:1009A800A4007A08A5007B08A0007C08A1005508CF
:1009B800A720C3002108C400FB01FC01F901FA01CA
:1009C800D101CC14F52C4308F90744080318440F47
:1009D800FA07003003180130FB0700300318013014
:1009E800FC076400CC1C212DCC100F221730D90035
:1009F800CF01B4214F08A03E84000008DA005A084D
:100A0800CE00E8210130DA009322A321D90A01306F
:100A1800CF00640050084F020318202DB4214F085E
:100A2800A03E84000008DA00C8210130DA009322D1
:0C0A3800A321CF0AD90A0D2D4A22142C4C
:02400E00143F5D
:0A420000300035002F0030003800B8
:10420C0001000B00FB00FF00C6006E0047006E00B3
:104220003E005100490045003E00000042007F0072
:10423000400000004200610051004900460021009A
:10424000410045004B0031001800140012007F00AF
:104250001000270045004500450039003C004A0099
:104260004900490030000100710009000500030009
:10427000360049004900490036000600490049005F
:1042800049003E00000000000000000000000000A7
:104290000200050005000200000050003000000090
:1042A0000000080008000800080008000000600086
:1042B0006000000000003E0041004100410022007B
:1042C000630057004F0057006300630075007900DA
:0E42D0007500630030007E0079007E00300033
:00000001FF


: : :end: : :

enjoy it

post by Pratik Gohel...:))

No comments:

Post a Comment