Voltmeter : 12F675 & Nokia 3310 display


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

    Default Voltmeter : 12F675 & Nokia 3310 display

    Hi to all !
    I intend to build one milivoltmeter, using 12F675 & N3310 display.
    I made this schematic and I wrote this code. But, once again !, I see nothing on display. Suggestions ?
    Thanks in advance for every reply !
    Attached Images Attached Images  
    Attached Files Attached Files

  2. #2
    Join Date
    May 2008
    Location
    Italy
    Posts
    825


    Did you find this post helpful? Yes | No

    Default

    I made this schematic and I wrote this code. But, once again !, I see nothing on display. Suggestions ?
    I strongly hope you have powered your pic with 3.3 V and not with 5 V.

    If you did, than there is a high possibility that the display is burned.

    If you powered pic correctly then add to your circuit 2 pullup resistors (4.7 K)

    from +3.3 to SDA and from +3.3 to SCL.

    Add DEFINE I2C_HOLD 1 to your code.

    Al.
    All progress began with an idea

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


    Did you find this post helpful? Yes | No

    Default

    Thanks for reply ! I powered PIC with 5V and display with 3V. I made the modiffications You sugest. Still nothing on display...

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


    Did you find this post helpful? Yes | No

    Default

    Working schematic and code. New suggestions are welcome !
    Attached Images Attached Images  
    Attached Files Attached Files

  5. #5
    Join Date
    Mar 2005
    Location
    CROATIA
    Posts
    38


    Did you find this post helpful? Yes | No

    Default

    why you don't write lcd test code first.... to see if lcd is working and to be shure connection and subrutines are ok. then when working, put in whole code....
    I never used this type of pic, so i'm not shure for trisio i allwais used biger pic which ave trisa trisb and so, is your trisio keword correct ? another thing is; submit your code in visible format, many readers of forum have no time, to download looking and comment code when is not visible directly from site....
    sorry for my horible english, i hope is at least funny :-)

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


    Did you find this post helpful? Yes | No

    Default

    My variant of voltmeter, for max. 50 Volts. Limit of text is 10000 characters. My code have 10570 characters. Open and read. All the best !
    Attached Images Attached Images  
    Attached Files Attached Files

  7. #7
    Join Date
    Mar 2005
    Location
    CROATIA
    Posts
    38


    Did you find this post helpful? Yes | No

    Default

    vedo che qua si puo proseguire anche in italiano :-), per me e stesso non scrivo benne ne italiano ne iglesse... siete italiani no ?

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


    Did you find this post helpful? Yes | No

    Default

    Better variant. Some minor modification. Enjoy !
    Attached Files Attached Files

  9. #9
    Join Date
    Sep 2008
    Location
    Stockholm
    Posts
    80


    Did you find this post helpful? Yes | No

    Default

    Damn I *HATE* 12F with their different names on everything..

    Have been trying to convert this code into some useful PIC, like 16F887 but with no success.. I realize that I fumbeling around in the darkness here.. but..

    Crap, cannot post all the code in code-tags neither :P

    link: http://www.repulsiv.se/pic/nokv10.bas

    Connections are changed like you can see in the sourcecode:

    D_C PORTB.0
    SDIN PORTA.3
    SCK PORTA.2

    (Choosen to match the connection that I already had for a nokia LCD on another testrig)

    Any thoughts of what I missed ? ..as I said, I already know I'm fumbeling in the dark

  10. #10
    Join Date
    Aug 2012
    Location
    Comodoro Rivadavia - Patagonia Argentina
    Posts
    51


    Did you find this post helpful? Yes | No

    Default Re: Voltmeter : 12F675 & Nokia 3310 display

    Hola, antes que nada, gracias por el ejemplo, ya que se puede usar como base y o libreria para otros proyectos... Anoche me puse largo y tendido entender el programa y ver el error...
    Tengo en mente hacer una mini fuente de poder (tipo variable por medio de PWM en segundo plano) y emplear el display para ver tension y corriente... ya tengo algo a medio camino, ahora me falta hacer el filtro y ver como hago el calculo para que segun la lectura de una entrada analoica, me genere una salida de 0 a 5Vcc...

    Name:  NOKV10_1.JPG
