Autor Tema: Glcd - Proton - TPG - no me funciona en la realidad...  (Leído 7583 veces)

0 Usuarios y 1 Visitante están viendo este tema.

Desconectado LordLafebre

  • Moderador Global
  • DsPIC30
  • *****
  • Mensajes: 3529
    • Micros & micros
Glcd - Proton - TPG - no me funciona en la realidad...
« en: 08 de Diciembre de 2005, 01:21:00 »
Hola amigos:

Pido un poco de ayuda con lo siguiente:

He simulado en proteus un GLCD de 128x64 con Proton y el Todopic Generator y me funciono muy bien, el problema se me presenta al momento de probarlo con el siguiente GLCD:

http://www.crystalfontz.com/products/12864b/index.html#CFAG12864BTMI



lo estoy armando en un proto... pero no hace nada Llorica, no se que hago mal o que cambios o que es lo que tengo que tomar en cuenta al momento de armarlo en la realidad...

este es el esquema que simule en proteus...



como digo solo llego hasta alli, ya que luego no pasa nada de nada...

Alguien a hecho esto antes o si alguien tiene un .Hex para un 877 y un glcd de estos solo para probar si aun esta vivo...?

Gracias a todos....... Avergonzado

Desconectado jorgeansuini

  • PIC18
  • ****
  • Mensajes: 340
RE: Glcd - Proton - TPG - no me funciona en la realidad...
« Respuesta #1 en: 08 de Diciembre de 2005, 18:12:00 »
Hola Lord:

Yo he probado un display de 128x64 con los ejemplos del proton y me funcionaron sin mayor problema. Los probe con el ejemplo que no utiliza memoria externa.-

Saludos
Jorge

Desconectado LordLafebre

  • Moderador Global
  • DsPIC30
  • *****
  • Mensajes: 3529
    • Micros & micros
RE: Glcd - Proton - TPG - no me funciona en la realidad...
« Respuesta #2 en: 08 de Diciembre de 2005, 20:23:00 »
Hola Jorge:

Pues te comento que algo he avanzado algo, me funciona ya, pero solo texto y solo la una mitad del GLCD la otra no me funciona, tengo algun problema con CS1 y CS2, lo curioso que cuando no cuando no Conecto CS2 funciona bien toda la pantalla pero el mensage se repite.... lo que si con los graficos no va para nadaLlorica... vamos a ver que pasa.... Avergonzado

Desconectado LordLafebre

  • Moderador Global
  • DsPIC30
  • *****
  • Mensajes: 3529
    • Micros & micros
RE: Glcd - Proton - TPG - no me funciona en la realidad...
« Respuesta #3 en: 09 de Diciembre de 2005, 09:25:00 »
Hola:

Jorge estaba buscando lo ejemplos del proton pero solo encontre uno que trabaja con una declaracion para utilizar una tarjeta propia de ellos... y pues lamentablemente no encontre mas ejemplos.... puedes ayudarme con el ejemplo del que tu hablas.... con eso si no llegara a funcionar podria ser que alguno de mis elementos paso a mejor vida... Sonrisa Gigante (aunque no creo)... Helado

Gracias......!!!!!

Desconectado dogflu66

  • Moderador Local
  • DsPIC30
  • *****
  • Mensajes: 3510
RE: Glcd - Proton - TPG - no me funciona en la realidad...
« Respuesta #4 en: 09 de Diciembre de 2005, 17:08:00 »
Hola pana Giovanni
Emule en mi sistema un ejemplo teniendo en cuenta la info del esquema que pegaste, espero que te funcione... suerte… Muchas risas

http://www.mytempdir.com/309930

PD: 20Mhz Navidad
Saludos desde Granada, España.

Desconectado jorgeansuini

  • PIC18
  • ****
  • Mensajes: 340
RE: Glcd - Proton - TPG - no me funciona en la realidad...
« Respuesta #5 en: 09 de Diciembre de 2005, 18:40:00 »
Hola:

Te paso los ejemplos que me funcionaron:

