I don't have a 16F716 to play with, but the following code works with an 18F 4580 running at 4mhz from its internal clock. LCD is on port B
Code:
ASM
__CONFIG _CONFIG1H, _OSC_IRCIO7_1H ; _OSC_HSPLL_1H
__CONFIG _CONFIG2L, _PWRT_ON_2L
__CONFIG _CONFIG2H, _WDT_ON_2H & _WDTPS_512_2H
__CONFIG _CONFIG3H, _PBADEN_OFF_3H
__CONFIG _CONFIG4L, _LVP_OFF_4L & _XINST_OFF_4L
ENDASM
DEFINE OSC 4
ADCON1 = $0F
clear
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
LCDOUT $FE,1:FLAGS=0:PAUSE 250:LCDOUT $FE,1:PAUSE 250 ' Initialize LCD
TRISA = %11111
TRISB = %00000000
butdn var porta.4
butup var porta.3
butmode var porta.2
bail2 var porta.0
bail3 var porta.1
clutch var portb.0
lcdrw var portb.2
c var word
c = 0
lcdrw = 0
pause 150
lcdout $fe,1
pause 500
Start: '************************************************************************ START
c = c + 1
lcdout $fe,1
lcdout $fe,$00,"This is a test ",DEC c
pause 500
if c > 100 then
c = 0
endif
GOTO start
I'm using an EasyPIC5 board which has the LCD wired as shown below
You could try breadboarding the circuit to confirm the code etc is working. If so then the issue may well be with your PCB
Bookmarks