GCLD KS0108 and proteus VSIM

Coding and general discussion relating to the compiler

Moderators: David Barker, Jerry Messina

Post Reply
sergio
Registered User
Registered User
Posts: 24
Joined: Mon Mar 30, 2009 5:37 pm
Location: Sao Paulo / Brazil

GCLD KS0108 and proteus VSIM

Post by sergio » Thu Apr 23, 2009 12:41 am

Hi Guys,

finally I got my full version of SwordFish !

Now, I´m trying to build another version of my "on board computer" for my Opel Corsa using a GLCD.

Image

I did some tests with Proteus 7 using the following code, to initiate my tests :

Code: Select all

// if device and clock are omitted, then the compiler defaults to 
// 18F452 @ 20MHz - they are just used here for clarity...
Device = 18F452
Clock = 20

#Option GLCD_SCREEN_WIDTH = 128
#Option GLCD_SCREEN_HEIGHT = 64
#Option GLCD_DATA          = PORTD
#Option GLCD_RS            = PORTB.2
#Option GLCD_CS1           = PORTB.1
#Option GLCD_CS2           = PORTB.0
#Option GLCD_RW            = PORTB.3
#Option GLCD_EN            = PORTB.4
#Option GLCD_RST           = PORTB.5
#Option GLCD_INIT_DELAY    = 100
#option GLCD_INVERT_CS     = FALSE
#option GLCD_MODEL         = KS0108 

Include "GLCD.bas"
Include "FixedFont.bas"
Include "Arial.bas"
Include "Garamond.bas"
Include "Tahoma.bas"
Include "Verdana.bas"
Include "Times.bas"
ADCON1 = $07 // PORTE as digital (GLCD)

GLCD.Cls	
GLCD.SetFont(Fixed)
GLCD.WriteAt(6,2,"System Font")
but I got just a strange picture, like this :

Image

did some one got the same error or, did some one know where the problem is ?

I tryied some other GLCD models in proteus, but the results were the same.

In My second try , i reduced the clck speed to 10 Mhz, and the code :

Code: Select all

// if device and clock are omitted, then the compiler defaults to 
// 18F452 @ 20MHz - they are just used here for clarity...
device = 18F452
clock = 20

#Option GLCD_SCREEN_WIDTH = 128
#Option GLCD_SCREEN_HEIGHT = 64
#Option GLCD_DATA          = PORTD
#Option GLCD_RS            = PORTB.2
#Option GLCD_CS1           = PORTB.1
#Option GLCD_CS2           = PORTB.0
#Option GLCD_RW            = PORTB.3
#Option GLCD_EN            = PORTB.4
#Option GLCD_RST           = PORTB.5
#Option GLCD_INIT_DELAY    = 100
#option GLCD_INVERT_CS     = FALSE
#option GLCD_MODEL         = KS0108 


include "GLCD.bas"
include "FixedFont.bas"
include "Arial.bas"
include "Garamond.bas"
include "Tahoma.bas"
include "Verdana.bas"
include "Times.bas"
ADCON1 = $07 // PORTE as digital (GLCD)

GLCD.Cls	
GLCD.SetFont(Fixed)
GLCD.WriteAt(4,2,"System Font")
GLCD.SetFont(ArialBold)
GLCD.WriteAt(4,10,"Arial Font")
GLCD.SetFont(GaramondBold)
GLCD.WriteAt(4,20,"Garamond Font")
GLCD.SetFont(TahomaBold)
GLCD.WriteAt(4,30,"Tahoma Font")
GLCD.SetFont(VerdanaBold)
GLCD.WriteAt(4,40,"Verdana Font")
GLCD.SetFont(TimesNewRomanBold)
GLCD.WriteAt(4,50,"Times New Roman")

and I got :


Image


Any idea ?

Thank you in advance.

Regards

Sérgio

sergio
Registered User
Registered User
Posts: 24
Joined: Mon Mar 30, 2009 5:37 pm
Location: Sao Paulo / Brazil

Fixed !

Post by sergio » Thu Apr 23, 2009 5:03 pm

Hy guys !

well.... the problem has been fixed !

Wiring problems...

look :

Image

Now...

I will start working with the interrupts.

I need :

1) A Constant Time interrupt, let´s say : 500 ms (Timer2) ? ? ?
2) Read the speed sensor (8 pulses / meter) (Timer0)
3) Read the gasoline injector "On-Time" (CCP1 / Timer1)
4) Read the RPM (CCP2)

I know I will have to re-wire the circuit in order to use the interrupt / Timers / CCP pins.