;MOVING BALL
" Bounce a pixel around the graphic LCD"s screen

      DEVICE = 16F877a
        XTAL = 20
       
      LCD_DTPORT = PORTD
      LCD_RSPIN = PORTb.2
      LCD_ENPIN = PORTb.5
      LCD_RWPIN = PORTb.4
        LCD_CS1PIN = PORTb.0
      LCD_CS2PIN = PORTb.1
        LCD_TYPE = GRAPHIC
      INTERNAL_FONT = ON
      GLCD_CS_INVERT On
      FONT_ADDR = 0
   
      Dim x as Byte
       Dim y as Byte
       Dim xold as Byte
          Dim yold as Byte
       Dim xx as Byte
       Dim yy as Byte
       Dim xxx as Byte
       Dim yyy as Byte
       Dim w as Byte

      Dim Xdir As Bit
      Dim Ydir As Bit

      Symbol Xmax = 126            " XPOS maximum position
      Symbol Ymax = 62            " YPOS maximum position
      Symbol Xmin = 1               " XPOS minimum position
      Symbol Ymin = 1               " YPOS minimum position
      Symbol Delay = 20            " Rate of ball movement
      high portb.3
      Delayms 500                  " Wait for PICmicro to stabilise
       Cls                        " Clear the LCD

      x = Xmin
        y = Ymin
      Xdir = 1
        Ydir = 1

      While 1 = 1
         If Xdir = 1 Then
            Inc x
            If x > Xmax Then      " Make sure ball is within X boundaries
               Xdir = 0
               x = Xmax
            Endif
         Else
            Dec x
            If x = Xmin Then      " Make sure ball is within X boundaries
               Xdir = 1
            EndIf
         EndIf
         If Ydir = 1 Then
            Inc y
            If y > Ymax Then      " Make sure ball is within Y boundaries
               Ydir = 0
               y = Ymax
            EndIf
         Else
            Dec y
            If y = Ymin Then      " Make sure ball is within Y boundaries
               Ydir = 1
            EndIf
         EndIf
         Plot y,x               " Draw the ball
          Plot y + 1,x
          Plot y,x + 1
          Plot y + 1,x + 1
         Delayms Delay

         UnPlot yold,xold         " Erase the ball
          UnPlot yold + 1,xold
          UnPlot yold,xold + 1
          UnPlot yold + 1,xold + 1
         Delayms Delay

         xold = xxx               " Update variables
          yold = yyy
         xxx = xx
          yyy = yy
         xx = x
          yy = y
      Wend                     " Do it forever
-----------------------------------------
;GLCDTEST
" Display text and graphics on a graphic LCD

      ;Include "PROTON18_G4.INT"
      DEVICE = 16F877a
        XTAL = 20
       
      LCD_DTPORT = PORTD
      LCD_RSPIN = PORTb.2
      LCD_ENPIN = PORTb.5
      LCD_RWPIN = PORTb.4
        LCD_CS1PIN = PORTb.0
      LCD_CS2PIN = PORTb.1
        LCD_TYPE = GRAPHIC
       GLCD_CS_INVERT On
      ;GLCD_STROBE_DELAY 5000
      INTERNAL_FONT = ON
      FONT_ADDR = 0
        high portb.3
      WARNINGS = OFF        
        Declare STAMP_COMPATIBLE_SIN = ON
" Set up some Variables
       
        Dim Xpos      as   Byte
        Dim   Ypos      as   Byte
 
        Delayms 400
        Cls
        Print "Graphic LCD Test"
       
Again:        
        For Xpos = 0 to 63
           Ypos = SIN Xpos
           Plot Xpos , Ypos
           Delayms 10
        Next
        For Xpos = 0 to 63
           Ypos = SIN Xpos
           UnPlot Xpos , Ypos
           Delayms 10
        Next                
      Goto Again
       
      Include "FONT.INC"
---------------------------------------
" Simple Graphic LCD terminal emulator.
" Receives data at 9600 baud, and displays characters on a graphic LCD.

