I use a 4 Mhz crystal as osc. and I use PORTB as output, this is what my code looks like, I have included the library for LCD in the txt file:
LIST p=18F458 ;tell assembler what chip we are using
include "p18f458.inc" ;include the defaults for the chip
ERRORLEVEL 0, -302 ;suppress bank selection messages
cblock 0x20 ;start of general purpose registers
;LCD
count ;used in looping routines
count1 ;used in delay routine
counta ;used in delay routine
countb ;used in delay routine
tmp1 ;temporary storage
tmp2 templcd ;temp store for 4 bit mode
templcd2
endc
LCD_PORT Equ PORTB
LCD_TRIS Equ TRISB
LCD_RS Equ 0x04
LCD_RW Equ 0x06
LCD_E Equ 0x07
;--------Program-------------------
SetPorts
movlw 0x00 ;make all pins outputs
movwf LCD_TRIS ;wait for LCD to settle
call Delay100
call LCD_Init ;setup LCD
call LCD_CurOff
ld
call LCD_Line1
movlw 'H'
call LCD_Char
movlw 'e'
call LCD_Char
movlw 'l'
call LCD_Char
movlw 'l'
call LCD_Char
movlw 'o'
call LCD_Char
movlw ' '
call LCD_Char
movlw 'W'
call LCD_Char
movlw 'o'
call LCD_Char
movlw 'r'
call LCD_Char
movlw 'l'
call LCD_Char
movlw 'd'
call LCD_Char
movlw '!'
call LCD_Char
movlw '!'
call LCD_Char
movlw '!'
call LCD_Char
endprg goto endprg
include <lcd.lib>
;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
end
Bookmarks