# LCD - at last!

Status
Not open for further replies.

#### edeca

##### Active Member
Not a very enlightening post but I have finally got an LCD working! This uses the example code from Swordfish Basic which seems very good. After all my trouble with the previous LCD I bought a new one from Futurlec and it worked within 5 minutes.

Now to try with my old LCD and the ASM I wrote myself, just to see what might have been wrong. Thanks to all for the help in my previous thread on this.

#### Attachments

• 45.3 KB Views: 120

#### blueroomelectronics

##### Well-Known Member
And Hello World to you. Swordfish is pretty awesome.

#### edeca

##### Active Member
And Hello World to you. Swordfish is pretty awesome.
Yes, it is. It does take a few seconds from power-on to LCD initialisation (even in Oshonsoft), I'm assuming that is normal?

The bar graph demo is quite slow to change too, I haven't checked the code yet.

I have swapped out my old LCD and it is definitely broken. Nice to know my code wasn't faulty all along! But actually, the fact it took me ages means I spent more time reading datasheets.

#### edeca

##### Active Member
Perhaps it's just the way the Swordfish compiler/library works. The code I wrote in C (attached) lights up almost instantly as it only waits for 150ms.

However, the code I wrote does not simulate correctly in Oshonsoft, it prints weird characters to the display. "Good morning" is interpreted as " @p". I guess timing issues possibly?

So I can write off about 2 days of my life due to a dodgy LCD, what I was doing had actually been correct all along

#### Attachments

• 5.4 KB Views: 186
• 930 bytes Views: 46

#### blueroomelectronics

##### Well-Known Member
It should only need about 100ms.

#### edeca

##### Active Member
Yep. My delay is 150ms and the text comes up pretty instantly (the code isn't perfect, init can be dodgy, but does work).

The Swordfish example code takes around 34 seconds to initialise the display (when both lines are on) and 45 to display text. That seems like a long time?

#### blueroomelectronics

##### Well-Known Member
Something is wrong. It should be very fast.

#### be80be

##### Well-Known Member
the osc is not set to come on at full speed

Last edited:

#### be80be

##### Well-Known Member
I did the lcd with swordfish and it like it starts up slow it was osc not coming on at full speed you want the osc at full speed before it loads modules for the lcd if that how your doing it. so now i make a module for my osc settings like this
Code:
Device = 18F1220
Clock = 8
Config OSC = INTIO2
Config MCLRE = OFF
Include "INTOSC8.bas"
Include "Utils.bas"

#### blueroomelectronics

##### Well-Known Member
That's probably it.
You can also use

OSCCON = $72 #### be80be ##### Well-Known Member That works to but it easy to put it in the wrong place after the modules so I just make a osc module for what chips I use. spency digg.net dose it like that to.That's how I found out about the modules loading first I was using five modules and the osc didn't go to full speed till it get's done with reading the code from the module I used. If i had not gone to get some water I would have not seen the lcd come on. #### Pommie ##### Well-Known Member Most Helpful Member I have a module called init that just contains, Code: Module init OSCCON=$70`
I include this before any other modules (but after the include 18f1320.bas) to get around this problem.

Mike.

#### edeca

##### Active Member
Thanks all. It's quite amazing that the LCD code still works then, as it's set for 8Mhz delays.

Cheers for all the help, time to play with displaying random things on the screen just because I can!

Status
Not open for further replies.