Originally Posted by
gunayburak
Well ;
I did exactly as you asked me to do and as you say it's got to do with the lcd then ...
I don't have the same chip, but used an 18F4580 with a 2 x 16 LCD and just changed the lines to run the LCD from port B to suit the EasyPIC5 development board and I don't get any strange random pixels and I'm running the chip at 20Mhz so the switching is much faster, so it would suggest that it is your hardware that is at fault.
Code:
ASM
__CONFIG _CONFIG1H, _OSC_HS_1H
__CONFIG _CONFIG2L, _PWRT_ON_2L
__CONFIG _CONFIG2H, _WDT_ON_2H & _WDTPS_512_2H
__CONFIG _CONFIG3H, _MCLRE_ON_3H & _LPT1OSC_OFF_3H & _PBADEN_OFF_3H
__CONFIG _CONFIG4L, _LVP_OFF_4L & _XINST_OFF_4L
ENDASM
DEFINE OSC 20
DEFINE LCD_DREG PORTB ' LCD Data port
DEFINE LCD_DBIT 0 ' starting Data bit (0 or 4)
DEFINE LCD_EREG PORTB ' LCD Enable port
DEFINE LCD_EBIT 5 ' Enable bit (on EasyPIC 5 LCD)
DEFINE LCD_RSREG PORTB ' LCD Register Select port
DEFINE LCD_RSBIT 4 ' Register Select bit (on EasyPIC 5 LCD)
DEFINE LCD_BITS 4 ' LCD bus size (4 or 8 bits)
DEFINE LCD_LINES 4 ' number of lines on LCD
DEFINE LCD_COMMANDUS 2000 ' Command delay time in us
DEFINE LCD_DATAUS 50 ' Data delay time in us
'-------------------------------------------------------------------------------
PORTA=%00000000 : PORTB=%00000000
TRISA=%00000000 : TRISB=%00000000
'ADCON0=%00000001 : ADCON1=%10110000
'ANSELA=%00000 : ANSELB=%00000000
'OPTION_REG.7=0
'-------------------------------------------------------------------------------
pause 500
lcdout $FE,$28
lcdout $FE,$17
lcdout $FE,$06
lcdout $FE,$08
lcdout $FE,$01
lcdout $FE,$02
lcdout $FE,$0C
MAIN:
lcdout $FE,$80,"BU BiR DENEMEDiR"
LCDOUT $FE,$C0," iKiNCi SATIR "
goto main
Replaced the 20Mhz with a 4Mhz xtal and recoded and the display was fine.
Bookmarks