PDA

View Full Version : 4 line LCD with 16F88



anj
- 7th February 2004, 04:10
Gday All
Ive just got a 16F88 and PBPro 2.43 ( awaiting 2.44 ).
I have previously been mucking around with a 16F876 and PBP2.42
On compiling a simple program to output "hello" to my LCD, i cant get it to work on a 4Line LCD with the 16F88.
I have run the program through both the 16F876 and 16F88, and it works on the 876 no probs ( with a 2x16 and the 4x20 LCD ), but only on the 2x16 with the 16F88.
( 4 Line LCD is a Seiko L2034 B1J000 )
I have downloaded the update patch for the 87/88 chips and i can flash leds etc no probs, so i know its programming OK, I just cant get it to start up the 4 line LCD.
Reading the specs on the LCDs, they both appear to have identical initialisation routines an i am allowing a second at startup for this to occur
Any ideas?

Using PBP2.43 + 87/88 patch
Mecanique MicroCode Studio 2.1.0.6 front end
OSHON V1.4 programmer software
Tait classic parallel programmer ( RB3 tied low whilst programming )
config word1 3F65
LCD is 4 data bits on RB4-RB7, RS on RB3 and E on RB2

Andrew

anj
- 7th February 2004, 09:06
Gday All
Well i now have my 4 line LCD working, but now dont know why.
( And that hurts more )
I tried using a 16F84a as well as the prior chips and this also worked perfectly with both LCDs, it was still only the 16F88 with the 4 line LCD that failed
After several hours of frustration, i was grabbing at straws, so tried to forcibly reset the ANSEL register to 31 ( for the 16F88 chip ) and everything started working.
All this does is set RB6 and RB7 to digital, and hence should have no effect that is different between LCDs, but it does.
My test code is
--------------------------------
INCLUDE "modedefs.bas"
Voltage VAR WORD

DEFINE LCD_DREG PORTB ' Setup LCD 2x20 in 4 byte mode
DEFINE LCD_DBIT 4 ' R/S on B.3, E on B.2
DEFINE LCD_RSREG PORTB ' Data on B.4 - B.7
DEFINE LCD_RSBIT 3
DEFINE LCD_EREG PORTB
DEFINE LCD_EBIT 2
DEFINE LCD_BITS 4
DEFINE LCD_LINES 4 '4 line lcd mode ( but 2x16 works just as well???? )
DEFINE OSC 4 '
ANSEL = 31 ' force RB6 and RB7 digital (16F88 only)
Pause 1000 ' Wait 1 second
Voltage = 0
Lcdout $fe, 1 ' Clear LCD screen
loop
Lcdout $fe, $C0, "Testing ", DEC Voltage, " "
voltage = voltage + 1
pause 1000
goto loop
end
---------------------
I can get it to work, but dont know why.
Is there a bug in the 16F88 preprocessing, or is something else happening, because i cannot figure it out now.
Andrew