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.

Unicorn+GLCD+Swordfish.

Status
Not open for further replies.

Pommie

Well-Known Member
Most Helpful Member
I finally got around to playing with the above combination and found at first it didn't work. I had a look through the GLCD module and found that INVERT_CS seems to be the wrong way around (in my mind) and GLCD_RST was not in the option section. After setting these it all worked as it should.
Code:
// Unicorn GLCD test
Device = 18F4550
Clock = 48
Config
   PLLDIV = 5,
   CPUDIV = OSC1_PLL2,
   USBDIV = 2,
   FOSC = HSPLL_HS,
   VREGEN = OFF

#option GLCD_DATA = PORTD        // data port
#option GLCD_RS = PORTE.0        // RS pin
#option GLCD_EN = PORTE.2        // EN pin
#option GLCD_RW = PORTE.1        // RW pin
#option GLCD_CS1 = PORTB.4       // chip select
#option GLCD_CS2 = PORTC.0       // chip select
#option GLCD_ASPECT_RATIO = 75   // aspect ratio, smaller number will squeeze y for GLCD circles and box
#option GLCD_INIT_DELAY = 100    // initialisation delay (ms)
#option GLCD_INVERT_CS = true    // invert CS lines... 
#option GLCD_RST = PORTA.4       // reset line 

Include "GLCD.bas"
Include "Arial.bas"

// program start...
ADCON1 = $0F                //All digital
CMCON = $07                 //No comparators
Cls
High (PORTB.3)              //turn on back light

GLCD.SetFont(Arial)
WriteAt(10,10,"Hello World")
GLCD.SetFont(ArialBold)
WriteAt(10,20,"Hello World")

line(10,30,70,30)

While(true)
Wend
End

One thing I did find which I think is a possible bug is the read from the GLCD (in module KS0108.bas).
Code:
Function GetData() As Byte
   WaitForIdle      // block until not busy
   TRISData = $FF   // set data bus to input
   GLCDData         // access display RAM data
   GLCDRead         // read mode
   StrobeEN         // latch data
   Result = DATA    // get the data
End Function
This toggles enable and then reads the port. It works but I think that is due to pin capacitance and on a more complex board it may fail.

Mike.
 
hi Mike,
Do you know there is a Swordfish forum.?

Have you got the freebie or the fullversion.

EDIT:
David Barker is a nice guy, did some LCD tests for him last year with the Oshonsoft Sim
 
Last edited:
ericgibbs said:
hi Mike,
Do you know there is a Swordfish forum.?
Yes, I have posted on there.

Have you got the freebie or the fullversion.

I've just got the freebie and have not even got near the limit of 256 bytes of ram. Actually, I lie, I went over it when I tried using floating point maths.

The little demo above uses 87 bytes of ram.

Mike.
 
Thanks for the nice example Mike. I just received my TouchScreen GLCD with RGB backlight and am waiting on 25 pin machined pin SIP headers and sockets before I can start 'playing' too...

<update>

The machined pin SIP headers and sockets arrived. Yippee!
 
Last edited:
Status
Not open for further replies.

Latest threads

Back
Top