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