Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

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

  • IMG_9679.jpg
    IMG_9679.jpg
    45.3 KB · Views: 212
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.
 
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

  • c18lcd.c
    5.4 KB · Views: 271
  • c18lcd.zip
    930 bytes · Views: 117
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?
 
the osc is not set to come on at full speed
 
Last edited:
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"
 
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.
 
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.
 
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.

Latest threads

New Articles From Microcontroller Tips

Back
Top