Need more space, please...


Results 1 to 27 of 27

Threaded View

  1. #17
    Join Date
    Dec 2008
    Location
    Ploiesti, ROMANIA
    Posts
    582


    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: 3019
Size:  274.0 KB
    But the results are...strange, like this :
    Name:  example.jpg
Views: 2534
Size:  109.4 KB
    Please, need advice...Thanks in advance !!!
    LE : I use now 16F648A (more EEprom). Attaching ISIS simulating.
    Attached Files Attached Files

Members who have read this thread : 0

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