Hi,
I have been trying to figure this out for a couple of days now but no luck.
I am using 16F627A
At first I was using the internal osc with _INTOSC_OSC_NOCLKOUT and I was using the commented section bellow (Daryl's LCD_AnyPin) and I had DEFINE OSC 8 as any other value gave me a blank LCD.
This setup displayed information well on the LCD but at the bottom of my code I have a PAUSE 5000 which I expected the second line to go blank after 5 seconds however it went blank after about 10 secs.
I then added an 4 MHz external resonator, changed the fuse as bellow and tried different values for OSC but same results.
So I restored my pbppic14.lib to its original value commented the LCD_AnyPin section and added the standard way as bellow but now I am just getting question marks on the LCD.
So I guess I have 2 questions;
1 -Why did I get the wrong timing in my first setup?
2 - Why the standard way for LCD is not working whisle LCD_AnyPin did?
If anyone can make my day, that would be great.
Thanks
Mike
Code:
@ __config _XT_OSC & _WDT_OFF & _MCLRE_ON & _LVP_OFF & _CP_OFF
DEFINE OSC 4
TRISB = 0 ' Make PORTB all outputs
CMCON = 7 ' Disable comparator
'- - - - LCD_AnyPin.pbp - - - - - - - - - - - - - - - - - -
'LCD_DB4 VAR PORTB.0 ' Set port for 4 bits bus
'LCD_DB5 VAR PORTB.1
'LCD_DB6 VAR PORTB.2
'LCD_DB7 VAR PORTB.3
'LCD_RS VAR PORTB.5 ' Set RS bit port
'LCD_E VAR PORTB.4 ' Set Enable bit port
'LCD_Lines CON 2 ' # of Lines on LCD, 1 or 2 (Note: use 2 for 4 lines)
'LCD_DATAUS CON 50 ' Data delay time in us
'LCD_COMMANDUS CON 2000 ' Command delay time in us
'INCLUDE "LCD_AnyPin.pbp" ' Must go after LCD initialization
'- - - - Standard - - - - - - - - - - - - - - - - - -
define LCD_DREG PORTB ' Define LCD Data Port
Define LCD_DBIT 0 ' Set starting data bit (0 or 4)
Define LCD_RSREG PORTB ' Set Register Select port
Define LCD_RSBIT 5 ' Set RS bit
Define LCD_EREG PORTB ' Set Enable port
Define LCD_EBIT 4 ' Set E bit
Define LCD_BITS 4 ' Set bus size
Define LCD_LINES 2 ' Set number of lines on LCD
Define LCD_COMMANDUS 2000 ' Set command delay time
Define LCD_DATAUS 50 ' Set data delay time
'- - - - start of program - - - - - - - - - - - - - - - - - -
LCDOUT $FE,1 ' clear screen
LCDOUT $FE,$80,"LCD Prototype MJ"
' Use $Fe,$C0 to address the second line
LCDOUT $FE,$C0,"Timer testing"
pause 5000
LCDOUT $FE,$C0," "
Start: ' Program starts here
goto start
end
Bookmarks