Views: 2086
Size:  50.9 KB

    Bueno, para no irme del tema. para modificar tu programa y que funcione, configura 1ero los puertos de esta manera:

    D_C var PORTB.0
    RST VAR PORTB.1
    SCK var PORTB.2
    SDIN var PORTB.3
    SCE VAR PORTB.4

    luego, en la seccion de control del display nokia3310, coloca esta seccion (corregi reset y sce):

    Code:
    InicializaLCD:      
        D_C=1          ' Seleccionamos el registro de datos en RAM
        SCE=1         ' Anulamos la seleccion del chip
        pause 100         ' Hacemos una pausa de 100 ms
        gosub Reset_LCD   ' Reseteamos el LCD 
        return
                   
    Reset_LCD:
        RST=0   ' Damos un pulso de reset durante 100 ms  
        pause 100
        RST=1
        SCE=0
        RETURN
        
    CursorHome:     
                      SCK = 1
                    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:
                    PosX=0:PosY=0:Gosub LCD_GotoXY
                    D_C = 1
                    FOR Chr=1 TO 252
                        LcdData=0:Gosub LCD_ByteOut
                        LcdData=0:Gosub LCD_ByteOut
                    next Chr
                    return
    
    LCD_GotoXY:
                    D_C = 0
                    LcdData=%01000000 | PosY :Gosub LCD_ByteOut
                    LcdData=%10000000 | PosX :Gosub LCD_ByteOut
                    return
    
    LCD_ByteOut:
    
                    SHIFTOUT SDIN,SCK,1,[LcdData]
                    
                    return  
    
    Border_line:
    '~~~~~~~~~~~~~~~~~  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,_         ' UP-side "DIGITAL"
                   $01,$01,$01,$F9,$F9,$F9,$09,$09,$F9,$F9,$F1,$01,_
                   $01,$F9,$F9,$F9,$01,$01,$F1,$F9,$F9,$09,$09,$19,_
                   $19,$11,$01,$01,$F9,$F9,$F9,$01,$09,$09,$09,$F9,$F9,$F9,_        
                   $09,$09,$09,$01,$F1,$F9,$F9,$09,$09,$F9,$F9,$F1,$01,$01,_
    	         $F9,$F9,$F9,$01,$01,$01,$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
        
        for y = 0 to 83                          				                   
        LOokup y, [$FF,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,_         ' DOWN-side "DIGITAL"
                   $00,$00,$00,$1F,$1F,$1F,$10,$10,$1F,$1F,$0F,$00,$00,_
                   $1F,$1F,$1F,$00,$00,$0F,$1F,$1F,$10,$11,$1F,$1F,_                      
                   $0F,$00,$00,$1F,$1F,$1F,$00,$00,$00,$00,$1F,$1F,$1F,$00,_
    	         $00,$00,$00,$1F,$1F,$1F,$01,$01,$1F,$1F,$1F,$00,$00,$1F,$1F,_
    	         $1F,$10,$10,$10,$10,$00,$00,$00,$00,$00,$00,$00,_
    	         $00,$00,$00,$00,$00,$FF] ,LcdReg                                          
                   call    PrintDataLcd
        next y 
    
    '===================================  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 + 48       ' cursor  X  
                    call    PrintCtrlLcd
                    LcdReg  =  %01000011            ' cursor  Y              
                   for y = 0 to 35                   
       LOokup y, [$18,$38,$60,$60,$38,$18,_								' "VOLT"
                  $00,$30,$78,$48,$78,$30,_
                $00,$78,$78,$40,$40,_
              $00,$08,$08,$78,$78,$08,$08,$00,_
                $00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$FF] ,LcdReg
               
                    call    PrintDataLcd
                    next y 
    '===================================  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,$80,$80,$80,$80,$80,$80,$80,$80,$80,$80,$80,_          
    	         $80,$80,$80,$80,$80,$80,$80,$80,$80,$80,$80,$80,$80,$80,$80,_          
    	         $80,$80,$80,$80,$80,$80,$80,$80,$80,$80,$80,$80,$80,$80,$80,_          
    	         $80,$80,$80,$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
    '=======================================================================
    
    End             'of program

  11. #11
    Join Date
    Aug 2012
    Location
    Comodoro Rivadavia - Patagonia Argentina
    Posts
    51


    Did you find this post helpful? Yes | No

    Default Re: Voltmeter : 12F675 & Nokia 3310 display

    respecto a la visualizacion de los caracteres, eso seria asi:

    Code:
     LcdReg  =  %10100000 + 17          ' cursor  X
                   call    PrintCtrlLcd
                    LcdReg  =  %01000010 +40           ' cursor  Y
                    call    PrintCtrlLcd
    '~~~~~~~~~~~~~~~~~ now display results    
                    Char = (VOLT dig 1)            
                    call    PrintChar
                    Char = (VOLT dig 0)           
                    call    PrintChar
                    Char = 12                     
                    call    PrintChar
                    Char = (MV dig 0)                      
                    call    PrintChar                
                    ;Char = (MV dig 1)           
                    ;call    PrintChar 
                    Char = 14                     
                    call    PrintChar
    '~~~~~~~~~~~~~~~~~  cursor display amp
                    LcdReg  =  %10100000 + 17           ' cursor  X
                    call    PrintCtrlLcd
                    LcdReg  =  %01000010 + 50           ' cursor  Y
                    call    PrintCtrlLcd
    '~~~~~~~~~~~~~~~~~ now display results    
                     Char = (amper dig 1)            
                     call    PrintChar
                     Char = (amper dig 0)           
                     call    PrintChar
                     Char = 12                     
                     call    PrintChar
                     Char = (Ma dig 1)                      
                     call    PrintChar                
                     Char = 13                     
                     call    PrintChar
    saludos

  12. #12
    Join Date
    Aug 2012
    Location
    Comodoro Rivadavia - Patagonia Argentina
    Posts
    51


    Did you find this post helpful? Yes | No

    Default Re: Voltmeter : 12F675 & Nokia 3310 display

    Veamos si le gusta.... su voltimetro con un graficador de señal (no es un osciloscopio)

    Let's see if you like .... your voltmeter with a graphing signal (not a oscilloscope)

    Name:  volt_grafico_pbp.JPG
