GLCD Graphic LCD - Using Swordfish Basic

Post here to let others know of a project you're working on.

Moderators: Chuckt, Garth, bitfogav

User avatar
bitfogav
Moderator
Moderator
Posts: 915
Joined: Sun Mar 28, 2010 9:03 pm
Location: United Kingdom
Contact:

Re: GLCD Graphic LCD - Using Swordfish Basic

Post by bitfogav » Mon May 16, 2011 3:08 am

HaHaa!! :D :D i like it!!..

User avatar
odessa
I practically live here!
I practically live here!
Posts: 102
Joined: Thu Sep 09, 2010 6:06 am
Location: London
[phpBB Debug] PHP Warning: in file [ROOT]/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1266: count(): Parameter must be an array or an object that implements Countable

Re: GLCD Graphic LCD - Using Swordfish Basic

Post by odessa » Mon May 16, 2011 3:09 am

Hi Gav,

I'm using Mikrobasic for this project, if it helps heres the code...very similar to swordfish

Code: Select all

program Glcd_Test

' Glcd module connections
dim GLCD_DataPort as byte at PORTD

dim GLCD_CS1 as sbit at LATB1_bit  ' for writing to output pin always use latch (PIC18 family)
    GLCD_CS2 as sbit at LATB0_bit  ' for writing to output pin always use latch (PIC18 family)
    GLCD_RS  as sbit at LATB2_bit  ' for writing to output pin always use latch (PIC18 family)
    GLCD_RW  as sbit at LATB3_bit  ' for writing to output pin always use latch (PIC18 family)
    GLCD_EN  as sbit at LATB4_bit  ' for writing to output pin always use latch (PIC18 family)
    GLCD_RST as sbit at LATB5_bit  ' for writing to output pin always use latch (PIC18 family)

dim GLCD_CS1_Direction as sbit at TRISB1_bit
    GLCD_CS2_Direction as sbit at TRISB0_bit
    GLCD_RS_Direction  as sbit at TRISB2_bit
    GLCD_RW_Direction  as sbit at TRISB3_bit
    GLCD_EN_Direction  as sbit at TRISB4_bit
    GLCD_RST_Direction as sbit at TRISB5_bit
' End Glcd module connections

sub procedure Delay2S()                    ' 2 seconds delay sub function
  Delay_ms(2000)
end sub

main:
  CMCON  = CMCON or 0x07                   ' turn off comparators
  ADCON1 = ADCON1 or 0x0F                  ' turn off analog inputs

  Glcd_Init()                              ' Initialize Glcd
  Glcd_Fill(0x00)                          ' Clear Glcd

  while TRUE
    Glcd_Image(@cat_bmp)                            ' Draw image
    Delay2s() Delay2s()
    Glcd_fill(0x00)                                   ' Clear GLCD
    Glcd_Image(@brads_bmp)                            ' Draw image
    Delay2s() Delay2s()
    Glcd_fill(0x00)                                   ' Clear GLCD

  wend
end.
And bitmaps are handled like this

Code: Select all

module Bitmap
 ' ------------------------------------------------------
' GLCD Picture name: Bifogav.bmp
' GLCD Model: KS0108 128x64
' ------------------------------------------------------

