Page 1 of 1

Lcd Problem - I think its the Initialize

Posted: Thu Aug 14, 2008 4:26 am
by RobertM
Hello all,
I tryed using the LCD.bas file as shown on several other topics ( Example: http://www.sfcompiler.co.uk/forum/viewt ... hlight=lcd) That did help me find out why it was taking so long for my code to run :) But now I think it has to do with an Initialize problem. I have the LCD up and running on a Rabbit 1800 board (single board computer) so I know the lcd works (Using 4pin, RS, E). My code on the Rabbit Looks like this:

Code: Select all

Nibble(2); //Set 4bit mode
Delay(100) //US
WriteByte ( '\B00101100' ); //4bit/lines/pixels
WriteByte ( '\B00001110' );//Turn on display and cursos non-blinking
WriteByte ( '\B00000110' );////inc address and shift cursos with each char write
I tryied playing around with the LCD.bas to change the Initialize but atlast I am too new to Swordfish basic to understand fully what is going on in the function. Any help would be great! For my code in Swordfish (Copied pretty much from another post):

Code: Select all

Device = 18F1320
Clock = 8

#option LCD_DATA = PORTB.4
#option LCD_RS = PORTB.3
#option LCD_EN = PORTB.2
#option LCD_DATA_US = 200

// import LCD library...
Include "io.bas"
Include "LCD.bas" 
Include "utils.bas"

Const UpdateMS = 50

LCD.Cls 
WriteAt(1,1,"Hello World")  
While true
    Toggle(PORTB.0)
    DelayMS(500)
Wend

//Also copied from another forum post or two
Module IO 
'Set clock source to internal oscillator, I/O on RA6 & RA7 
config osc = INTIO2
Config MCLRE = OFF 
ADCON1 = $7F
OSCCON = %01110110
I do have a led hooked up to PORTB.0 and it does blink; good idea from the other forum post by someone. The LCD uses "SPLC780D" pretty much the same as a HD44780. Once again thanks for any help.

Posted: Thu Aug 14, 2008 2:52 pm
by Doj
Hello, looks ok to me, do not use these displays so no test I am afraid.
Can you post a diagram of the hardware.
Do you have R/W tied to ground?.
Can you scope the pins to see if they are switching.

Posted: Thu Aug 14, 2008 11:40 pm
by RobertM
Scope is on my list of things I really do need to buy :), but I took the cheap man's method and wired some low volt leds to the 4 pins. The led's quicky flash before it enter the blink led loop. So, from this I can say the pins are switching. I did find out the one display (I have two) uses the KS0066U and I know I seen on another post that it has differante init setup. R/W and DB0-DB4 are all tied to ground. I just tried to make a diagram with diptrace at it doesn't have the parts I am using :).