Need more space, please...


Closed Thread
Results 1 to 27 of 27
  1. #1
    Join Date
    Dec 2008
    Location
    Ploiesti, ROMANIA
    Posts
    579

    Default Need more space, please...

    I wrote the code for thermometer with two sensors DS18B20 and Nokia 3310 display. Works fine, but...only in 16F648A. I want to use with 16F628A (easier to buy in my location). It' s possible to "minimize" the code ? I think maybe can make something with 'BorderLine:" ...
    Thanks in advance !
    Code:
    ;**********************************************************************************************
    ;              Termo with BIG fonts
    ;                  2 x DS18B20
    ;                Thanks to Gusse !
    ;                    may 2011
    ;
    ;                ATTENTION ON SCHEMATIC !!!
    ;
    ;**********************************************************************************************
    ;                                                              
    ;                        .oooO                                 
    ;                        (   )   Oooo.                         
    ;                         \ (    (   )
    ;                          \_)    ) /
    ;                                (_/
    ;
    
    @ DEVICE pic16F648A, INTRC_OSC, WDT_OFF, PWRT_OFF, BOD_OFF, MCLR_ON, LVP_OFF, CPD_OFF, PROTECT_OFF 
    INCLUDE "modedefs.bas" 
    Define  NO_CLRWDT 1
    DEFINE  OSC 4                            
    
            TRISB = %00011100                    'portB configuration  0=out 1=in
            TRISA = %10100000                    'portA configuration
            PortA = %11100000        
            CMCON = 7                        
            VRCON = 0                        
            INTCON = 0              
    
    OPTION_REG=%00000111                       'weak pullups on, TMRO prescale = 256
                                                    
    Lcd_DC      var PortB.0 
    Lcd_SDA     var PortA.3
    Lcd_RST     var PortA.4
    Lcd_CLK     var PortA.2
    DQ          var PortB.2   
    DQ2        VAR PORTB.3
    buton       var portb.4
    
    Ts          VAR BIT         ' TYPE Of SPACE, variable / constante
    Tc          VAR byte        ' TYPE Of Charater, normal / big
    Ic          var bit         ' Inverted Char
    i           var Byte
    j           var Word
    k           var Byte
    Tv          var byte        ' Tipo de Variavel que se vai receber
    Nc          var byte        ' Numero de Carateres recebidos no Serin
    PosX        var Byte
    PosY        var Byte
    Letra       var Byte [9]
    LetraA      var byte
    LetraB      var byte 
    LcdStr      var Byte [28]
    Lcd_Data    var Byte
    
    
    
    
    
    Temperature     Var     Word bank0        : Temperature2    Var     Word bank0
    TempC           Var     Word bank0        : TempC2          Var     Word bank0
    Sign            Var     Word bank0        : Sign2           Var     Word bank0
    Float           Var     Word bank0        : Float2          Var     Word bank0
    V            Var     Word bank0        : V2              Var     Word bank0           
    Dummy           Var     Byte bank0        : Dummy2          Var     Byte bank0
    
                Flag            var  Byte          
                SignBit         var  Flag.0              
                LcdReg          var  Byte bank0       
                x               var  Byte bank0
                y               var  Byte bank0       
                Busy            VAR  BIT  bank0
              Cursor        var  Byte bank0
    
    DS18B20_12bit    CON %01111111       ' 750ms,   0.0625°C 
    DS18B20_12bit2   CON %01111111       ' 750ms,   0.0625°C 
    
    '==================================================
      Low Lcd_RST
      pause 100
      High Lcd_RST
    
      Low Lcd_DC                                                     
      Lcd_Data= %00100001: Gosub Lcd_SentByte        'LCD EXTENDED COMMANDS
      Lcd_Data= $E4      : Gosub Lcd_SentByte        'SET LCD Vop (CONTRAST)
      Lcd_Data= %00000100: Gosub Lcd_SentByte        'SET TEMP COEFFICENT
      Lcd_Data= %00010000: Gosub Lcd_SentByte        'LCD BIAS MODE 1:48
      Lcd_Data= %00100000: Gosub Lcd_SentByte        'LCD STANDARD COMMANDS
      Lcd_Data= %00001100: Gosub Lcd_SentByte        'LCD IN NORMAL MODE
      
      Ts = 0                                        'Space constante
      Ic = 0                                        'Blinking OFF
    
      Gosub Lcd_Clear
    'set contrast
      Low Lcd_DC
      Lcd_Data= %00100001: Gosub Lcd_SentByte        'LCD EXTENDED COMMANDS
      Lcd_Data= %10100100: Gosub Lcd_SentByte          'Set Vop Register
      Lcd_Data= %00100000: Gosub Lcd_SentByte        'LCD STANDARD COMMANDS  
    
    '==================================================
    ' Init Sensor 1
     OWOUT DQ, 1, [$CC, $4E, 0, 0, DS18B20_12bit]
     OWOut DQ, 1, [$CC, $48]                   ' Start temperature conversion
     OWOut DQ, 1, [$CC, $B8] 
     OWOut DQ, 1, [$CC, $BE] 
     Pause 50
     OWIn DQ, 2, [temperature.byte0, temperature.byte1]
    
    ' Init Sensor 2
     OWOUT DQ2, 1, [$CC, $4E, 0, 0, DS18B20_12bit2]
     OWOut DQ2, 1, [$CC, $48]                   ' Start temperature conversion
     OWOut DQ2, 1, [$CC, $B8] 
     OWOut DQ2, 1, [$CC, $BE] 
     Pause 50
     OWIn DQ2, 2, [temperature2.byte0, temperature2.byte1]
    
     Pause 100
    
    '==================================================
    main:
    Call BorderLine
    pause 100
    
    Part1:
    ' Start temp.conv.Sensor1
     OWOut DQ, 1, [$CC, $44] 
     OWOut DQ, 1, [$CC, $BE]
     OWIn DQ, 2, [temperature.byte0, temperature.byte1]  
    
    If Temperature.15 then       
      Temperature= ~Temperature +1
      Sign  = 1
    Endif
     
    Dummy = 625 * Temperature
    TempC = DIV32 10 
    TempC = (Temperature & $7FF) >> 4
    Float = ((Temperature.Lowbyte & $0F ) * 25 )>>2
    Temperature = TempC*100 + Float
    
    If Sign=1 then
      V= 10000 - Temperature            
    else
      V= 10000 + Temperature
    EndIf
    
    If V >= 10000 then                  
      Temperature=V-10000
      sign = " "                   
    else                                   
      Temperature=10000-V                 
      sign = "-"
    EndIf
    
    Part2 :    
    ' Start temp.conv.Sensor1
     OWOut DQ2, 1, [$CC, $44] 
     OWOut DQ2, 1, [$CC, $BE]
     OWIn DQ2, 2, [temperature2.byte0, temperature2.byte1]  
        
    If Temperature2.15 then       
      Temperature2= ~Temperature2 +1
      Sign2  = 1
    Endif
     
    Dummy2 = 625 * Temperature2
    TempC2 = DIV32 10 
    TempC2 = (Temperature2 & $7FF) >> 4
    Float2 = ((Temperature2.Lowbyte & $0F ) * 25 )>>2
    Temperature2 = TempC2*100 + Float2
    
    If Sign2=1 then
      V2= 10000 - Temperature2           
    else
      V2= 10000 + Temperature2
    EndIf
    
    If V2 >= 10000 then                
      Temperature2=V2-10000
      sign2 = " "                   
    else                                   
      Temperature2=10000-V2                 
      sign2 = "-"
    EndIf
    
    if buton = 0 then 
    gosub buton_on
    else
    gosub buton_off
    endif
    
    goto main
    
    '==================================================
    buton_on:
    LcdStr(5) = 59                            ' simbol for degree
    LcdStr(4) = 48 + Temperature dig 1
    LcdStr(3) = "."
    LcdStr(2) = 48 + Temperature dig 2
    if Temperature dig 3=0 then
    LcdStr(1) = 32
    else
    LcdStr(1) = 48 + Temperature dig 3
    endif
    LcdStr(0) = Sign 
    
    Tc=0
    Nc=6
    PosX=3
    PosY=2 
    Gosub Lcd_GotoXY : Gosub Lcd_SentString
    
    LcdStr(5) = 59                            ' simbol for degree
    LcdStr(4) = 48 + Temperature2 dig 1
    LcdStr(3) = "."
    LcdStr(2) = 48 + Temperature2 dig 2
    if Temperature2 dig 3=0 then
    LcdStr(1) = 32
    else
    LcdStr(1) = 48 + Temperature2 dig 3
    endif
    LcdStr(0) = Sign2 
    
    Tc=2
    Nc=6
    PosX=11
    PosY=3 
    Gosub Lcd_GotoXY : Gosub Lcd_SentString
    
    Tc=3
    Nc=6
    PosX=11
    PosY=4
    Gosub Lcd_GotoXY : Gosub Lcd_SentString
    return
    '==================================================
    buton_off:
    LcdStr(5) = 59                            ' simbol for degree
    LcdStr(4) = 48 + Temperature2 dig 1
    LcdStr(3) = "."
    LcdStr(2) = 48 + Temperature2 dig 2
    if Temperature2 dig 3=0 then
    LcdStr(1) = 32
    else
    LcdStr(1) = 48 + Temperature2 dig 3
    endif
    LcdStr(0) = Sign2 
    
    Tc=0
    Nc=6
    PosX=3
    PosY=2 
    Gosub Lcd_GotoXY : Gosub Lcd_SentString
    
    LcdStr(5) = 59                            ' simbol for degree
    LcdStr(4) = 48 + Temperature dig 1
    LcdStr(3) = "."
    LcdStr(2) = 48 + Temperature dig 2
    if Temperature dig 3=0 then
    LcdStr(1) = 32
    else
    LcdStr(1) = 48 + Temperature dig 3
    endif
    LcdStr(0) = Sign 
    
    Tc=2
    Nc=6
    PosX=11
    PosY=3 
    Gosub Lcd_GotoXY : Gosub Lcd_SentString
    
    Tc=3
    Nc=6
    PosX=11
    PosY=4
    Gosub Lcd_GotoXY : Gosub Lcd_SentString
    return
    '================================================== 
    Lcd_Clear:
    For cursor = 0 to 5
        PosX=0:PosY=Cursor:Gosub Lcd_GotoXY
        High Lcd_DC
    
        For i= 1 to 84
              Lcd_Data=0:Gosub Lcd_SentByte
              Lcd_Data=0:Gosub Lcd_SentByte
        Next i
    Next cursor
    Return
    
    '==================================================
    Lcd_GotoXY:
    Low Lcd_DC
    Lcd_Data=%01000000 | PosY :Gosub Lcd_SentByte    'Y
    Lcd_Data=%10000000 | PosX :Gosub Lcd_SentByte    'X
    Return
    '==================================================
    Lcd_SentByte:
    SHiftOUT Lcd_SDA , Lcd_CLK , MSBFIRST, [ Lcd_Data ]
    Return
    '==================================================
    Lcd_SentString:
    For k=0 to Nc-1      
        Lcd_Data=LcdStr(k)
        Gosub Lcd_SentChar
    next k
    Return
    '==================================================
    Lcd_SentChar:
    Letra(0)=$00:Letra(1)=$00:Letra(2)=$00:Letra(3)=$00:Letra(4)=$00:Letra(5)=$00
    
    SELECT CASE lcd_data
    
    ' CAPITAL LETTERS
    CASE 32
    Tv=1                                                                        '
    CASE 42
    Tv=5:Letra(0)=$14: Letra(1)=$08:Letra(2)=$3E:Letra(3)=$08: Letra(4)=$14        '*
    CASE 43
    ;Tv=5:Letra(0)=$10: Letra(1)=$10:Letra(2)=$7C:Letra(3)=$10: Letra(4)=$10        '+
    Tv=5:Letra(0)=$08: Letra(1)=$08:Letra(2)=$3E:Letra(3)=$08: Letra(4)=$08        '+
    CASE 45
    Tv=5:Letra(0)=$08: Letra(1)=$08:Letra(2)=$08:Letra(3)=$08: Letra(4)=$08        '-
    CASE 46
    ;Tv=3:Letra(1)=$C0: Letra(2)=$C0                                               '.
    Tv=1:Letra(1)=$60 : Letra(2)=$60                                              '.
    case 47
    Tv=4:Letra(0)=96 : Letra(1)=48 :Letra(2)=24    :Letra(3)=12 : Letra(4)=06  '/
    CASE 48
    ;Tv=5:Letra(0)=$7E: Letra(1)=$A1:Letra(2)=$91:Letra(3)=$89: Letra(4)=$7E        '0
    Tv=5:Letra(0)=$3E: Letra(1)=$51:Letra(2)=$49:Letra(3)=$45: Letra(4)=$3E        '0
    CASE 49                                  
    ;Tv=4:Letra(1)=$82: Letra(2)=$FF:Letra(3)=$80                                        '1
    Tv=4:Letra(1)=$42: Letra(2)=$7F:Letra(3)=$40                                '1
    CASE 50
    ;Tv=5:Letra(0)=$86: Letra(1)=$C1:Letra(2)=$A1:Letra(3)=$91: Letra(4)=$8E        '2
    Tv=5:Letra(0)=$42: Letra(1)=$61:Letra(2)=$51:Letra(3)=$49: Letra(4)=$46        '2
    CASE 51
    ;Tv=5:Letra(0)=$62: Letra(1)=$81:Letra(2)=$89:Letra(3)=$89: Letra(4)=$76        '3
    Tv=5:Letra(0)=$21: Letra(1)=$41:Letra(2)=$45:Letra(3)=$4B: Letra(4)=$31        '3
    CASE 52
    ;Tv=5:Letra(0)=$38: Letra(1)=$24:Letra(2)=$22:Letra(3)=$FF: Letra(4)=$20        '4
    Tv=5:Letra(0)=$18: Letra(1)=$14:Letra(2)=$12:Letra(3)=$7F: Letra(4)=$10        '4
    CASE 53
    ;Tv=5:Letra(0)=$4F: Letra(1)=$89:Letra(2)=$89:Letra(3)=$89: Letra(4)=$71        '5
    Tv=5:Letra(0)=$27: Letra(1)=$45:Letra(2)=$45:Letra(3)=$45: Letra(4)=$39        '5
    CASE 54
    ;Tv=5:Letra(0)=$7E: Letra(1)=$89:Letra(2)=$89:Letra(3)=$89: Letra(4)=$72              '6
    Tv=5:Letra(0)=$3C: Letra(1)=$4A:Letra(2)=$49:Letra(3)=$49: Letra(4)=$30     '6
    CASE 55                                                                
    ;Tv=5:Letra(0)=$01: Letra(1)=$E1:Letra(2)=$11:Letra(3)=$09: Letra(4)=$07        '7
    Tv=5:Letra(0)=$01: Letra(1)=$71:Letra(2)=$09:Letra(3)=$05: Letra(4)=$03        '7
    CASE 56
    ;Tv=5:Letra(0)=$76: Letra(1)=$89:Letra(2)=$89:Letra(3)=$89: Letra(4)=$76        '8
    Tv=5:Letra(0)=$36: Letra(1)=$49:Letra(2)=$49:Letra(3)=$49: Letra(4)=$36        '8
    CASE 57
    ;Tv=5:Letra(0)=$46: Letra(1)=$89:Letra(2)=$89:Letra(3)=$89: Letra(4)=$7E        '9
    Tv=5:Letra(0)=$06: Letra(1)=$49:Letra(2)=$49:Letra(3)=$29: Letra(4)=$1E        '9
    CASE 58
    Tv=3:Letra(1)=$36: Letra(2)=$36                                             ':
    CASE 59
    Tv=5:Letra(0)=$02: Letra(1)=$05: Letra(2)=$32: Letra(3)=$48: Letra(4)=$48   'simbol grade
    
    
    end select
    
    High Lcd_DC
    
    If Tc = 0 Then              ' Normal Charater
    '==================================================
    
        iF Ts = 0 tHEN     
            j = 5               ' CONSTANTE SPACE (6)
        Else
            j = Tv              ' VARIABLE SPACE
        endif
          
            for I=0 to j
                If Ic=0 Then    ' Normal Charater
                
                ShiftOUT Lcd_SDA , Lcd_CLK , 1 , [ Letra(I)]
                        
                else            ' Inverted Charater
                
                ShiftOUT Lcd_SDA , Lcd_CLK , 1 , [ (127-Letra(I))+128 ]       
                        
                endif                 
            next I
    
         Return
         
    Endif                   ' Double Charater
    '==================================================
    
    ' Tc = 1   Nothing to change       2 x 1
    
    If Tc = 2  Then         ' 1ª time of 2x2
    
       for i = 0 to 5
            LetraA = Letra(i)
    
            LetraB.0 = LetraA.0
            LetraB.1 = LetraA.0
            LetraB.2 = LetraA.1
            LetraB.3 = LetraA.1
            LetraB.4 = LetraA.2
            LetraB.5 = LetraA.2
            LetraB.6 = LetraA.3
            LetraB.7 = LetraA.3
    
            Letra(i) = LetraB                
            
        next i
        
    ENdif
    
    If TC = 3 then      ' 2ª time of 2x2
      
        for i = 0 to 5
            LetraA = Letra(i)
    
            LetraB.0 = LetraA.4
            LetraB.1 = LetraA.4
            LetraB.2 = LetraA.5
            LetraB.3 = LetraA.5
            LetraB.4 = LetraA.6
            LetraB.5 = LetraA.6
            LetraB.6 = LetraA.7
            LetraB.7 = LetraA.7
    
            Letra(i) = LetraB                
            
        next i
        
    endif
        
    
    
    
        iF Ts = 0 tHEN     
            j = 5               ' CONSTANTE SPACE
        Else
            j = Tv              ' VARIABLE SPACE
        endif
          
            for I=0 to j
                If Ic=0 Then    ' Normal Charater
                
    ShiftOUT Lcd_SDA , Lcd_CLK , 1 , [ Letra(I), Letra(i) ]
                        
                else            ' Inverted Charater
                
    ShiftOUT Lcd_SDA , Lcd_CLK , 1 , [ (127-Letra(I))+128, (127-Letra(I))+128 ]       
                        
                endif                 
            next I
          
        
    
    
    Return
    
     
    BorderLine:                         ' 
    '=================================== RAND 0
                    LcdReg  =  %10000000            ' cursor  X  
                   call    PrintCtrlLcd
                    LcdReg  =  %01000000            ' cursor  Y
                   call    PrintCtrlLcd
                     for y = 0 to 83                   
                      LOokup y, [$FF,$01,$01,$01,$01,_
                                 $01,$01,$01,$01,$01,$01,$01,$01,$01,$FD,$FD,$FD,$85,$85,$FD,$FD,$79,_        'D
                                 $01,$01,$FD,$FD,$FD,$01,$01,$79,$FD,$FD,$85,$A5,$ED,$ED,$69,$01,$01,_        'IG
                                 $FD,$FD,$FD,$01,$05,$05,$05,$FD,$FD,$FD,$05,$05,$05,$01,_                    'IT
                                 $F9,$FD,$FD,$25,$25,$FD,$FD,$F9,$01,$01,$FD,$FD,$FD,$81,$81,$81,$81,_        'AL
                                 $01,$01,$01,$01,$01,$01,$01,$01,$01,$01,$01,$01,$01,$FF] ,LcdReg       
        
                       call    PrintDataLcd
                        next y
    '===================================  RAND 1                                
                   LcdReg  =  %10000000                ' cursor  X  
                   call    PrintCtrlLcd
                    LcdReg  =  %01000001                ' cursor  Y
                   call    PrintCtrlLcd 
                   LOokup 0, [$FF] , LcdReg 
                   call    PrintDataLcd     
                   
                    LcdReg  =  %10000000 + 83                ' cursor  X  
                   call    PrintCtrlLcd
                    LcdReg  =  %01000001                ' cursor  Y
                   call    PrintCtrlLcd 
                   LOokup 0, [$FF] , LcdReg 
                   call    PrintDataLcd  
    '===================================  RAND 2
                    LcdReg  =  %10000000                ' cursor  X  
                   call    PrintCtrlLcd
                    LcdReg  =  %01000010                ' cursor  Y
                   call    PrintCtrlLcd    
                   LOokup 0, [$FF] , LcdReg 
                   call    PrintDataLcd
                                   
                    LcdReg  =  %10000000 + 83               ' cursor  X  
                   call    PrintCtrlLcd
                    LcdReg  =  %01000010                ' cursor  Y
                   call    PrintCtrlLcd
                   LOokup 0, [$FF] , LcdReg 
                   call    PrintDataLcd
    
    '===================================  RAND 3
                    LcdReg  =  %10000000                ' cursor  X  
                   call    PrintCtrlLcd
                    LcdReg  =  %01000011                ' cursor  Y
                   call    PrintCtrlLcd
                   LOokup 0, [$FF] , LcdReg 
                   call    PrintDataLcd
                   
                   LcdReg  =  %10000000 + 83                ' cursor  X  
                   call    PrintCtrlLcd
                    LcdReg  =  %01000011                ' cursor  Y
                   call    PrintCtrlLcd
                   LOokup 0, [$FF] , LcdReg 
                   call    PrintDataLcd   
    '===================================  RAND 4                
                   LcdReg  =  %10000000                ' cursor  X  
                   call    PrintCtrlLcd
                    LcdReg  =  %01000100                ' cursor  Y
                   call    PrintCtrlLcd 
                   LOokup 0, [$FF] , LcdReg 
                   call    PrintDataLcd     
                   
                    LcdReg  =  %10000000 + 83                ' cursor  X  
                   call    PrintCtrlLcd
                    LcdReg  =  %01000100                ' cursor  Y
                   call    PrintCtrlLcd 
                   LOokup 0, [$FF] , LcdReg 
                   call    PrintDataLcd    
    '===================================  JOS                
                LcdReg  =  %10000000            ' cursor  X  
                    call    PrintCtrlLcd
                    LcdReg  =  %01000101            ' cursor  Y
                    call    PrintCtrlLcd
                    for y = 0 to 83                   
        LOokup y, [$FF,$80,$80,$80,$80,$80,$80,$80,$80,$80,$80,$80,$80,$80,$80,_             
                 $80,$80,$80,$80,$81,$81,$81,$BF,$BF,$BF,$81,$81,$81,$80,$BF,$BF,$BF,$A9,_          
                 $A9,$A9,$A1,$80,$BF,$BF,$BF,$89,$89,$99,$A6,$80,$BF,$BF,$BF,$82,_          
                 $84,$82,$BF,$BF,$BF,$80,$9E,$BF,$BF,$A1,$A1,$BF,$BF,$9E,$80,_          
                 $80,$80,$80,$80,$80,$80,$80,$80,$80,$80,$80,$80,$80,$80,$80,_          
               $80,$80,$80,$80,$FF] ,LcdReg
                    call    PrintDataLcd
                    next y 
    return
    
    '==================================================
    
    
    PrintCtrlLcd:   LCD_DC = 0                             
    
    PrintDataLcd:   for x = 1 to 8                
                        LCD_SDA = LcdReg.7              
                        LCD_CLK = 1
                        LcdReg = LcdReg << 1
                        LCD_CLK = 0
                    next x               
                    LCD_DC = 1
                    return     
    END           ' of program

  2. #2
    Join Date
    Jan 2005
    Location
    Montreal, Quebec, Canada
    Posts
    2,597


    Did you find this post helpful? Yes | No

    Default Re: Need more space, please...

    Have you considered using two 16F628A?

    Use 1 as master to control sensor, use the other as slave to control the LCD, communicate between the 2 using USART?

    That would split the burden.
    My Creality Ender 3 S1 Plus is a giant paperweight that can't even be used as a boat anchor, cause I'd be fined for polluting our waterways with electronic devices.

    Not as dumb as yesterday, but stupider than tomorrow!

  3. #3
    Join Date
    Dec 2008
    Location
    Ploiesti, ROMANIA
    Posts
    579


    Did you find this post helpful? Yes | No

    Default

    Thanks...but... NO WAY ! I try to make it "low cost" ...

  4. #4
    Join Date
    Nov 2005
    Location
    Bombay, India
    Posts
    947


    Did you find this post helpful? Yes | No

    Default Re: Need more space, please...

    You might be able to save a little space if you can SUB the digit conversion routines that are repeated in some places. It may gain you some words of space, but, beyond that, you may need to forego the borderline routine altogether(just a guess) or convert it into a code based border function rather than table driven.

  5. #5
    Join Date
    Feb 2006
    Location
    Gilroy, CA
    Posts
    1,530


    Did you find this post helpful? Yes | No

    Default Re: Need more space, please...

    Quote Originally Posted by fratello View Post
    Works fine, but...only in 16F648A. I want to use with 16F628A (easier to buy in my location).
    Hi Fratello,

    You are not the first person to mention this about this chip or that chip. I am just curious about the hardships of getting a part as old as the PIC16F648A in quantity? I can see it being a hardship if you can't get it at the local vendor, and don't want to order abroad for low numbers. But is it really that hard (or expensive) to get them by 25 or more? It sounds like your project is going to be marketed.

    Maybe I am just spoiled by being able to get things from any country, pretty easily.

    Again, just curious. Not doubting you, just wondering "easier to get" means.

  6. #6
    Join Date
    Dec 2008
    Location
    Ploiesti, ROMANIA
    Posts
    579


    Did you find this post helpful? Yes | No

    Default

    I live in one small city from Romania ! Even one resistor must be purchased by e-commerce . at e-vendors the 16F648A have double price from 16F628A. And one great vendor (TME.EU) don't sell to persons, just company , from april, this year...
    So, I try to make the best I can with limited resources. Thanks again for support !

  7. #7


    Did you find this post helpful? Yes | No

    Default Re: Need more space, please...

    I think you can save a little space by not including "modedefs.bas"

    You will need to change this line.

    SHiftOUT Lcd_SDA , Lcd_CLK , MSBFIRST, [ Lcd_Data ]

    To:

    SHiftOUT Lcd_SDA , Lcd_CLK , 1, [ Lcd_Data ]

  8. #8
    Join Date
    Dec 2008
    Location
    Ploiesti, ROMANIA
    Posts
    579


    Did you find this post helpful? Yes | No

    Default

    Still " address limit of 7ffh exceeded" ...

  9. #9
    Join Date
    Jan 2009
    Posts
    78


    Did you find this post helpful? Yes | No

    Default Re: Need more space, please...

    Fratello,
    check your pm please

    Best Regards,
    Bogdan Pitic

  10. #10
    Join Date
    Dec 2008
    Location
    Ploiesti, ROMANIA
    Posts
    579


    Did you find this post helpful? Yes | No

    Default Re: Need more space, please...

    I have results...
    Code:
    If Temperature.15 then       
      Temperature= ~Temperature +1
      sign="-"
    Endif
    and removing older parts refering to "sign" and "sign2".
    Now it's ok, but still wonder if can I store some "graphical elements" into eeprom...
    Last edited by fratello; - 24th May 2011 at 06:49.

  11. #11
    Join Date
    Aug 2006
    Location
    Look, behind you.
    Posts
    2,818


    Did you find this post helpful? Yes | No

    Default Re: Need more space, please...

    Quote Originally Posted by fratello View Post
    . . . And one great vendor (TME.EU) don't sell to persons, just company. . . !
    Hmmmm . . . Fratello International, Fratello Engineering , Fratello Imports , Fratello Enterprises, Hot Ziggidy those roses smell great . . . oops . . . Fratello Technologies.EU
    Last edited by Archangel; - 24th May 2011 at 09:06.
    If you do not believe in MAGIC, Consider how currency has value simply by printing it, and is then traded for real assets.
    .
    Gold is the money of kings, silver is the money of gentlemen, barter is the money of peasants - but debt is the money of slaves
    .
    There simply is no "Happy Spam" If you do it you will disappear from this forum.

  12. #12
    Join Date
    Dec 2008
    Location
    Ploiesti, ROMANIA
    Posts
    579


    Did you find this post helpful? Yes | No

    Default Re: Need more space, please...

    Sorry for off-topic...My salary it's about 350 euro/month ; so, it's important if one IC cost 1 or 2 euro - it's just hobby !
    And "Fratello Enterprise(s)" it's verry cool ... I love Star Trek !!!

  13. #13
    Join Date
    Aug 2006
    Location
    Look, behind you.
    Posts
    2,818


    Did you find this post helpful? Yes | No

    Default Re: Need more space, please...

    Business' often request and receive FREE samples. You are a small prototype company are you not ? You do develop products for others ? No employees required. No lies told. No money made ? That's a trade secret.
    If you do not believe in MAGIC, Consider how currency has value simply by printing it, and is then traded for real assets.
    .
    Gold is the money of kings, silver is the money of gentlemen, barter is the money of peasants - but debt is the money of slaves
    .
    There simply is no "Happy Spam" If you do it you will disappear from this forum.

  14. #14
    Join Date
    Dec 2008
    Location
    Ploiesti, ROMANIA
    Posts
    579


    Did you find this post helpful? Yes | No

    Default Re: Need more space, please...

    I try something like this :
    Code:
    data @0,$FF,$01,$01,$01,$01,_
    $01,$01,$01,$01,$01,$01,$01,$01,$01,$FD,$FD,$FD,$85,$85,$FD,$FD,$79,_
    $01,$01,$FD,$FD,$FD,$01,$01,$79,$FD,$FD,$85,$A5,$ED,$ED,$69,$01,$01,_
    $FD,$FD,$FD,$01,$05,$05,$05,$FD,$FD,$FD,$05,$05,$05,$01,_                    
    $F9,$FD,$FD,$25,$25,$FD,$FD,$F9,$01,$01,$FD,$FD,$FD,$81,$81,$81,$81,_        
    $01,$01,$01,$01,$01,$01,$01,$01,$01,$01,$01,$01,$01,$FF
    This is the first row.
    But there, how must doing :
    Code:
                    LcdReg  =  %10000000            ' cursor  X  
                    call    PrintCtrlLcd
                    LcdReg  =  %01000000            ' cursor  Y
                    call    PrintCtrlLcd
                    read 0, vcx
                    for y = 0 to 83                   
                    Lookup y,[??????? vcx ???????], LcdReg               
                    call    PrintDataLcd
                    next y
    Thanks !
    Last edited by fratello; - 24th May 2011 at 11:00.

  15. #15
    Join Date
    Dec 2008
    Location
    Ploiesti, ROMANIA
    Posts
    579


    Did you find this post helpful? Yes | No

    Default Re: Need more space, please...

    I did it !!!
    Code:
    BorderLine:                         ' 
    '=================================== RAND 0
                     for y = 0 to 83 
                     call setcursor
                     read y, LcdReg                      
                     call    PrintDataLcd                
                     next y
    
    return
    
    '==================================================
    setcursor:
                    LcdReg  =  %10000000 + y           ' cursor  X  
                   call    PrintCtrlLcd
                    LcdReg  =  %01000000            ' cursor  Y
                   call    PrintCtrlLcd
    return
    ...and this is the result !
    Attached Images Attached Images  
    Last edited by fratello; - 24th May 2011 at 11:38.

  16. #16
    Join Date
    Dec 2008
    Location
    Ploiesti, ROMANIA
    Posts
    579


    Did you find this post helpful? Yes | No

    Default Re: Need more space, please...

    The button alternate the two temperatures (small and big). Full working code ! Thanks for support ! Regards !
    Attached Images Attached Images   
    Attached Files Attached Files
    Last edited by fratello; - 24th May 2011 at 18:35. Reason: Add pictures...

  17. #17
    Join Date
    Aug 2006
    Location
    Look, behind you.
    Posts
    2,818


    Did you find this post helpful? Yes | No

    Default Re: Need more space, please...

    Congratulations !
    Looks Great !

    Now tell us all about it, is that a PIC16F648A or PIC16F628A ?
    What kind of display is that ? Where can get one and for about how much ?
    I see the making of an article in this thread.

    Oh to all who read this post, if you are willing, please rename your code from .bas to .txt becauseWindows XP and up requires you to download and rename and will not open it first. That is my experience on 3 different computers. Win 98 does not care unless you have loaded VB and then it too does not like it.
    Ahhhgh: My dumb self, I see nokia 3310, first line of O. P.
    Last edited by Archangel; - 25th May 2011 at 01:39. Reason: Ahhhgh
    If you do not believe in MAGIC, Consider how currency has value simply by printing it, and is then traded for real assets.
    .
    Gold is the money of kings, silver is the money of gentlemen, barter is the money of peasants - but debt is the money of slaves
    .
    There simply is no "Happy Spam" If you do it you will disappear from this forum.

  18. #18
    Join Date
    Dec 2008
    Location
    Ploiesti, ROMANIA
    Posts
    579


    Did you find this post helpful? Yes | No

    Default Re: Need more space, please...

    Thanks !
    It's PIC 16F628A ("downgrade" from 16F648A - the reason of this topic) ; display it's from Nokia 3310. Regards !

  19. #19
    Join Date
    Dec 2008
    Location
    Ploiesti, ROMANIA
    Posts
    579


    Did you find this post helpful? Yes | No

    Default Need again help, please, PLEASE ...

    I re-wrote the code, in attempt to having BIGGER numbers on display !
    This is the code :
    Code:
    @ DEVICE pic16F648A, INTrc_osc, WDT_OFF, PWRT_OFF, BOD_OFF, MCLR_OFF, LVP_OFF, CPD_OFF, PROTECT_OFF 
    
    Define  NO_CLRWDT 1
    DEFINE  OSC 4                            
    
            TRISB = %00011100                    'portB configuration  0=out 1=in
            TRISA = %10100000                    'portA configuration
            PortA = %11100000        
            CMCON = 7                        
            VRCON = 0                        
            INTCON = 0              
    
    OPTION_REG=%00000111                       'weak pullups on, TMRO prescale = 256     
    
     
    DQ2        VAR PORTB.3
    
                        
    RST         var  PortA.4   'pin 3   Output   reset display
    SDIN        var  PortA.3   'pin 2   Output   master data out        
    SCK         var  PortA.2   'pin 1   Output   Spi clock
    DQ          var  PortB.2   'pin 18  I/O      DQ DS18b20    
    D_C         var  PortB.0   'pin 6   Output   command/data sel. register
    
                
    Temperature     Var     Word     
    TempC           Var     Word         
    Sign            Var     Word         
    Float           Var     Word           
    Dummy           Var     Byte                  
                LcdReg          var  byte        
                x               var  byte
                y               var  byte
                z               var  byte
                Offset          var  byte
                Char            var  byte
                a               var  byte
                PosX            VAR  Byte
                PosY            VAR  Byte
                Chr             VAR  Byte
                LcdData         VAR  Byte
     Cursor          Var  Byte
    
    '-------------------------------------------------------------------------------            
        Data @0,$FC, $FE, $FE, $06, $00,_
            $00, $06, $FE, $FE, $FC,_
            $7F, $FF, $FF, $C0, $00,_
            $00, $C0, $FF, $FF, $7F,_    ; //0
               $00, $00, $18, $1C, $FE,_ 
              $FE, $FE, $00, $00, $00,_ 
            $00, $00, $00, $C0, $FF,_ 
              $FF, $FF, $C0, $00, $00,_    ; //1
               $00, $3C, $3E, $3E, $06,_
            $86, $FE, $FE, $7C, $00,_ 
            $00, $E0, $F0, $FC, $FF,_ 
            $CF, $C7, $C1, $C0, $00,_     ; //2
               $00, $1C, $1E, $9E, $86,_
             $86, $FE, $FE, $FC, $00,_
            $00, $78, $F8, $F9, $C1,_ 
            $C1, $FF, $FF, $7E, $00,_     ; //3
               $00, $00, $F0, $FE, $7E,_ 
            $FE, $FE, $FE, $00, $00,_ 
            $00, $3F, $3F, $37, $30,_
             $FF, $FF, $FF, $30, $00     ; //4
       
     Data @101, $00, $FE, $FE, $FE, $C6,_ 
                $00, $C6, $C6, $C6, $86,_ 
            $71, $F1, $F1, $C0, $00,_ 
            $00, $C0, $FF, $FF, $7F,_    ; //5
            $00, $FC, $FE, $FE, $C6,_ 
            $C6, $DE, $DE, $9C, $00,_ 
            $00, $7F, $FF, $FF, $C0,_ 
            $C0, $FF, $FF, $7F, $00,_    ; //6
            $00, $06, $06, $06, $86,_ 
            $E6, $FE, $7E, $1E, $00,_ 
            $00, $80, $F0, $FE, $3F,_ 
            $07, $01, $00, $00, $00,_    ; //7
            $00, $7C, $FE, $FE, $86,_ 
            $86, $FE, $FE, $7C, $00,_ 
            $00, $7E, $FF, $FF, $C1,_ 
            $C1, $FF, $FF, $7E, $00,_    ; //8
            $00, $FC, $FE, $FE, $86,_ 
            $86, $FE, $FE, $FC, $00,_ 
            $00, $78, $F9, $F9, $C1,_ 
            $C1, $FF, $FF, $7F, $00        ; //9
                 
    
    '-------------------------------------------------------------------------------            
                       pause 1000
                    RST = 1
                    PortB = 0
                    LcdReg  =  %00100001          'LCD Extended Commands.
                    call    PrintCtrlLcd
                    LcdReg  =  $C5                'Set LCD Vop (Contrast).
                    call    PrintCtrlLcd
                    LcdReg  =  %00000110          'Set Temp coefficent.
                    call    PrintCtrlLcd
                    LcdReg  =  %00010011          'LCD bias mode 1:48.
                    call    PrintCtrlLcd
                    LcdReg  =  %00100000          'LCD Standard Commands, Horizontal addressing mode.
                    call    PrintCtrlLcd
                    LcdReg  =  %00001100          'LCD in normal mode
                    call    PrintCtrlLcd
                       
    call CursorHome
    Gosub LCD_Clear
    
    Main:                
    ' Sensor 1
     OWOut DQ, 1, [$CC, $44] 
     OWOut DQ, 1, [$CC, $BE]
     OWIn DQ, 2, [temperature.byte0, temperature.byte1]  
    
    If Temperature.15 then       
      Temperature= ~Temperature +1
      sign="-"
    Endif
    Dummy = 625 * Temperature
    TempC = DIV32 10 
    TempC = (Temperature & $7FF) >> 4
    Float = ((Temperature.Lowbyte & $0F ) * 25 )>>2
    Temperature = TempC*100 + Float
    
    
    LcdReg  =  %10000000            ' cursor  X  
     call    PrintCtrlLcd
    LcdReg  =  %01000000            ' cursor  Y
     call    PrintCtrlLcd                      
                    Char = (temperature dig 1)     
                    Call    PrintChar
                                
    LcdReg  =  %10000000  + 5       ' cursor  X  
     call    PrintCtrlLcd
    LcdReg  =  %01000000            ' cursor  Y
     call    PrintCtrlLcd     
    
                    Char = (temperature dig 1 )+ 1    
                    Call    PrintChar
    LcdReg  =  %10000000            ' cursor  X  
     call    PrintCtrlLcd
    LcdReg  =  %01000001            ' cursor  Y
     call    PrintCtrlLcd
    
                    Char = (temperature dig 1 )+ 2   
                    Call    PrintChar
    LcdReg  =  %10000000  + 5       ' cursor  X  
     call    PrintCtrlLcd
    LcdReg  =  %01000001            ' cursor  Y
     call    PrintCtrlLcd
    
                    Char = (temperature dig 1 )+ 3   
                    Call    PrintChar
    goto Main
    
    
    '============================================================
    
    CursorHome:     LcdReg  =  %10000000            ' cursor Home
                    call    PrintCtrlLcd
                    LcdReg  =  %01000000            ' cursor Home
                    call    PrintCtrlLcd
                    return
    
    PrintChar:   offset = Char * 5          
                 
                    for a = 1 to 5                
                        read offset, LcdReg
                        call  PrintDataLcd
                        offset = offset + 1
                    next a
                    LcdReg = 0
                    call    PrintDataLcd
                    return
                                        
    PrintCtrlLcd:   D_C = 0                             
    
    PrintDataLcd:   for x = 1 to 8                
                        SDIN = LcdReg.7              
                        SCK = 1
                        LcdReg = LcdReg << 1
                        SCK = 0
                    next x               
                    D_C = 1
                    return               
                    
    Lcd_Clear:
        FOR Cursor = 0 TO 5
            PosX=0:PosY=Cursor:GOSUB Lcd_GotoXY
            HIGH D_C
            LcdData = 0
            FOR Chr = 1 TO 84
                GOSUB LCD_ByteOut
            NEXT Chr
        NEXT Cursor
    RETURN
    
    LCD_GotoXY:
      LOW D_C
      LcdData=%01000000 | PosY :GOSUB LCD_ByteOut
      LcdData=%10000000 | PosX :GOSUB LCD_ByteOut
    RETURN
    
    LCD_ByteOut:
      SHIFTOUT SDIN,SCK,1,[LcdData]
    RETURN
    Each number is made - in FastLCD- like in this example :
    Name:  how_build_number.jpg
Views: 2928
Size:  274.0 KB
    But the results are...strange, like this :
    Name:  example.jpg
Views: 2420
Size:  109.4 KB
    Please, need advice...Thanks in advance !!!
    LE : I use now 16F648A (more EEprom). Attaching ISIS simulating.
    Attached Files Attached Files

  20. #20
    Join Date
    Dec 2008
    Location
    Ploiesti, ROMANIA
    Posts
    579


    Did you find this post helpful? Yes | No

    Default Re: Need more space, please...

    Based on this post : http://www.picbasic.co.uk/forum/show...7847#post87847 - Thank You, scalerebotics !!! I re-x-wrote the code. Now I have good results ! But.... HOW can I display all the three digits of var.temperature ?!? Give me a clue, please !!!
    Code:
    ;**********************************************************************************************
    ;             BIG FONTS - need improvements !!!
    
    @ DEVICE pic16F628A, INTRC_OSC, WDT_OFF, PWRT_OFF, BOD_OFF, MCLR_ON, LVP_OFF, CPD_OFF, PROTECT_OFF 
    
    Define  NO_CLRWDT 1
    DEFINE  OSC 4                            
    
            TRISB = %00011100                    'portB configuration  0=out 1=in
            TRISA = %10100000                    'portA configuration
            PortA = %11100000        
            CMCON = 7                        
            VRCON = 0                        
            INTCON = 0              
    
    OPTION_REG=%00000111                       'weak pullups on, TMRO prescale = 256
                                                    
    Lcd_DC      var PortB.0 
    Lcd_SDA     var PortA.3
    Lcd_RST     var PortA.4
    Lcd_CLK     var PortA.2
    DQ          var PortB.2   
    
    
    
    i           var Byte
    j           var Word
    k           var Byte
    Nc          var Byte
    PosX        var Byte
    PosY        var Byte
    LcdStr      var Byte [28]
    Lcd_Data    var Byte
    CharNum     var Byte
    FA VAR BYTE[5] 'upper left of character
    FB VAR BYTE[5] 'upper right of character
    FC VAR BYTE[5] 'lower left of character
    FD VAR BYTE[5] 'lower right of character
    LcdReg          var  Byte        
    x               var  Byte
    y               var  Byte        
    cursor          var  Byte
    
    Temperature     Var     Word     
    TempC           Var     Word         
    Sign            Var     Word         
    Float           Var     Word                
    Dummy           Var     Byte                       
    DS18B20_12bit    CON %01111111       ' 750ms,   0.0625°C 
    
    
    
    'initialize display-----------------------------------------------
    pause 250
    '-----------------------------------------------------------------
    
                                                    'Initialize LCD, run 1st this!                 
        Low Lcd_RST                                 'Reset LCD (HW reset)
        pause 100 
        High Lcd_RST                                'Release Reset
        Low Lcd_DC                                  'Command/Data
         
      Lcd_Data= $21: GOSUB Lcd_SentByte       ' LCD EXTENDED COMMANDS
      Lcd_Data= $c2: GOSUB Lcd_SentByte       ' SET LCD Vop (CONTRAST) era c8
      Lcd_Data= $06: GOSUB Lcd_SentByte       ' SET TEMP COEFFICENT
      Lcd_Data= $13: GOSUB Lcd_Sentbyte       ' LCD BIAS MODE
      Lcd_Data= $20: GOSUB Lcd_Sentbyte       ' LCD STANDARD COMMANDS
      Lcd_Data= $09: GOSUB Lcd_Sentbyte       ; all on
       pause 1000
      Lcd_data= $08: gosub lcd_sentbyte       ' lcd blank
      Lcd_Data= $0c: GOSUB Lcd_sentbyte       ' LCD IN NORMAL MODE
    
    gosub Lcd_Clear                     'Clear contents of screen
    Low Lcd_DC
    
    Pause 100
    
    
    '==================================================
    ' Init Sensor 1
     OWOUT DQ, 1, [$CC, $4E, 0, 0, DS18B20_12bit]
     OWOut DQ, 1, [$CC, $48]                   ' Start temperature conversion
     OWOut DQ, 1, [$CC, $B8] 
     OWOut DQ, 1, [$CC, $BE] 
     Pause 50
     OWIn DQ, 2, [temperature.byte0, temperature.byte1]
    
    '==================================================
    main:
    
    pause 100
    sign = " "
    ' Start temp.conv.Sensor1
     OWOut DQ, 1, [$CC, $44] 
     OWOut DQ, 1, [$CC, $BE]
     OWIn DQ, 2, [temperature.byte0, temperature.byte1]  
    
    If Temperature.15 then       
      Temperature= ~Temperature +1
      sign="-"
    Endif
     
    Dummy = 625 * Temperature
    TempC = DIV32 10 
    TempC = (Temperature & $7FF) >> 4
    Float = ((Temperature.Lowbyte & $0F ) * 25 )>>2
    Temperature = TempC*100 + Float
    
    
    LcdStr(2) = 48 + TEMPERATURE dig 1
    LcdStr(1) = 48 + TEMPERATURE dig 2
    LcdStr(0) = 48 + TEMPERATURE dig 3
    
    Nc=2
    
    Gosub Lcd_SentString
    gosub afisare
    goto main
    
    '==================================================
    afisare:
        High Lcd_DC
    LcdReg  =  %10000000            ' cursor  X  
     call    PrintCtrlLcd
    LcdReg  =  %01000000            ' cursor  Y
     call    PrintCtrlLcd 
        SHiftOUT Lcd_SDA , Lcd_CLK , 1, [ FA(0),FA(1),FA(2),FA(3),FA(4)] 'upper left
      
    
    LcdReg  =  %10000000  + 5          ' cursor  X  
     call    PrintCtrlLcd
    LcdReg  =  %01000000            ' cursor  Y
     call    PrintCtrlLcd  
        SHiftOUT Lcd_SDA , Lcd_CLK , 1, [ FB(0),FB(1),FB(2),FB(3),FB(4)] 'upper right
    
    
    
    LcdReg  =  %10000000            ' cursor  X  
     call    PrintCtrlLcd
    LcdReg  =  %01000001            ' cursor  Y
     call    PrintCtrlLcd
        SHiftOUT Lcd_SDA , Lcd_CLK , 1, [ FC(0),FC(1),FC(2),FC(3),FC(4)] 'lower left
    
    
    LcdReg  =  %10000000  + 5          ' cursor  X  
     call    PrintCtrlLcd
    LcdReg  =  %01000001            ' cursor  Y
     call    PrintCtrlLcd
        SHiftOUT Lcd_SDA , Lcd_CLK , 1, [ FD(0),FD(1),FD(2),FD(3),FD(4)] 'lower right
        Low Lcd_DC
        Return
    '==================================================
    Lcd_Clear:
    For cursor = 0 to 5
        PosX=0:PosY=Cursor:Gosub Lcd_GotoXY
        High Lcd_DC
    
        For i= 1 to 84
              Lcd_Data=0:Gosub Lcd_SentByte
              Lcd_Data=0:Gosub Lcd_SentByte
        Next i
    Next cursor
    Return
    
    '==================================================
    Lcd_GotoXY:
    Low Lcd_DC
    Lcd_Data=%01000000 | PosY :Gosub Lcd_SentByte    'Y
    Lcd_Data=%10000000 | PosX :Gosub Lcd_SentByte    'X
    Return
    '==================================================
    Lcd_SentByte:
    SHiftOUT Lcd_SDA , Lcd_CLK , 1, [ Lcd_Data ]
    Return
    '==================================================
    Lcd_SentString:
    ;For k=0 to Nc-1      
    FOR K=0 TO NC
        Lcd_Data=LcdStr(k)
        Gosub Lcd_SentChar
    next k
    Return
    '==================================================
    Lcd_SentChar:
        lookdown Lcd_data,[" !\#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~"],CharNum
        Lcd_data = CharNum + 32
        
        SELECT CASE lcd_data
    
        Case 48 ' a zero                   
            FA(0)=$00:FA(1)=$FC:FA(2)=$FE:FA(3)=$FE:FA(4)=$06 ' // 0
            FB(0)=$06:FB(1)=$FE:FB(2)=$FE:FB(3)=$FC:FB(4)=$00 ' // 0  
            FC(0)=$00:FC(1)=$7F:FC(2)=$FF:FC(3)=$FF:FC(4)=$C0 ' // 0
            FD(0)=$C0:FD(1)=$FF:FD(2)=$FF:FD(3)=$7F:FD(4)=$00 ' // 0                    
        
        Case 49 ' a one                 
            FA(0)=$00:FA(1)=$00:FA(2)=$18:FA(3)=$1C:FA(4)=$FE ' // 1
            FB(0)=$FE:FB(1)=$FE:FB(2)=$00:FB(3)=$00:FB(4)=$00 ' // 1  
            FC(0)=$00:FC(1)=$00:FC(2)=$00:FC(3)=$C0:FC(4)=$FF ' // 1
            FD(0)=$FF:FD(1)=$FF:FD(2)=$C0:FD(3)=$00:FD(4)=$00 ' // 1  
    
        Case 50 ' a TWO                 
            FA(0)=$00:FA(1)=$3C:FA(2)=$3E:FA(3)=$3E:FA(4)=$06 ' // 2
            FB(0)=$86:FB(1)=$FE:FB(2)=$FE:FB(3)=$7C:FB(4)=$00 ' // 2  
            FC(0)=$00:FC(1)=$E0:FC(2)=$F0:FC(3)=$FC:FC(4)=$FF ' // 2
            FD(0)=$CF:FD(1)=$C7:FD(2)=$C1:FD(3)=$C0:FD(4)=$00 ' // 2 
    
        Case 51 ' a THREE                 
            FA(0)=$00:FA(1)=$1C:FA(2)=$1E:FA(3)=$9E:FA(4)=$86 ' // 3
            FB(0)=$86:FB(1)=$FE:FB(2)=$FE:FB(3)=$FC:FB(4)=$00 ' // 3  
            FC(0)=$00:FC(1)=$78:FC(2)=$F8:FC(3)=$F9:FC(4)=$C1 ' // 3
            FD(0)=$C1:FD(1)=$FF:FD(2)=$FF:FD(3)=$7E:FD(4)=$00 ' // 3
    
        Case 52 ' a FOUR                 
            FA(0)=$00:FA(1)=$00:FA(2)=$F0:FA(3)=$FE:FA(4)=$7E ' // 4
            FB(0)=$FE:FB(1)=$FE:FB(2)=$FE:FB(3)=$00:FB(4)=$00 ' // 4  
            FC(0)=$00:FC(1)=$3F:FC(2)=$3F:FC(3)=$37:FC(4)=$30 ' // 4
            FD(0)=$FF:FD(1)=$FF:FD(2)=$FF:FD(3)=$30:FD(4)=$00 ' // 4
    
        Case 53 ' a FIVE                 
            FA(0)=$00:FA(1)=$FE:FA(2)=$FE:FA(3)=$FE:FA(4)=$C6 ' // 5
            FB(0)=$C6:FB(1)=$C6:FB(2)=$C6:FB(3)=$86:FB(4)=$00 ' // 5  
            FC(0)=$00:FC(1)=$71:FC(2)=$F1:FC(3)=$F1:FC(4)=$C0 ' // 5
            FD(0)=$C0:FD(1)=$FF:FD(2)=$FF:FD(3)=$7F:FD(4)=$00 ' // 5
    
        Case 54 ' a SIX                 
            FA(0)=$00:FA(1)=$FC:FA(2)=$FE:FA(3)=$FE:FA(4)=$C6 ' // 6
            FB(0)=$C6:FB(1)=$DE:FB(2)=$DE:FB(3)=$9C:FB(4)=$00 ' // 6  
            FC(0)=$00:FC(1)=$7F:FC(2)=$FF:FC(3)=$FF:FC(4)=$C0 ' // 6
            FD(0)=$C0:FD(1)=$FF:FD(2)=$FF:FD(3)=$7F:FD(4)=$00 ' // 6
    
        Case 55 ' a SEVEN                 
            FA(0)=$00:FA(1)=$06:FA(2)=$06:FA(3)=$06:FA(4)=$86 ' // 7
            FB(0)=$E6:FB(1)=$FE:FB(2)=$7E:FB(3)=$1E:FB(4)=$00 ' // 7  
            FC(0)=$00:FC(1)=$80:FC(2)=$F0:FC(3)=$FE:FC(4)=$3F ' // 7
            FD(0)=$07:FD(1)=$01:FD(2)=$00:FD(3)=$00:FD(4)=$00 ' // 7
    
        Case 56 ' a EIGHT                 
            FA(0)=$00:FA(1)=$7C:FA(2)=$FE:FA(3)=$FE:FA(4)=$86 ' // 8
            FB(0)=$86:FB(1)=$FE:FB(2)=$FE:FB(3)=$7C:FB(4)=$00 ' // 8  
            FC(0)=$00:FC(1)=$7E:FC(2)=$FF:FC(3)=$FF:FC(4)=$C1 ' // 8
            FD(0)=$C1:FD(1)=$FF:FD(2)=$FF:FD(3)=$7E:FD(4)=$00 ' // 8
    
        Case 57 ' a NINE                 
            FA(0)=$00:FA(1)=$FC:FA(2)=$FE:FA(3)=$FE:FA(4)=$86 ' // 9
            FB(0)=$86:FB(1)=$FE:FB(2)=$FE:FB(3)=$FC:FB(4)=$00 ' // 9  
            FC(0)=$00:FC(1)=$78:FC(2)=$F9:FC(3)=$F9:FC(4)=$C1 ' // 9
            FD(0)=$C1:FD(1)=$FF:FD(2)=$FF:FD(3)=$7F:FD(4)=$00 ' // 9
    
        end SELECT
    
    High Lcd_DC
    
    PrintCtrlLcd:   LCD_DC = 0                             
    
    PrintDataLcd:   for x = 1 to 8                
                        LCD_SDA = LcdReg.7              
                        LCD_CLK = 1
                        LcdReg = LcdReg << 1
                        LCD_CLK = 0
                    next x               
                    LCD_DC = 1
                    return     
    END
    Now I have only dig 1 on display ....

  21. #21
    Join Date
    Dec 2008
    Location
    Ploiesti, ROMANIA
    Posts
    579


    Did you find this post helpful? Yes | No

    Default

    I have good results !
    Attached Images Attached Images  
    Attached Files Attached Files

  22. #22
    Join Date
    Dec 2008
    Location
    Ploiesti, ROMANIA
    Posts
    579


    Did you find this post helpful? Yes | No

    Default Me, again...

    Hope not disturb !
    This is my last variant of dual thermometer.
    Attached Images Attached Images     
    Attached Files Attached Files
    Last edited by fratello; - 1st June 2011 at 19:30. Reason: ...maybe someone want the code...

  23. #23
    Join Date
    Jan 2005
    Location
    Montreal, Quebec, Canada
    Posts
    2,597


    Did you find this post helpful? Yes | No

    Default Re: Me, again...

    Quote Originally Posted by fratello View Post
    Hope not disturb !
    This is my last variant of dual thermometer.

    Fratello,

    This is your thread.

    You can post anything you consider relevant to this subject; more info on components, ideas about schematic, or more questions on code.

    And congratulations on achieving your objectives!
    My Creality Ender 3 S1 Plus is a giant paperweight that can't even be used as a boat anchor, cause I'd be fined for polluting our waterways with electronic devices.

    Not as dumb as yesterday, but stupider than tomorrow!

  24. #24
    Join Date
    Dec 2008
    Location
    Ploiesti, ROMANIA
    Posts
    579


    Did you find this post helpful? Yes | No

    Default Re: Me, again...

    Thank You so much for support !
    ...another fonts...
    Attached Images Attached Images   
    Attached Files Attached Files

  25. #25
    Join Date
    Dec 2008
    Location
    Ploiesti, ROMANIA
    Posts
    579


    Did you find this post helpful? Yes | No

    Default Re: Need more space, please...

    Instead :
    Code:
    BorderLine:                         ' 
    '=================================== RAND 0
                     for y = 0 to 83 
                     call setcursor
                     read y, LcdReg                      
                     call    PrintDataLcd                
                     next y
    '===================================  RAND 1                                
                   LcdReg  =  %10000000                      ' cursor  X  
                   call    PrintCtrlLcd
                    LcdReg  =  %01000001                ' cursor  Y
                   call    PrintCtrlLcd 
                   LOokup 0, [$FF] , LcdReg 
                   call    PrintDataLcd     
                   
                    LcdReg  =  %10000000 + 83                ' cursor  X  
                   call    PrintCtrlLcd
                    LcdReg  =  %01000001                ' cursor  Y
                   call    PrintCtrlLcd 
                   LOokup 0, [$FF] , LcdReg 
                   call    PrintDataLcd  
    '===================================  RAND 2
                    LcdReg  =  %10000000                ' cursor  X  
                   call    PrintCtrlLcd
                    LcdReg  =  %01000010                ' cursor  Y
                   call    PrintCtrlLcd    
                   LOokup 0, [$FF] , LcdReg 
                   call    PrintDataLcd
                                   
                    LcdReg  =  %10000000 + 83               ' cursor  X  
                   call    PrintCtrlLcd
                    LcdReg  =  %01000010                ' cursor  Y
                   call    PrintCtrlLcd
                   LOokup 0, [$FF] , LcdReg 
                   call    PrintDataLcd
    
    '===================================  RAND 3
                    LcdReg  =  %10000000                ' cursor  X  
                   call    PrintCtrlLcd
                    LcdReg  =  %01000011                ' cursor  Y
                   call    PrintCtrlLcd
                   LOokup 0, [$FF] , LcdReg 
                   call    PrintDataLcd
                   
                   LcdReg  =  %10000000 + 83                ' cursor  X  
                   call    PrintCtrlLcd
                    LcdReg  =  %01000011                ' cursor  Y
                   call    PrintCtrlLcd
                   LOokup 0, [$FF] , LcdReg 
                   call    PrintDataLcd   
    '===================================  RAND 4                
                   LcdReg  =  %10000000                      ' cursor  X  
                   call    PrintCtrlLcd
                    LcdReg  =  %01000100                ' cursor  Y
                   call    PrintCtrlLcd 
                   LOokup 0, [$FF] , LcdReg 
                   call    PrintDataLcd     
                   
                    LcdReg  =  %10000000 + 83                ' cursor  X  
                   call    PrintCtrlLcd
                    LcdReg  =  %01000100                ' cursor  Y
                   call    PrintCtrlLcd 
                   LOokup 0, [$FF] , LcdReg 
                   call    PrintDataLcd    
    '===================================  JOS                
            LcdReg  =  %10000000                      ' cursor  X  
                    call    PrintCtrlLcd
                    LcdReg  =  %01000101                  ' cursor  Y
                    call    PrintCtrlLcd
                    for y = 0 to 83                   
      LOokup y, [$FF,$80,$80,$80,$80,$80,$80,$80,$80,$80,$80,$80,$80,$80,$80,_             
               $80,$80,$80,$80,$81,$81,$81,$BF,$BF,$BF,$81,$81,$81,$80,$BF,$BF,$BF,$A9,_          
               $A9,$A9,$A1,$80,$BF,$BF,$BF,$89,$89,$99,$A6,$80,$BF,$BF,$BF,$82,_          
               $84,$82,$BF,$BF,$BF,$80,$9E,$BF,$BF,$A1,$A1,$BF,$BF,$9E,$80,_          
               $80,$80,$80,$80,$80,$80,$80,$80,$80,$80,$80,$80,$80,$80,$80,_          
               $80,$80,$80,$80,$FF] ,LcdReg
                    call    PrintDataLcd
                    next y 
    return
    I use now :
    Code:
    GotoXY:                
    LcdReg = %01000000 | Posy : call    PrintCtrlLcd    'Y
    LcdReg = %10000000 | Posx : call    PrintCtrlLcd    'X
    Return
    '=========================== 
    BorderLine:                         ' 
    '=================================== up
    posx=0
    posy=0
    gosub GotoXY
                     for y = 0 to 83 
                     read y, LcdReg                      
                     call    PrintDataLcd                
                     next y
    '===================================  raw all                               
    for i= 1 to 4
    posx=0
    posy=i
    gosub GotoXY
                   lcdReg= $FF
                   call    PrintDataLcd
    next i
    
    for i = 1 to 4
    posx=83
    posy=i
    gosub GotoXY
                   lcdReg= $FF
                   call    PrintDataLcd
    next i    
    '===================================  JOS                
    posx=0
    posy=5
    gosub GotoXY
                    for y = 0 to 83                   
        LOokup y,  [$FF,$80,$81,$81,$BF,$BF,$BF,$81,$81,$80,$BF,$BF,_
    $BF,$A9,$A9,$A9,$80,$BF,$BF,$BF,$89,$89,$99,$A6,$80,$BF,$BF,$BF,_
    $82,$84,$82,$BF,$BF,$BF,$80,$9E,$BF,$BF,$A1,$BF,$BF,$9E,$80,$80,_
    $80,$80,$80,$80,$80,$80,$80,$80,$80,$80,$80,$80,$80,$80,$80,$80,_
    $80,$80,$80,$80,$80,$9C,$A2,$A2,$A2,$9C,$80,$9E,$A0,$A0,$A0,$9E,_
    $80,$82,$82,$BE,$82,$82,$80,$FF] ,LcdReg
                    call    PrintDataLcd
                    next y 
    return
    I attach the code from termometer with two differents fonts : small and big. Enjoy !
    Attached Files Attached Files

  26. #26
    Join Date
    Dec 2008
    Location
    Ploiesti, ROMANIA
    Posts
    579


    Did you find this post helpful? Yes | No

    Default Re: Need more space, please...

    The hex file for #16 schematic (bas in #17), for "unumic" user. Just remove the ".txt" extension. Enjoy !
    Attached Files Attached Files

  27. #27
    Join Date
    Aug 2003
    Posts
    985


    Did you find this post helpful? Yes | No

    Default Re: Need more space, please...

    Got any RAM left?

    Code:
    Tc=2
    Nc=6
    PosX=11
    PosY=3 
    Gosub Lcd_GotoXY : Gosub Lcd_SentString
    
    Tc=3
    Nc=6
    PosX=11
    PosY=4
    Gosub Lcd_GotoXY : Gosub Lcd_SentString

    ->

    Code:
    bla var byte : blabla var byte
    bla = 2 : blabla = 3
    
    '************************
    
    gosub loop
    bla = bla + 1
    blabla = blabla + 1
    gosub loop
    
    '************************
    
    loop:
    Tc=bla
    Nc=6
    PosX=11
    PosY=blabla
    Gosub Lcd_GotoXY : Gosub Lcd_SentString
    return
    plenty of potential for stuff like that,
    & you did this exact same thing twice:
    Code:
    LcdStr(5) = 59                            ' simbol for degree
    LcdStr(4) = 48 + Temperature2 dig 1
    LcdStr(3) = "."
    LcdStr(2) = 48 + Temperature2 dig 2
    if Temperature2 dig 3=0 then
    LcdStr(1) = 32
    else
    LcdStr(1) = 48 + Temperature2 dig 3
    endif
    but looks like you fit it in anyways
    Last edited by Art; - 23rd January 2012 at 15:24.

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