const brads_bmp as byte[1024] = (
255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 241, 240, 240, 112,  16,   0,   0,   0, 192, 240, 240, 240, 240, 224,   1,   1,   3,   7, 255, 255, 255, 255,  31,  15,  15,  15,  31, 255, 255, 255, 255, 255,  63,  31,  31,  31, 255, 255, 255, 255, 255, 255, 255, 255,  63,   7,   3,   1, 129, 224, 240, 240, 240, 240, 240, 248, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,  63,  15,   1,   0,   0, 192, 192, 194, 195, 195, 131, 131,   1,  16,  56, 120, 252, 255, 255, 255,  31,   7,   3,   2, 226, 254, 255, 231, 227,   3,   3,   0,   0, 192, 224, 226, 227, 243, 199, 195, 195,   3,   3,   0,   0, 192, 192, 194, 195, 195,  67,   7,  15,   7,   7, 131, 195, 195, 131,   3,   7,  15,  31, 255, 255,  63,  15,   7,   7, 131, 195, 195, 195,   3,   7,   3,   3, 227, 255, 127,  31,  15,   7,   7, 131, 195, 195, 195,   7,   7,   3,   3, 227, 255, 255,  31,   3,   3,   3, 255, 127,  63,  15,   7,   3, 195, 227, 255, 255,
255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,  63,   7,   1,   0,   0, 224, 248, 255, 255, 255, 127, 127,  63,  31,  15,   0,   0, 128, 224, 255, 255, 199, 128, 128, 128, 128, 135, 135, 199, 255, 199, 128, 128, 128, 128, 135, 135, 135, 207, 255, 127,  15,   3,   0, 128, 224, 248, 255, 255, 255, 255, 255, 255, 240, 192, 128, 128, 135, 135, 135, 135, 131, 192, 224, 240, 124, 127,  96,  64,   0,   0,   7,  71,   7,   3,   0,   0,  96, 124, 127, 127, 255, 224, 192, 128, 128, 135, 135, 135, 195, 192, 128, 128, 132, 135, 135, 199, 255, 192, 128, 128, 128, 192, 224, 240, 252, 254, 255, 255, 255, 255, 255,
255,  15,   7,   3,   1,   1, 224, 240, 240, 240, 240, 240, 112,  16,   0,   0,   0, 128, 224, 240, 240, 240, 240, 240, 240, 240, 240, 248, 248, 252, 252, 254, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,  31,   7,   1,   0, 128, 240, 252, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,   7,   1,   0,   0,  48, 120, 120,  56,  24,   8,   0,   0, 128, 224, 248, 248, 248, 248, 248, 252, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
255, 254, 248, 240, 240, 224, 224, 225, 225, 225, 224, 240, 240, 248, 248, 252, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 248, 248, 248, 252, 254, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 254, 252, 248, 248, 248, 248, 248, 248, 252, 254, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255
)

implements


end.
LOL, sorry I spelled your name 'bifo' in the code
(\_/)
(='.')
(")-(")
This is a bunny, copy bunny into your signature to help him achieve world domination.

User avatar
bitfogav
Moderator
Moderator
Posts: 915
Joined: Sun Mar 28, 2010 9:03 pm
Location: United Kingdom
Contact:

Re: GLCD Graphic LCD - Using Swordfish Basic

Post by bitfogav » Mon May 16, 2011 3:16 am

Thanks for posting that Jay, ill have a look at it and see if I can transfer it into Swordfish code :) very cool thou!!

heres what ive been doing :)

https://youtu.be/NxMGafP_mWI

User avatar
odessa
I practically live here!
I practically live here!
Posts: 102
Joined: Thu Sep 09, 2010 6:06 am
Location: London
[phpBB Debug] PHP Warning: in file [ROOT]/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1266: count(): Parameter must be an array or an object that implements Countable

Re: GLCD Graphic LCD - Using Swordfish Basic

Post by odessa » Mon May 16, 2011 3:23 am

ace :D

I can see a game coming on here lol ... wheres Brad when you need a retro project game :)

Take a look at the Mikrobasic stuff Gav, its unreal how far advanced it is regards the amount of tools that come with it.

I have 3 packages now lol ... still at least they all have similar syntax though.

Jay
(\_/)
(='.')
(")-(")
This is a bunny, copy bunny into your signature to help him achieve world domination.

User avatar
brad
Site Admin
Site Admin
Posts: 2578
Joined: Fri Mar 26, 2010 10:30 pm
[phpBB Debug] PHP Warning: in file [ROOT]/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1266: count(): Parameter must be an array or an object that implements Countable

Re: GLCD Graphic LCD - Using Swordfish Basic

Post by brad » Mon May 16, 2011 10:04 am