I´m reading the following article :

http://digital-diy.com/swordfish/77-swo ... sking.html

Is this a good start point ? What do you think ?

Any suggestion ?

My best regards !

Sérgio

gramo
Registered User
Registered User
Posts: 200
Joined: Tue Mar 20, 2007 6:55 am
Location: Australia
Contact:

Post by gramo » Fri Apr 24, 2009 8:16 am

It's a pretty big slurp of a program to take in - If you have any issues with it then drop a comment on the page below the article :wink:
digital-diy.com - Hobby microcontroller projects and tutorials. Assembly, PICBasic and C examples.

Australian distributor for the Swordfish Compiler

sergio
Registered User
Registered User
Posts: 24
Joined: Mon Mar 30, 2009 5:37 pm
Location: Sao Paulo / Brazil

Thank You !

Post by sergio » Fri Apr 24, 2009 1:12 pm

Thank You Friend !

I´m starting my tests today and I will keep you posted !

regards


Sérgio

Roshan
Registered User
Registered User
Posts: 42
Joined: Tue Mar 03, 2009 3:08 pm
Location: India

Post by Roshan » Sat Apr 25, 2009 6:26 am

Hi !

which type of wiring problem?

I see in your sch, in final circuit you have remove vcc from pin 4 & connect it to pin 17.

Regards

Roshan
ROSHAN

sergio
Registered User
Registered User
Posts: 24
Joined: Mon Mar 30, 2009 5:37 pm
Location: Sao Paulo / Brazil

Post by sergio » Sat Apr 25, 2009 8:32 pm

Hi Rishan,

actually, the LCD model has been changed : In my first test, I was using the LGM12641BS1R.

Now, the model is the Ampire 128x64...

Roshan
Registered User
Registered User
Posts: 42
Joined: Tue Mar 03, 2009 3:08 pm
Location: India

Post by Roshan » Sun Apr 26, 2009 4:52 am

Dear Sérgio,

Thanks for reply, but my name is Roshan not Rishan.

BTW what is the meaning of my name in your Brazil ? :D

:lol: It may be only typing mistake.

Regards
ROSHAN

Roshan
Registered User
Registered User
Posts: 42
Joined: Tue Mar 03, 2009 3:08 pm
Location: India

Post by Roshan » Wed May 27, 2009 2:54 pm

Dear Sirgio,

Today i comile your program & simulate it on isis. I also use ampire glcd but program does not run on 20mhz.

I reduce frequency to 4 mhz then only fixedfont works. Other fonts problem are same as you mentioned above.

Will you pls. send me your working code with isis file ? Or if you have any idea to remove my problem .

Regards
ROSHAN

sergio
Registered User
Registered User
Posts: 24
Joined: Mon Mar 30, 2009 5:37 pm
Location: Sao Paulo / Brazil

Post by sergio » Wed May 27, 2009 4:31 pm

Hi Roshan,

I´m at woek right now. I don´t have my personal files here.

But, my code is exactly the same showed in this topic.

You need to reduce the Pic's clock speed not only in your code, but in the proteus too.
To do that, choose the properties option in the PIC and reduce the speed to 10 Mhz.

Try that and, please, post the results here. I have already searched the intern about that problem without success.

The company where I work started a new big project (remember... electronics is just my hobby) and I'm amazingly busy these days.

All my personal projects were stopped due the lack of time.

Roshan
Registered User
Registered User
Posts: 42
Joined: Tue Mar 03, 2009 3:08 pm
Location: India

Post by Roshan » Thu May 28, 2009 7:11 am

Dear Sergio

Thanks for reply. I reduce clock speed both side.(isis & sf). Only fixed font works & other fonts problem are same.

I tring to solve problem. If i got sucess then i will inform you.

Regards
ROSHAN

TimB
Posts: 262
Joined: Wed Oct 04, 2006 7:25 am
Location: London UK

Post by TimB » Mon Jun 01, 2009 9:04 am

You can also increase the clock speed of the GLCD this I have found in the past helps at higher speeds.

Its a matter of playing around with it to see what values work best

Roshan
Registered User
Registered User
Posts: 42
Joined: Tue Mar 03, 2009 3:08 pm
Location: India

Post by Roshan » Mon Jun 01, 2009 1:43 pm

Hi TimB !

Problem solved.

Thanks for help.

Regards
ROSHAN

Mast
Posts: 65
Joined: Wed Aug 29, 2007 6:24 am
Location: France

Post by Mast » Wed Sep 23, 2009 6:39 am

The problem is not solved. What's solution Roshan

Post Reply