" Uses a software interrupt to flash the cursor, and display the characters

        ;Include "PROTON_G20.INT"
        DEVICE = 16F877a
        XTAL = 20
       
      LCD_DTPORT = PORTD
      LCD_RSPIN = PORTb.2
      LCD_ENPIN = PORTb.5
      LCD_RWPIN = PORTb.4
        LCD_CS1PIN = PORTb.0
      LCD_CS2PIN = PORTb.1
        LCD_TYPE = GRAPHIC
      INTERNAL_FONT = ON
      GLCD_CS_INVERT On
      FONT_ADDR = 0
        Dim XPOS as Byte            " X position of cursor
        Dim YPOS as Byte            " Y position of cursor
        Dim Shadow_YPOS as Byte         " Previous Y position
        Dim Shadow_XPOS as Byte         " Previous X position
        Dim RCV  as Byte             " Byte received from serial pin
        Dim PRINT_IT as Bit            " Signal to display a character
        Dim SET_CURSOR as Bit         " Signal to move cursor only
        Dim TIMESHARE as Word         " Flash rate variable
        Dim DATA_BYTE as Byte         " Used for scrolling the display UP a line
        high portb.3
"---------------------------------------------------------------------              
        Delayms 500                                 " Wait for PICmicro to stabilise
        ALL_DIGITAL = true                           " Set PORTA to all digital
        Cls                                       " Clear the LCD before we start
        Clear XPOS                                 "
        Clear YPOS                                 "   Reset variables
        Clear TIMESHARE                              " /

" Set TMR0 to interrupt
        OPTION_REG = %00000111
        INTCON = %00100000                           " Attach interrupt to TMR0
        ON INTERRUPT Goto FLASH_CURSOR                  " Point the interrupt to FLASH_CURSOR
        DISABLE
        Goto OVER_INTERRUPT                           " Jump over the interrupt handler
       
"---------------------------------------------------------------------                      
" Interrupt handler to flash the cursor, and print to the LCD   
FLASH_CURSOR:
            If TIMESHARE = 200 Then Print at YPOS , XPOS ,_   " Is it time to flash the cursor ?
             FONT 0 , XOR 1 , INVERSE 1 , " " , XOR 0, INVERSE 0
               
            If SET_CURSOR = 1 Then
                Print at SHADOW_YPOS , SHADOW_XPOS , " " , at YPOS , XPOS                
                SET_CURSOR = 0
               Goto FINISH
            Endif
           
            If PRINT_IT = 1 Then
               Print at YPOS , XPOS , RCV
                If XPOS < 20 Then Inc XPOS : Else : XPOS = 0 : Inc YPOS                                
                PRINT_IT = 0
            Endif
FINISH:
            Inc TIMESHARE
            If TIMESHARE > 400 then Clear TIMESHARE         " Ensure an even flash rate
        RESUME
        ENABLE

"----[SCROLL THE SCREEN UP ONE LINE]---------------------------------------------
SCROLL:
      DISABLE                                    " Disable interrupts while we scroll
        YPOS = 1                                 " Start at line 0
        Repeat
            XPOS = 0                              " and position 0 on the line
            Repeat       
               DATA_BYTE = LCDREAD YPOS, XPOS           " Read from a line            
                LCDWRITE YPOS - 1 , XPOS , [DATA_BYTE]      " And write to the line above
               Inc XPOS
            Until XPOS.7 = 1                        " Until a count less than 127
           Inc YPOS
        Until YPOS.3 = 1                           " Until a count less than 8
        Print at 7,0,REP " "21                        " Blank the bottom line
        XPOS = 0
        YPOS = 7
        Return
        ENABLE                                    " Enable interrupts for the main program loop
       
"----[MAIN PROGRAM LOOP STARTS HERE]----------------------------------------------
               
OVER_INTERRUPT:              
        While 1 = 1                                 " Create an infinite loop
Receive:    RCV = HRSIN, {1,Receive}                   " Receive serial with timeout of 1ms          
         SET_CURSOR = 0
            SHADOW_YPOS = YPOS
            SHADOW_XPOS = XPOS
            If RCV = 8 Then                         " Found Backspace ?
                If XPOS > 0 Then Dec XPOS
                SET_CURSOR = 1                        " Signal we want to move the cursor only
                Goto Receive
            Endif
            If RCV = 13 Then                         " Found Carriage Return ?
               Inc YPOS
                XPOS = 0
                SET_CURSOR = 1                        " Signal we want to move the cursor only
                If YPOS > 7 Then Gosub SCROLL
                Goto Receive
            Endif
           
            If YPOS > 7 Then Gosub SCROLL
            PRINT_IT = 1                           " Signal we want to print a character
        Wend  
                   
        Include "FONT.INC"
 -----------------------------------------------------------------