Views: 1927
Size:  34.6 KB

    no esta funcional el 100%, pero quizas entre todos le podramos dar un poco de forma... asi como esta, hasta 100Hz lee y grafica... Tambien faltaria corregir la lectura en caso de señales sinuidales (SEN-COS) asi no da falsas lecturas

    100% is not work, but perhaps among all We could give him a little way ... as well as this, to 100Hz graph ... also read and correct reading would fail if sinuidales signals (SEN-COS) so no giving false readings

    Code:
    DEFINE OSC 4
    ;**************** ADC chanel setting  ************************
    DEFINE ADC_BITS 8   
    ;******************* DEGISKENLER  ********************
    INTCON   = 0 
    CMCON=7
    
    ADCON1 = 0
    ;ADCON1=%10000010
    TRISA=%00001111
    TRISB=%00000000
    TRISC=%00000000
    
    PORTA=0
    PORTB=0
    PORTC=0
    DEFINE LCD_DREG     PORTC      
    DEFINE LCD_DBIT     4           
    DEFINE LCD_EREG     PORTC       
    DEFINE LCD_EBIT     1          
    DEFINE LCD_RSREG    PORTC       
    DEFINE LCD_RSBIT    0           
    DEFINE LCD_LINES    2  
    D_C      var     PORTB.0 
    RST      VAR     PORTB.1      
    SCK      var     PORTB.2
    SDIN     var     PORTB.3
    SCE      VAR     PORTB.4    
    
    'Variables usadas por las rutinas del LCD
    ascii       var byte
    Grafico     var byte
    valor_a     VAR BYTE
    valor_b     var word
    LCD_f       var word
    Fuente      var byte
    Fuente1     var byte
    lcd_chr	    var	word
    numero      VAR WORD
    dato        var byte
    PosX        var byte
    PosY        var byte
    X           var BYTE
    Y           var byte
    i           var BYTE
    j           var BYTE
    k           var BYTE
    n           var byte
    f           var byte
    z           var BYTE    'No usar en otra parte, se usa en rutina "DibujaPunto"
    Invertido   var bit
    canal_a     var byte[70]
    canal_b     var byte[70]
    a var byte
    Offset          var  byte
    HAM var word
    HAM2 VAR WORD
    X1   VAR WORD
    DUTY VAR BYTE
     Char            var  byte
    VOLT    VAR  WORD
    HVD     var  word
    AMPER   var  word
    MV      VAR  BYTE
    MA      VAR BYTE
    
                        DATA @0,$3E,$51,$49,$45,$3E,_       ';// 0                   
                                $00,$42,$7F,$40,$00,_       ';// 1
                                $42,$61,$51,$49,$46,_       ';// 2
                                $21,$41,$45,$4B,$31,_       ';// 3
                                $18,$14,$12,$7F,$10,_       ';// 4
                                $27,$45,$45,$45,$39,_       ';// 5
                                $3C,$4A,$49,$49,$30,_       ';// 6
                                $01,$71,$09,$05,$03,_       ';// 7
                                $36,$49,$49,$49,$36,_       ';// 8
                                $06,$49,$49,$29,$1E,_       ';// 9
                                $08,$08,$3E,$08,$08,_       ';// +
                                $08,$08,$08,$08,$08,_       ';// -
                                $00,$60,$60,$00,$00,_       ';// .   
                                $7E,$11,$11,$11,$7E,_       ';// A
                                $1F,$20,$40,$20,$1F,_       ';// V
                                $7F,$09,$09,$09,$01        ';// F
    
    
    
    
    
    
    
    Inicio:
        X=0
        Y=0
        Pause 100         ' Hacemos una pausa de 100 ms para estabilizar todo
        gosub InicializaLCD
        gosub ConfiguraLCD
        gosub borra_lcd
        gosub cursor_origen
    ciclo:
    LCDOUT $FE,1
        call  Border_line
        GOSUB  F_VOLT 
        gosub Pantalla 
        gosub muestreo
        gosub Pantalla
       
       ; GOSUB F_AMP   
        
        ;pause 100
        gosub borra_lcd
        
        goto ciclo
    
    F_VOLT    
    
    adcin 0 , valor_b
    mv=(5*valor_b)*/255
    volt=(5*valor_b)/255
    mv=mv*10/2
     LCDOUT $FE,$02,"VOLT =",DEC VOLT,",",DEC1 MV
          gosub N3310
          RETURN
    
    ;F_AMP:     ;HESAPA:
     ;      HVD=(HAM+1)*/250
      ;     AMPER=HVD/100
       ;    MA=HVD//100
        ;   RETURN      
           
    N3310:
    '~~~~~~~~~~~~~~~~~ cursor display volt
                    lcd_chr  =  %10100000 + 17          ' cursor  X
                   call    lCD_cmd
                    lcd_chr  =  %01000010 +40           ' cursor  Y
                    call    lCD_cmd
    '~~~~~~~~~~~~~~~~~ now display results    
                    char = (VOLT dig 1) 
                    ;call lcd_data           
                    call    PrintChar
                    char = (VOLT dig 0)           
                    call    PrintChar
                    ;call lcd_data
                    char = 12                     
                    ;call lcd_data
                    call    PrintChar
                    char = (MV dig 0)                      
                    ;call lcd_data
                    call    PrintChar                
                    ;Char = (MV dig 1)           
                    ;call    PrintChar 
                    char = 14                     
                    call    PrintChar
                    ;call lcd_data
    RETURN        
    '***************************************************************
    'Rutina para muestreo y almacenamiento de medición en RAM.
    '***************************************************************
    Muestreo:
        for i = 0 to 69                          		
            adcin 0, valor_a
            canal_a[i]= valor_a/8
            pause 20 		
        next i
        return
            
    '***************************************************************
    'Esta rutina muestra las dos señales en el LCD.
    '***************************************************************
     
    Pantalla:
        x=0
        for i = 0 to 69                       		
            y=canal_a[i] ;+5
            gosub Dibujapunto
            pause 1
            x = x+1        
        next i
        Return
        
    '***************************************************************
    'Esta rutina grafica un punto en la pantalla 
    'siguiendo coordenadas X,Y (X:0-83; y:0-47).
    '***************************************************************
    DibujaPunto:
         if Y<=7 then                  
            z=7-Y
            dato = %00000001 << z  
            posy=5
        endif
        if Y>=8 AND Y<=15 then
            z=15-Y
            dato = %00000001 << z   
            posy=4
        endif
        if Y>=16 AND Y<=23 then
            posy=3
            z=23-Y
            dato = %00000001 << z
        endif  
        if Y>=24 and Y<=31 then
            posy=2
            z=31-Y
            dato = %00000001 << z
        endif    
        if Y>=32 AND Y<=39 then
            posy=1
            z=39-Y
            dato = %00000001 << z
        endif    
        if Y>=40 AND Y<=47 then
            posy=0
            z=47-Y
            dato = %00000001 << z
        endif    
        PosX = X
        gosub cursor_xy
        lcd_chr = dato
        gosub lcd_data
        return
     
    '*******************************************************************************************    
    '                           RUTINAS GESTION LCD NOKIA 3310
    '*******************************************************************************************
     
    '------------------------------------------------------------------------------------------- 
    InicializaLCD:      
        D_C=1          ' Seleccionamos el registro de datos en RAM
        SCE=1         ' Anulamos la seleccion del chip
        ;Pin_VCC=1            ' Damos alimentacion al LCD 
        pause 100         ' Hacemos una pausa de 100 ms
        gosub Reset_LCD   ' Reseteamos el LCD 
        return
    '------------------------------------------------------------------------------------------- 
    '------------------------------------------------------------------------------------------- 
    ConfiguraLCD:
        lcd_chr=%00100001 ' Chip Activo, Direccionamiento horizontal, uso de instrucciones extendidas
        gosub lCD_cmd
        lcd_chr=$B5       ' Configura el voltage de operacion del LCD (Contraste)
        gosub lCD_cmd
        lcd_chr=$13       ' Configura bias mux rate a 1:48
        gosub lCD_cmd
        lcd_chr=%00100000 ' Chip Activo, Direccionamiento horizontal,uso de instrucciones basicas
        gosub lCD_cmd
        gosub Segmentos_ON   ' Configura el display (Todos los segmentos ON)
        gosub Display_Normal ' Configura el display (modo Normal)
        gosub direccionamiento_vertical
        return
    '------------------------------------------------------------------------------------------- 
    '-------------------------------------------------------------------------------------------
    Display_Blanco:
        lcd_chr=%00001000 ' Display Blanco    
        gosub lCD_cmd
        return
    '------------------------------------------------------------------------------------------- 
    '-------------------------------------------------------------------------------------------
    Display_Inverso:
        lcd_chr=%00001101 ' Display Inverso    
        gosub lCD_cmd
        return
    '------------------------------------------------------------------------------------------- 
    '-------------------------------------------------------------------------------------------
    Display_Normal:
        lcd_chr=%00001100 ' Display Normal   
        gosub lCD_cmd
        return
    '------------------------------------------------------------------------------------------- 
    '-------------------------------------------------------------------------------------------
    Segmentos_ON:
        lcd_chr=%00001001 ' Segmentos ON  
        gosub lCD_cmd
        return
    '-------------------------------------------------------------------------------------------
    '-------------------------------------------------------------------------------------------
    Direccionamiento_Vertical:
        lcd_chr=%00100010 ' Chip Activo, Direccionamiento Vertical,uso de instrucciones basicas
        gosub lCD_cmd
        return
    '-------------------------------------------------------------------------------------------
    '-------------------------------------------------------------------------------------------
    Direccionamiento_Horizonal:
        lcd_chr=%00100000 ' Chip Activo, Direccionamiento Vertical,uso de instrucciones basicas
        gosub lCD_cmd
        return
    '------------------------------------------------------------------------------------------- 
    '-------------------------------------------------------------------------------------------
    Borra_LCD:
        gosub Cursor_Origen  ' Colocamos el cursor en el origen
        for LCD_f=0 to 503       ' Recorremos todas las posiciones del LCD colocando ceros
            lcd_chr=0 
            gosub LCD_Data
        next LCD_f
        return
    '------------------------------------------------------------------------------------------- 
    '------------------------------------------------------------------------------------------- 
    Cursor_Origen:        
        lcd_chr=%01000000 ' Ponemos la direccion Y a 0 (01000yyy)
        gosub lCD_cmd
        lcd_chr=%10000000 ' Ponemos la direccion X a 0 (1xxxxxxx)
        gosub lCD_cmd
        return
    '------------------------------------------------------------------------------------------- 
    '------------------------------------------------------------------------------------------- 
    Cursor_XY:
        lcd_chr=%10000000 | PosX 
        Gosub lCD_cmd	  ' Envia Posicion X 
        lcd_chr=%01000000 | PosY 
        Gosub lCD_cmd	  ' Envia Posicion Y      
        return
    '------------------------------------------------------------------------------------------- 
    '------------------------------------------------------------------------------------------- 
    Reset_LCD:
        RST=0   ' Damos un pulso de reset durante 100 ms  
        pause 100
        RST=1
        return
    '-------------------------------------------------------------------------------------------
    '------------------------------------------------------------------------------------------- 
    lCD_cmd: 
        D_C=0    ' Seleccionamos el registro de comandos
        goto Data_Out
    '------------------------------------------------------------------------------------------- 
    '------------------------------------------------------------------------------------------- 
    LCD_Data:  
        D_C=1   ' Seleccionamos el registro de datos de RAM        
        if Invertido=1 then   ' Comprobamos si se invierte el dato para la representacion
            lcd_chr = lcd_chr ^ $FF
        endif
        goto Data_Out
    '------------------------------------------------------------------------------------------- 
    '------------------------------------------------------------------------------------------- 
    Data_Out:
        SCE=0   ' Seleccionamos el chip del LCD
        SCK=0  ' Ponemos a cero la señal de reloj
        shiftout SDIN,SCK,1,[lcd_chr\8] 'Enviamos los datos en modo SPI
        SCE=1   ' Deseleccionamos el chip para liberar el bus
        return       
    '------------------------------------------------------------------------------------------- 
    PrintChar: 
                   ;dato = %00000001
                  offset = char * 5          
                 for a = 1 to 5   
                 ;lcd_chr=char             
                read offset, lcd_chr
               call  LCD_Data
              offset = offset + 1
             next a
             lcd_chr=char
     ;lcd_chr = 0
          call    LCD_Data
         return
    '------------------------------------------------------------------------------------------- 
     Border_line:
    
    '~~~~~~~~~~~~~~~~~  RAND 0
                    lcd_chr  =  %10000000            ' cursor  X  
                    call    lCD_cmd
                    lcd_chr  =  %01000000            ' cursor  Y
                    call    lCD_cmd
            
        for y = 0 to 83                   			         				          
        LOokup y, [$FF,$01,$01,$01,$01,$01,$01,$01,$01,$01,$01,$01,_         ' UP-side "DIGITAL"
                   $01,$01,$01,$F9,$F9,$F9,$09,$09,$F9,$F9,$F1,$01,_
                   $01,$F9,$F9,$F9,$01,$01,$F1,$F9,$F9,$09,$09,$19,_
                   $19,$11,$01,$01,$F9,$F9,$F9,$01,$09,$09,$09,$F9,$F9,$F9,_        
                   $09,$09,$09,$01,$F1,$F9,$F9,$09,$09,$F9,$F9,$F1,$01,$01,_
    	         $F9,$F9,$F9,$01,$01,$01,$01,$01,$01,$01,$01,$01,$01,$01,_
    	         $01,$01,$01,$01,$01,$FF] ,lcd_chr      
                   call    LCD_Data
        next y
    '~~~~~~~~~~~~~~~~~  RAND 1                                
                    lcd_chr  =  %10000000            ' cursor  X  
                    call    lCD_cmd
                    lcd_chr  =  %01000001            ' cursor  Y
                    call    lCD_cmd
        
        for y = 0 to 83                          				                   
        LOokup y, [$FF,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,_         ' DOWN-side "DIGITAL"
                   $00,$00,$00,$1F,$1F,$1F,$10,$10,$1F,$1F,$0F,$00,$00,_
                   $1F,$1F,$1F,$00,$00,$0F,$1F,$1F,$10,$11,$1F,$1F,_                      
                   $0F,$00,$00,$1F,$1F,$1F,$00,$00,$00,$00,$1F,$1F,$1F,$00,_
    	         $00,$00,$00,$1F,$1F,$1F,$01,$01,$1F,$1F,$1F,$00,$00,$1F,$1F,_
    	         $1F,$10,$10,$10,$10,$00,$00,$00,$00,$00,$00,$00,_
    	         $00,$00,$00,$00,$00,$FF] ,lcd_chr                                          
                   call    LCD_Data
        next y 
    
    '===================================  RAND 2
                    lcd_chr  =  %10000000            ' cursor  X  
                    call    lCD_cmd
                    lcd_chr  =  %01000010            ' cursor  Y
                    call    lCD_cmd  
                     
        LOokup 0, [$FF] , lcd_chr 
                    call    LCD_Data
                   
                    lcd_chr  =  %10000000 + 83       ' cursor  X  
                    call    lCD_cmd
                    lcd_chr  =  %01000010            ' cursor  Y
                    call    lCD_cmd             
                   
        LOokup 0, [$FF] , lcd_chr 
                    call    LCD_Data
    '===================================  RAND 3
    
    '===================================  RAND 4
                     
                    lcd_chr  =  %10000000            ' cursor  X  
                    call    lCD_cmd
                    lcd_chr  =  %01000100            ' cursor  Y
                    call    lCD_cmd
    
        LOokup 0, [$FF] , lcd_chr 
                    call    LCD_Data
                   
                    lcd_chr  =  %10000000 + 83       ' cursor  X  
                    call    lCD_cmd
                    lcd_chr  =  %01000100            ' cursor  Y
                    call    lCD_cmd
        LOokup 0, [$FF] , lcd_chr 
                    call    LCD_Data
    '===================================  JOS                
    		    lcd_chr  =  %10000000            ' cursor  X  
                    call    lCD_cmd
                    lcd_chr  =  %01000101            ' cursor  Y
                    call    lCD_cmd
                    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,$80,$80,$80,$80,$80,$80,$80,$80,$80,$80,$80,_          
    	         $80,$80,$80,$80,$80,$80,$80,$80,$80,$80,$80,$80,$80,$80,$80,_          
    	         $80,$80,$80,$80,$80,$80,$80,$80,$80,$80,$80,$80,$80,$80,$80,_          
    	         $80,$80,$80,$80,$80,$80,$80,$80,$80,$80,$80,$80,$80,$80,$80,_          
    		   $80,$80,$80,$80,$80,$80,$80,$80,$FF] ,lcd_chr
                    call    LCD_Data
                    next y 
    
    Return
    '=======================================================================
    END
    se que se puede optimizar aun mas, pero estoy parado en ver como puedo solucionar el tema de las lecturas que no son lineales

    which I can be further optimized, but I stand to see how I solve the issue of non-linear readings


Similar Threads

  1. Hdsp 21xx display
    By Original in forum mel PIC BASIC Pro
    Replies: 5
    Last Post: - 7th June 2012, 20:07
  2. Interfacing Nokia 3310 Lcd Using PIC16f877a
    By reianjim in forum mel PIC BASIC Pro
    Replies: 1
    Last Post: - 27th December 2009, 13:54
  3. Replies: 14
    Last Post: - 26th September 2007, 05:41
  4. Nokia 3310 display text
    By chai98a in forum mel PIC BASIC Pro
    Replies: 0
    Last Post: - 26th August 2007, 03:39
  5. nokia 3310 lcd!! (help)
    By ibra in forum mel PIC BASIC Pro
    Replies: 4
    Last Post: - 3rd August 2007, 12:20

Members who have read this thread : 2

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