Hello Luciano,
Thanks, Pal. Now it works. And I've learnt something new.
Best greetings,
Rob
Hello Luciano,
Thanks, Pal. Now it works. And I've learnt something new.
Best greetings,
Rob
Last edited by boboco; - 21st January 2006 at 14:15.
i two have purchased an lcd that uses a k0007b criver chip i tried you example of initalising the display manualy not notheing hear is my code can some one check it for me please.
'************************************************* ***************
'* Name : LCD template.BAS *
'* Author : John Hodgkiss *
'* Notice : Copyright (c) 2007 John Hodgkiss *
'* : All Rights Reserved *
'* Date : 17/03/2007 *
'* Version : 1.0 *
'* Notes : *
'* : *
'************************************************* ****************
'Template program for LCD useing a K0007b driver chip
'KS0070b Initialization
'2x16 LCD (KS0070b)
'4 bit mode
'2 lines
'Display=on
'Cursor=off
'Blink=off
'Increment mode
'Entire shif=off
start:
'Power on
'set variables
output portA
Db7 var byte
Db6 var byte
Db5 var byte
Db4 var byte
RS var byte
E var byte
PauseA var byte
PauseC var byte
'set constants
PauseA = 10 ' 100us
PauseC = 200 ' 2ms
'define
DEFINE LCD_DREG PORTA 'LCD data port
DEFINE LCD_DBIT 0 'LCD data starting bit 0 or 4
DEFINE LCD_RSREG PORTA 'LCD register select port
DEFINE LCD_RSBIT 5 'LCD register select bit
DEFINE LCD_EREG PORTA 'LCD enable port
DEFINE LCD_EBIT 4 'LCD enable bit
DEFINE LCD_BITS 4 'LCD bus size 4 or 8
DEFINE LCD_LINES 2 'Number lines on LCD
DEFINE LCD_COMMANDUS 2000 'Command delay time in us
DEFINE LCD_DATAUS 50 'Data delay time in us
pause 400 'pause for 40ms for lcd to start up
'set pins
Db7 = portA.3
Db6 = portA.2
Db5 = portA.1
Db4 = portA.0
RS = portA.4
E = PortB.3
output portA
Output portB
portA = low
PortB = low
setup:
DB7 = 0
DB6 = 0
DB5 = 1
DB4 = 0
'Toggle the Enable line:
PULSOUT E, 100
pause PauseA
E = low
DB7 = 0
DB6 = 0
DB5 = 1
DB4 = 0
'Toggle the Enable line:
PULSOUT E, 100
pause PauseA
E = low
'set 2 lines 5x7 dots
DB7 = 1
DB6 = 0
DB5 = 0
DB4 = 0
'Toggle the Enable line:
PULSOUT E, 100
pause PauseA
E = low
pause PauseA 'pause 100us
'turn display On/Off control
DB7 = 0
DB6 = 0
DB5 = 0
DB4 = 0
'Toggle the Enable line:
PULSOUT E, 100
pause PauseA
E = low
'Display cursor off, blink off
DB7 = 1
DB6 = 1
DB5 = 1
DB4 = 1
'Toggle the Enable line:
PULSOUT E, 100
pause PauseA
E = low
pause 10 ' wait 100us
'clear display
DB7 = 0
DB6 = 0
DB5 = 1
DB4 = 0
'Toggle the Enable line:
PULSOUT E, 100
pause PauseA
E = low
DB7 = 0
DB6 = 0
DB5 = 0
DB4 = 1
'Toggle the Enable line:
PULSOUT E, 100
pause PauseA
E = low
pause PauseC 'pause 2ms
'Entry mode
DB7 = 0
DB6 = 0
DB5 = 0
DB4 = 0
'Toggle the Enable line:
PULSOUT E, 100
pause PauseA
E = low
DB7 = 0
DB6 = 1
DB5 = 1
DB4 = 0
'Toggle the Enable line:
PULSOUT E, 100
pause PauseA
E = low
pause pauseC
loop:
Lcdout $fe, 1 ' Clear LCD screen
Lcdout "Hello" ' Display Hello
Pause 500 ' Wait .5 second
Lcdout $fe, 1 ' Clear LCD screen
Lcdout "World"
Pause 500 ' Wait .5 second
Goto loop ' Do it forever
is this correct??
the dispaly does light up but thats it
here is a link to the displays pdf file
http://www.maplin.co.uk/Media/PDFs/N27AZ.pdf
hi there again i have been up all night trying to get this thing working no luck can some one please have a lok at my code or does anyone know where a example piece of code is. please iam desperate
not a expert but my problems has always been with using a higher speed osc
and not reseting lcd_dataus to match the crystal more delay for higher speeds just a thought
when i have a problem with the lcd display
it has been the fact that i use a 20 osc
and what works for me is to change line
define lcd_dataus 50
to
define lcd_dataus 200
it just works for me
hi there thanks for the reply.
how do you know your lcd is in working order, i have ready that if you just provide power to it you should see black boxes is this true. i tried this and all i get is the backlighting up but no boxes.
Which compiler are you using? 'cause if that code above is PicBasicPro, you really, really need to get reading the PBP manual and learn it.
You don't have any Black boxes????
Or your contrast POT is crap, or you didn't installed it correctly.. or you forgot. ANY character LCD i know, once connected will produce those Black boxes.
R/W pin is left floating in the air... must be tied to gnd
Some LCD brand may need to tie unused DB<4:0> to Vss or Vdd... have a look to the datasheet
Steve
It's not a bug, it's a random feature.
There's no problem, only learning opportunities.
Bookmarks