tacbanon,
Not sure why you want to run at 48 MHz clock rate, but here is a routine that I have used at 8 MHz on a 18F4550 (and I know it works) on my EasyPic6 with PBP v2.6.
Code:
'****************************************************************
'* Name : EasyPic_18F4550_DisplayDemo.pbp *
'* Author : John R. Ellis *
'* Date : 11/28/2009 *
'* Version : 1.0 *
'* Notes : Setup is for use on EasyPic6 development board *
'* : *
'* Device : 18F4550 installed in EasyPic6 *
'* Memory : 408 bytes of Program Memory required *
'* Ref: : *
'****************************************************************
Define OSC 8
;--- if you un-comment these, you must comment the ones in the .inc file--
ASM ; 18F2550/4550, 8mhz crystal
__CONFIG _CONFIG1L, _PLLDIV_2_1L & _CPUDIV_OSC1_PLL2_1L & _USBDIV_2_1L
__CONFIG _CONFIG1H, _FOSC_HSPLL_HS_1H
__CONFIG _CONFIG2L, _PWRT_ON_2L & _BOR_OFF_2L & _VREGEN_ON_2L
__CONFIG _CONFIG2H, _WDT_ON_2H & _WDTPS_512_2H
__CONFIG _CONFIG3H, _PBADEN_OFF_3H ; PortB resets as digital
__CONFIG _CONFIG4L, _LVP_OFF_4L & _XINST_OFF_4L
ENDASM
INCLUDE "ALLDIGITAL.pbp" ' Sets all registers for digital ops.
' User must make sure the AllDigital.pbp file
' is in same directory location as this source
' code before compiling.
'DEFINE SHOWDIGITAL 1 ' When uncommented will show analog settings
' in Assembler Results window.
' A/D & Comparators disabled for digital ops
' All of these statements should be commented out when using the
' INCLUDE "AllDigital.pbp" statement to set digital ops.
'ADCON1 = %00001111
'CMCON = 7
' Initialize Hardware
' -------------------
TRISA =%00000000
TRISB =%00000000
TRISC =%00000000
TRISD =%00000000
TRISE.0 = 0
TRISE.1 = 0
TRISE.2 = 0
INTCON2.7 = 0
'** DEFINE LCD Control Constants **
'====================================
L CON 254 ' Control Byte ($FE)
Clr CON 1 ' Clear the display
Line1 CON 128 ' Point to beginning of line 1 ($80)
Line2 CON 192 ' Point to beginning of line 2 ($C0)
' LCD DEFINES FOR USE WIH 2x16 LCD INSTALLED IN EASYPIC6
'=======================================================
DEFINE LCD_DREG PORTB ' Use PortB for LCD Data
DEFINE LCD_DBIT 0 ' Use lower(4) 4 bits of PortB
' PORTB.0 thru PORTB.3 connects to
' LCD DB4 thru LCD DB-7 respectively
DEFINE LCD_RSREG PORTB ' PORTB for RegisterSelect (RS) bit
DEFINE LCD_RSBIT 4 ' PORTB.4 pin for LCD's RS line
DEFINE LCD_EREG PORTB ' PORTB for Enable (E) bit
DEFINE LCD_EBIT 5 ' PORTB.5 pin for LCD's E line
DEFINE LCD_BITS 4 ' Using 4-bit bus
DEFINE LCD_LINES 2 ' Using 2 line Display
DEFINE LCD_COMMANDUS 2000 ' Command Delay (uS)
DEFINE LCD_DATAUS 200 ' Data Delay (uS)
'Main Loop
'=========
Main:
Pause 1000 ' Delay to let LCD start up
LCDOut L,CLR:Pause 50 ' Clear Display
LCDOut L,Line1+2," TEST " ' Display "TEST" on 1st line
PAUSE 500
LCDOut L,Line2+2,"..Power On.. !!" ' Display "Power on" on 2nd line
PAUSE 10000
Goto Main ' Continue loop
Bookmarks