" Draw a scale with X and Y lines
" Incremental tick marks are also added

      ;Include "PROTON_G4.EXT"   " Use a PROTON board with a 4MHz OSC and Graphic LCD
        DEVICE = 16F877a
        XTAL = 20
       
      LCD_DTPORT = PORTD
      LCD_RSPIN = PORTb.2
      LCD_ENPIN = PORTb.5
      LCD_RWPIN = PORTb.4
        LCD_CS1PIN = PORTb.0
      LCD_CS2PIN = PORTb.1
        LCD_TYPE = GRAPHIC
      INTERNAL_FONT = ON
      GLCD_CS_INVERT On
      FONT_ADDR = 0
        Dim S_XSTART as Byte
        Dim S_XEND as Byte
        Dim S_YSTART as Byte
        Dim S_YEND as Byte
        Dim S_YTICK as Byte
        Dim S_XTICK as Byte
        Dim XPOS as Byte
        Dim YPOS as Byte
        Dim I  
      high portb.3  

        Delayms 500            " Wait for PICmicro to stabilise
        Cls                  " Clear the LCD
       
        S_XSTART = 0         " XPOS start position
        S_XEND = 119         " XPOS end position
          S_YSTART = 0         " YPOS start position
        S_YEND = 59            " YPOS end position
        S_XTICK = 10         " X increment of TICKS
        S_YTICK = 10          " Y increment of TICKS
        Gosub DRAW_SCALE      " Draw the scale
        Stop
       
"---------------------------------------------------------------------------      
" Draw_Scale subroutine which draws an XY scale with tick marks
" Assumes values assigned to S_XPOS,S_YPOS,S_XTICK,X_XEND,S_YEND and S_YTICK

Draw_Scale:
" Draw vertical Y axis
      I = 0
        YPOS = S_YSTART
      Repeat
          Plot YPOS,S_XSTART
         Inc I
         Inc YPOS
        Until YPOS > S_YEND

" Add the tick marks to the Y axis
      YPOS = S_YSTART
      Repeat
           Plot YPOS,S_XSTART + 1
         YPOS = YPOS + S_YTICK
        Until YPOS > S_YEND

" Draw horizontal X axis
      XPOS = S_XSTART
      Repeat
         Plot s_yend,XPOS
         Inc XPOS
        Until XPOS > S_XEND
   
" Draw X axis tick marks
      XPOS = S_XSTART
      Repeat
         Plot S_YEND - 1,XPOS
         XPOS = XPOS + S_XTICK
        Until XPOS > S_XEND

      Return
-----------------------------------------------
" Draw circles on a graphics LCD using BASIC commands
" This is a similar routine to the compiler"s built in CIRCLE command.

      DEVICE = 16F877a
        XTAL = 20
      LCD_DTPORT = PORTD
      LCD_RSPIN = PORTb.2
      LCD_ENPIN = PORTb.5
      LCD_RWPIN = PORTb.4
        LCD_CS1PIN = PORTb.0
      LCD_CS2PIN = PORTb.1
        LCD_TYPE = GRAPHIC
      INTERNAL_FONT = ON
      GLCD_CS_INVERT On
      FONT_ADDR = 0
       
      Dim xx as Byte
        Dim yy as Byte
        Dim tr as Word
      Dim dd as Byte
      Dim a as Byte
        Dim b as Byte
        Dim c as Byte
        Dim d as Byte
             
        Dim XPOS_START as Byte      " XPOS Start position
        Dim YPOS_START as Byte      " YPOS Start position
        Dim RADIUS as Byte         " RADIUS (in pixels)
        high portb.3
        Delayms 500               " Wait for PICmicro to stabilise

      For RADIUS = 5 to 150
           Cls
           XPOS_START = 64
           YPOS_START = 32
           Gosub DRAW_CIRCLE
           Print at 0,0, "RADIUS = " , DEC RADIUS,"  "
           Delayms 300
       Next
        Stop
"---------------------------------------------------------        
" Plot 4 locations simultaneously
PLOT_IT:
      Plot b,a
      Plot d,a
      Plot b,c
      Plot d,c
       Return