Well I woke up this morning to see you guys going absolutely crazy with these GLCD's!

I'm very impressed and if I didn't have loads of other projects on the back-burner, i'd be jumping straight into one of these.

I can certainly see a new video game system down the line somewhere with one of these displays.

How do you find the refresh rate? is it a little flickery, or does it have ghosting?

User avatar
bitfogav
Moderator
Moderator
Posts: 915
Joined: Sun Mar 28, 2010 9:03 pm
Location: United Kingdom
Contact:

Re: GLCD Graphic LCD - Using Swordfish Basic

Post by bitfogav » Mon May 16, 2011 7:34 pm

brad wrote:How do you find the refresh rate? is it a little flickery, or does it have ghosting?
The refresh rate is slightly poor if you are using it to drawing graphics such has the ball moving around the screen fast, the screen is flickery, especially if you constantly clear the screen after every frame.

So I come up with a different approach - instead of constantly clearing the display I just cleared the pixels of the previous position of the ball/paddle, this saves constantly updating all the data on the display, I still got a little ghosting though on the ball but I think this gives the ball a good effect as it travels around the display.

Heres a picture of the ball on the display, you can see its ghosting a little which leaves a shadded area behind the travel of the ball.
ball_ghosting.jpg
ball_ghosting.jpg (907 Bytes) Viewed 11560 times

User avatar
brad
Site Admin
Site Admin
Posts: 2578
Joined: Fri Mar 26, 2010 10:30 pm
[phpBB Debug] PHP Warning: in file [ROOT]/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1266: count(): Parameter must be an array or an object that implements Countable

Re: GLCD Graphic LCD - Using Swordfish Basic

Post by brad » Mon May 16, 2011 8:13 pm

Fantastic idea bitfogav!

It is very similar to the plain ol' text LCD's if you use the LCD.CLS function, it actually produces quite a bit of a delay, however if you simply send a screen full of spaces to the display, it barely has any delay at all.

User avatar
odessa
I practically live here!
I practically live here!
Posts: 102
Joined: Thu Sep 09, 2010 6:06 am
Location: London
[phpBB Debug] PHP Warning: in file [ROOT]/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1266: count(): Parameter must be an array or an object that implements Countable

Re: GLCD Graphic LCD - Using Swordfish Basic

Post by odessa » Tue May 17, 2011 11:19 pm

Gav,

Take a look at this little program. It creates the code you need for using bitmaps in Swordfish. Might be handy

http://www.sfcompiler.co.uk/wiki/pmwiki ... eConverter

Jay
(\_/)
(='.')
(")-(")
This is a bunny, copy bunny into your signature to help him achieve world domination.

User avatar
bitfogav
Moderator
Moderator
Posts: 915
Joined: Sun Mar 28, 2010 9:03 pm
Location: United Kingdom
Contact:

Re: GLCD Graphic LCD - Using Swordfish Basic

Post by bitfogav » Wed May 18, 2011 2:37 am

Thats a great find thanks for that Jay :)

User avatar
captalex
decided to stick around...
decided to stick around...
Posts: 28
Joined: Mon Mar 21, 2011 3:00 am
Contact:

Re: GLCD Graphic LCD - Using Swordfish Basic

Post by captalex » Sun May 22, 2011 11:08 pm

bitfogav wrote:Thanks for posting that Jay, ill have a look at it and see if I can transfer it into Swordfish code :) very cool thou!!

heres what ive been doing :)


finally man!!, bitfogav this is what i have been looking for /trying to do using the mikro C glcd libraries , but i didnt know how. i hope you could help me with porting your code to mikro C using a pic18f4550 and a wg12864b ks0108 based lcd display. and also adding an additional paddle and scoring! hence(pong).

Post Reply
[phpBB Debug] PHP Warning: in file [ROOT]/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1266: count(): Parameter must be an array or an object that implements Countable

Who is online

Users browsing this forum: No registered users and 16 guests