• Viernes 3 de Mayo de 2024, 12:48

Autor Tema:  Pantalla Nokia 3310 Mas Pic Mas Asm  (Leído 2109 veces)

Gokuden

  • Nuevo Miembro
  • *
  • Mensajes: 9
    • Ver Perfil
Pantalla Nokia 3310 Mas Pic Mas Asm
« en: Domingo 10 de Abril de 2005, 21:02 »
0
para facilitarle la vida, aqui les coloco todo lo necesario para hacer funcionar esta pantalla,estas rutinas fueron ya probadas por mi u otros y funcionan a la perfeccion  y aqui se las traigo algo ams ordenano.

primero tienen que decarar la variable afisaj o cambiarle el nombre , como deseen, y declarar los bit como aparecen ah i pero pueden cambia rlas asignaciones de bit y pto. luego llaman primero la rutina INILCD que es la que configura la lcd y luego ya puede mandar datos a ella poniendo el dato en acumulador o afisaj y llamando la rutina LCCMD.







LPH7779, LPH7677 Pins (front view)

 
      pin1     V+
      pin2     Sclk
      pin3     Sda
      pin4     DorC
      pin5     Cs
      pin6     Gnd
      pin7     Vout(DC/DC voltage converter)
      pin8     Reset



;--------------DELCALRACIONES DE BIT----------------
#DEFINE sclk   PORTB,0   ; Rb6 is serial clock line   
#DEFINE sdta   PORTB,1   ; Rb7 is input serial data line
#DEFINE dorc   PORTB,2   ; Ra0 is select register (H = Data, L =Command)
#DEFINE rset   PORTB,3   ; Ra1 is reset (L = Enable)
#DEFINE tens   PORTB,4   ; Ra2 is Vcmd LCD power supply on / off
#DEFINE enab   PORTB,5   ; Ra3 is Chip select (L = Enable)


   


;--------------INICIACION DE LCD----------------

INILCD   Call   pause   
   bsf   dorc            
   bsf   enab   
   bsf   tens   
   call    lcres   
   movlw    21H   
   movwf    afisaj
   call   lccmd   
   movlw    .197   
   movwf   afisaj      
   call   lccmd   
   movlw    13H   
   movwf    afisaj
   call   lccmd
   movlw    20H   
   movwf    afisaj
   call   lccmd   
   movlw    09H   
   movwf    afisaj
   call   cbild
   call   lccmd
   call   pause
   call   pause
   call   pause
   call   pause
   movlw    08H   
   movwf    afisaj
   call   lccmd   
   call   pause
   call   pause
   movlw    0CH   
   movwf    afisaj
   call   lccmd   
   movlw    40H   
   movwf    afisaj
   call   lccmd   
   movlw    80H   
   movwf    afisaj
   call   lccmd   
                return

;*****************************************************************
;      RUTINAS DATO, COMANDO Y RESETEO LCD NOKIA
;*****************************************************************
lcdta   bsf   dorc   ; bytes are stored in the display data ram, address
         ; incremented automatically
   bcf   enab   ; chip enabled
   call   varsa   
   bsf   enab   ; chip disabled
   retlw   00

lccmd   bcf   dorc   ; byte is a command it is read with the eight SCLK
   bcf   enab   ; chip enabled
   call   varsa   
   bsf   enab   ; chip disabled
   retlw   00   

lcres   bcf   rset   ; reset enabled
   call   pause
   bsf   rset    ; reset disabled
   retlw   00

;*****************************************************************
;      RUTINAS VARIAS DE LA LCD NOKIA
;*****************************************************************
varsa   bcf   sclk       
   btfsc    afisaj,7   ;bit0(MSB) if bit 7 of afisaj = 1 then sdta=1
   bsf   sdta   ; serial data line is high
   btfss    afisaj,7   ; if bit 7 of afisaj = 0 then sdta=0
   bcf   sdta   ; serial data line is low
   nop      ; can be replaced with a nop if a higher speed it is
   bsf   sclk   ; positive edge
   nop      ; can be replaced with a nop if a higher speed it is
   bcf   sclk   ; negative edge
   btfsc    afisaj,6   ;bit1 if bit 6 of afisaj = 1 then sdta=1
   bsf   sdta   ; serial data line is high
   btfss    afisaj,6; if bit 6 of afisaj = 0 then sdta=0
   bcf   sdta   ; serial data line is low
   nop
   bsf   sclk   ; positive edge
   nop
   bcf   sclk   ; negative edge
   btfsc    afisaj,5   ;bit2
   bsf   sdta   ; serial data line is high
   btfss    afisaj,5
   bcf   sdta   ; serial data line is low
   nop
   bsf   sclk   ; positive edge
   nop
   bcf   sclk   ; negative edge
   btfsc    afisaj,4   ;bit3
   bsf   sdta   ; serial data line is high
   btfss    afisaj,4
   bcf   sdta   ; serial data line is low
   nop
   bsf   sclk   ; positive edge
   nop
   bcf   sclk   ; negative edge
   btfsc    afisaj,3   ;bit4
   bsf   sdta   ; serial data line is high
   btfss    afisaj,3
   bcf   sdta   ; serial data line is low
   nop
   bsf   sclk   ; positive edge
   nop
   bcf   sclk   ; negative edge
   btfsc    afisaj,2   ;bit5
   bsf   sdta   ; serial data line is high
   btfss    afisaj,2
   bcf   sdta   ; serial data line is low
   nop
   bsf   sclk   ; positive edge
   nop
   bcf   sclk   ; negative edge
   btfsc    afisaj,1   ;bit6
   bsf   sdta   ; serial data line is high
   btfss    afisaj,1
   bcf   sdta   ; serial data line is low
   nop
   bsf   sclk   ; positive edge
   nop
   bcf   sclk   ; negative edge
   btfsc    afisaj,0   ;bit7(LSB)
   bsf   sdta   ; serial data line is high
   btfss    afisaj,0
   bcf   sdta   ; serial data line is low
   nop
   bsf   sclk   ; positive edge
   nop
   bcf   sclk   ; negative edge
   retlw   00

cbild   bcf   sdta   ; serial data line is low a null value it is send to
   movlw   .6   ; set the maximal value for Y axe
   movwf   COUNT3
c3   movlw   .84   ; set the maximal value for X axe
   movwf   COUNT1
c1   movlw   .8  ; for a serial transmission of one byte , a number of 8 clock
   movwf   COUNT2
   bsf   dorc      ; null value bytes are stored in the display
            ; incremented automatically
   bcf   enab      ; chip enabled  
c2   bcf   sclk      ; negative edge ;at this stage sdta=0 and
   nop         ; no operation
   nop         ; no operation
   bsf   sclk      ; positive edge
   decfsz  COUNT2   
   goto    c2
   bsf   enab      ; chip disabled       
   decfsz  COUNT1   
   goto    c1      
   decfsz  COUNT3    
   goto  c3          
   retlw    00   

;*****************************************************************
;      RETARDOS DE LA LCD NOKIA
;*****************************************************************
pause   movlw   .7      
   movwf   COUNT3   
d3   movlw   .50
   movwf   COUNT1
d1   movlw   .250   
   movwf   COUNT2
d2   decfsz  COUNT2   
   goto    d2      
   decfsz  COUNT1   
   goto    d1      
   decfsz  COUNT3    
   goto  d3          
   retlw    00

halta   movlw   20H      
   movwf   COUNT1   
g1   movlw   40H      
   movwf   COUNT2   
g2   decfsz  COUNT2   
   goto    g2      
   decfsz  COUNT1   
   goto    g1      
   retlw   00