"---------------------------------------------------------    
" Draw a circle
DRAW_CIRCLE:        

       dd = YPOS_START - XPOS_START
      xx = 0
       yy = RADIUS
      tr = 3 - (2 * RADIUS)
      While xx <= yy
         a = XPOS_START + xx
          b = YPOS_START + yy
         c = XPOS_START - xx
          d = YPOS_START - yy  
         Gosub PLOT_IT
         a = YPOS_START + yy - dd
          b = YPOS_START + xx
         c = YPOS_START - yy - dd
          d = YPOS_START - xx
         Gosub PLOT_IT
           If tr.15 = 1 Then
               tr = tr + 6
               tr = tr + (4 * xx)
         Else
            tr = tr + 10
               tr = tr + (4 * (xx - yy))
            Dec yy
         EndIf
         Inc xx
      Wend
      Return

      Include "FONT.INC"

-----------------------------------------------
" Draw squares on a graphics LCD using BASIC commands
" This is a similar routine to the compiler"s built in BOX command

      DEVICE = 16F877a
        XTAL = 20
       
      LCD_DTPORT = PORTD
      LCD_RSPIN = PORTb.2
      LCD_ENPIN = PORTb.5
      LCD_RWPIN = PORTb.4
        LCD_CS1PIN = PORTb.0
      LCD_CS2PIN = PORTb.1
        LCD_TYPE = GRAPHIC
       GLCD_CS_INVERT On
      ;GLCD_STROBE_DELAY 5000
      INTERNAL_FONT = ON
      FONT_ADDR = 0
        high portb.3
        Dim X as Byte
        Dim Y as Byte
        Dim XPOS_START as Byte
        Dim YPOS_START as Byte
        Dim SIZE as Byte    

        Delayms 500                  " Wait for PICmicro to stabilise
        Cls                        " Clear the LCD
       
        XPOS_START = 64               " XPOS Start position
        YPOS_START = 31               " YPOS Start position
        For SIZE = 1 to 60 step 4
        Gosub DRAW_BOX
        Delayms 100
        Next
        Stop
"----------------------------------------------------        
" Draw 8 pixels simultaneously
PLOT_8:
   Plot YPOS_START + y,XPOS_START + x
    Plot YPOS_START + y,XPOS_START - x
   Plot YPOS_START - y,XPOS_START + x
    Plot YPOS_START - y,XPOS_START - x         
   Plot YPOS_START + x,XPOS_START + y
    Plot YPOS_START + x,XPOS_START - y
    Plot YPOS_START - x,XPOS_START + y
    Plot YPOS_START - x,XPOS_START - y
   Return
"--------------------------------------------------------------------        
" Draw a BOX        
" XPOS_START,YPOS_START and SIZE
DRAW_BOX:

        X = 0
        Y = SIZE
        While X <= Y
            Gosub PLOT_8
         Inc X
        Wend
      Return
        --------------------------------------------

Espero te funcionen

saludos
Jorge


       






Desconectado LordLafebre

  • Moderador Global
  • DsPIC30
  • *****
  • Mensajes: 3529
    • Micros & micros
RE: Glcd - Proton - TPG - no me funciona en la realidad...
« Respuesta #6 en: 09 de Diciembre de 2005, 20:08:00 »
Hola:

Gracias amigos, a los dos, voy a probar y ya les cuento como me va...

un abrazo... Sonrisa Gigante

Desconectado LordLafebre

  • Moderador Global
  • DsPIC30
  • *****
  • Mensajes: 3529
    • Micros & micros
RE: Glcd - Proton - TPG - no me funciona en la realidad...
« Respuesta #7 en: 10 de Diciembre de 2005, 23:34:00 »
Hola:

Pues al parecer el problema es el pic o mi GLCD... me pasa lo mismo con el ejemplo de Carlos....

PD: solo lei el juuuuuas juuuuuuas... Sonrisa Gigante

Desconectado dogflu66

  • Moderador Local
  • DsPIC30
  • *****
  • Mensajes: 3510
RE: Glcd - Proton - TPG - no me funciona en la realidad...
« Respuesta #8 en: 11 de Diciembre de 2005, 08:14:00 »
En principio tu esquema tendria que funcionar pero de todas formas echale un vistazo a este esquema...

http://www.oshonsoft.com/picchargerlcdpro.html
Saludos desde Granada, España.

Desconectado LordLafebre

  • Moderador Global
  • DsPIC30
  • *****
  • Mensajes: 3529
    • Micros & micros
RE: Glcd - Proton - TPG - no me funciona en la realidad...
« Respuesta #9 en: 11 de Diciembre de 2005, 08:44:00 »
Hola:

Gracias lo voy a revisar.

Desconectado LordLafebre

  • Moderador Global
  • DsPIC30
  • *****
  • Mensajes: 3529
    • Micros & micros
RE: Glcd - Proton - TPG - no me funciona en la realidad...
« Respuesta #10 en: 12 de Diciembre de 2005, 16:04:00 »
Hola:

Gracias amigos, especialmente a Jorge, probe los ejemplos que el puso y me funciono a la primera, lo curioso es que los mismos ejemplos pero para las declaraciones de los pines que tenia antes no funciona... debe ser como dije y es posible que algun pin de los que utilizaba este dañado...desquiciado

Sin embargo ahora ya funciona bien... Sonrisa Gigante

Saludos a todos y gracias de Nuevo... Rebotado

Desconectado jorgeansuini

  • PIC18
  • ****
  • Mensajes: 340
RE: Glcd - Proton - TPG - no me funciona en la realidad...
« Respuesta #11 en: 12 de Diciembre de 2005, 18:17:00 »
Bueno Lord:

Me alegro que te haya funcionado .Seguramente puede haber algun pin fallado o un falso contacto en la conexion del display,ya que son muchos cables ,pero con el proton es bastante sencillo de hacer andar la pantalla.-

Saludos
Jorge

Desconectado LordLafebre

  • Moderador Global
  • DsPIC30
  • *****
  • Mensajes: 3529
    • Micros & micros
RE: Glcd - Proton - TPG - no me funciona en la realidad...
« Respuesta #12 en: 12 de Diciembre de 2005, 21:36:00 »
Hola:

Jorge pues ahora que veo los codigos y los comparo un poco esto esta diferente:

en tu codigo tienes esto:

GLCD_CS_INVERT On

y en el mio esto:

DECLARE GLCD_CS_INVERT OFF

segun la ayuda del proton dice lo siguiente:

DECLARE GLCD_CS_INVERT ON - OFF, 1 or 0
Some graphic LCD types have inverters on the CS lines. Which means that the LCD displays lefthand data on the right side, and vise-versa. The GLCD_CS_INVERT DECLARE, adjusts the library LCD handling subroutines to take this into account.


al parecer ese seria el problema.... voy a hacer unos pequeños cambios para ver si estoy en lo cierto... Sonrisa Gigante

Desconectado LordLafebre

  • Moderador Global
  • DsPIC30
  • *****
  • Mensajes: 3529
    • Micros & micros
RE: Glcd - Proton - TPG - no me funciona en la realidad...
« Respuesta #13 en: 12 de Diciembre de 2005, 21:59:00 »
Hola:

je je pues estaba en lo correcto.... en mi caso me sirve esta funcion:

GLCD_CS_INVERT ON

Con esto me funciona muy bien, por eso antes me salia solo en la mitad de la derecha y cuando utilizaba toda la pantalla para un grafico la imagen se destrozaba.... Sonrisa Gigante

Ahora si... Caso cerrado.

Nuevamente gracias amigos...Sonrisa Gigante

Desconectado dogflu66

  • Moderador Local
  • DsPIC30
  • *****
  • Mensajes: 3510
RE: Glcd - Proton - TPG - no me funciona en la realidad...
« Respuesta #14 en: 13 de Diciembre de 2005, 08:29:00 »
En mi lenguaje no tengo ningun comando o directiva equivalente, pero es bueno tenerlo en cuenta ya que si es un comando de configuracion de seguro que habra GLCDs en el mercado que trabajen con la logica de un lado o de otro en ese pin, por lo que sera bueno mirarlo en la hoja de caracteristicas del display en el caso de no poder conseguir uno de padre conocido… felicidades Gio. por el trabajo de investigacion... Giño

PD: NavidadMuchas risas
Saludos desde Granada, España.


 

anything