PDA

View Full Version : Graphic LCD support?



heliosentric
- 18th July 2005, 14:23
Do you think about adding functions to control Graphic LCDs (PicBasic)?

Thanks...

markedwards
- 21st August 2005, 15:15
I agree graphic support would be nice. Graphic displays are more complicated but PBP support could simplify text and bargraph routines, especially for the novice.

heliosentric
- 22nd August 2005, 08:00
Thanks Markedwards.

muskut
- 31st August 2005, 15:25
Yes, yes its great idea. We need the Graphic LCD library. We look forward to this support.

thanks a lot

Acetronics2
- 1st September 2005, 10:54
Yes, yes its great idea. We need the Graphic LCD library. We look forward to this support.

thanks a lot

And I suppose you'd like it to fit into a 1K Memory device like 16F84 ????

Try being serious !!! Just have a look to what exists on the subject ...with a serial input and "line, circle, etc .." commands, it just needs a 16F876@20 Mhz... for a 64 x 128 display.

And it's full from full's ... LoL !!!

Alain

muskut
- 1st September 2005, 14:24
Look at this forum title "PBP Wish List".

And this is my wish. It can be or not. Please Dont move with your supposition and please be careful your words. I bought this compiler and I gave my money for this compiler so I have chance to express my wish to the engineers of the PBP. If the Customer Support of this compiler is good they will consider our wishes. If this wish is possible they will talk about, if its not they will talk about agian.

thank you so much.

Acetronics2
- 2nd September 2005, 09:42
Hi, Muskut

IF you daren't read your manual, how will you do for such a complicated piece of software...

hmmmm ????

Alain

bioeng-mostafa
- 4th April 2006, 22:20
Hellow
I Want The File By Whish I Can Write Progrsm With Pbp
Or Beatsh
Thank You

Archilochus
- 5th April 2006, 21:21
I'd guess the main reason for no graphic support is all the different types of graphic LCD's out there. If MELabs offered support for say the KS0108 type, people would want some other LCD variety supported too.

The graphic LCD's are really fairly easy to use if you read the data sheets several times (the data sheets are typically pretty poor translations).

There is also a web-site with some sample code:

http://www.compsys1.com/workbench/

Writing your own code allows you to tailor everything to your specific needs, without filling up a whole '876!

astanapane
- 29th April 2011, 11:06
Dear All,

i would like to use GLCD but i cannot do it as your discussion here.

I only found on the net that PROTON and micro e are able to control very easy GLCD.

The problem is that we are using now picbasic and i dont wont to change from that, i'm used to it.

Is there any plan to see an update of the picbasic pro for supporting the GLCD?

Demon
- 29th April 2011, 15:26
Did you search the forum for your particular model of GLCD?

Did you start a thread asking for help on code or schematic?

There's already several examples on these forums. Sometimes you can use techniques used for one model and customize it for another with just a few tweaks.

There was one particular model that I had used that had no examples anywhere on the web. I started with the datasheet, found a "close model" and went on from there.

Putting too much functionality into PICs is not necessarily a good idea, it takes up space. Imagine if all PICs now had DT's interrupt, barely enough room to LCDOUT "Hello" on most of them, if at all.

astanapane
- 29th April 2011, 18:56
yes i have searched for the GLCD 128x64 with Samsung KS0108.

to be honest with Proton i did a grahpical model in less that 10 minutes.

Is it so difficult to put a library for these GLCDs? I dont care for the PIC's space since there are 32x16 ones that can store an elephant in there.

I just want my life to be easier and save time. I didnt ask for a code but for better features like proton and micro c

pedja089
- 29th April 2011, 20:16
I'm currently working on a driver for the GLCD.
Here you can see how far I got.

'************************************************* ***************
'* Name : GLCD driver *
'* Author : Pedja089 *
'************************************************* ***************
' LCD Commands are:
' Lcd_Init
' Lcd_SetX
' Lcd_SetY
' Lcd_Clr
' Lcd_On

' @ PrintStr x,y, "string goes here" ' will auto wrap to next line if needed
' @ PrintVar x,y, _anyvariablehere

' You can manually position x,y and print characters by the following:
' PosX = 0 ' move to position 0 of 83 (char best viewed at spacing of 6)
' PosY = 1 ' move to second line of 6
' Lcd_SetX
' Lcd_SetY
' Lcd_Data = "H" ' Note byte size single char.
' Gosub Lcd_SendChar



symbol RW=portb.3
symbol RS = portb.2
symbol E = portb.4
symbol CS1 = portb.0
symbol CS2 = portb.1
symbol RST = portb.5
Symbol LCD_DATA=portd
LCD_DATA=0
TRISD=0
output rst
Output RW
Output RS
Output E
Output CS1
Output CS2

PosX var Byte ' Variable for Position X
PosY var Byte ' Variable for Position Y
GLCD_SX var byte
GLCD_X var byte
GLCD_FC var Byte [5] ' Variable 5 bytes = 1 character
GLCD_CharNum var byte ' character number
GLCD_VarData var word ' variable to print to lcd
GLCD_n0 var byte ' for next variable
GLCD_n1 var byte
GLCD_digits var bit ' number of digits in VarData
GLCD_Addr VAR WORD
GLCD_Char VAR byte ' lcdchardata[0]

gosub Lcd_init

goto OverLCD
'_________________________________________________ ______________________________
' @ PrintVar macro function
' format should look like this: @ PrintVar x,y, _anyvariable
ASM
PrintVar macro x, y, Variable ; input values from: @PrintVar 0,1, _any_variable
local OverVar
goto OverVar
OverVar
MOVE?CB x, _GLCD_X
MOVE?CB x, _GLCD_SX
MOVE?CB y, _PosY ; move y from above statement to PosY
MOVE?WW Variable, _GLCD_VarData ; move variable in statement to VarData
L?CALL _GLCD_VariableOut ; call VariableOut function
endm
ENDASM

GLCD_VariableOut:
'for GLCD_n1 = 4 to 0 step -1 ' cycles through all possible digits of number
Gosub Lcd_SetX
Gosub Lcd_SetY ' place character at position PosX and PosY
GLCD_Char = (GLCD_VarData dig 2) + 48 ' digit number n to character str format
gosub Lcd_SendChar ' print char to screen
PosX = PosX + 6 ' next x position for character
Gosub Lcd_SetX
Gosub Lcd_SetY ' place character at position PosX and PosY
GLCD_Char = (GLCD_VarData dig 1) + 48 ' digit number n to character str format
gosub Lcd_SendChar ' print char to screen
PosX = PosX + 6 ' next x position for character
Gosub Lcd_SetX
Gosub Lcd_SetY ' place character at position PosX and PosY
GLCD_Char = (GLCD_VarData dig 0) + 48 ' digit number n to character str format
gosub Lcd_SendChar ' print char to screen
PosX = PosX + 6 ' next x position for character
GLCD_SkipChar:
'next GLCD_n1
return
'_________________________________________________ ______________________________
ASM
PrintStr macro x, y, Str
local TheString, OverStr
goto OverStr
TheString
data Str, 0
OverStr
MOVE?CB x, _GLCD_X
MOVE?CB x, _GLCD_SX
MOVE?CB y, _PosY
MOVE?CW TheString, _GLCD_Addr
L?CALL _GLCD_StringOut
endm
ENDASM

GLCD_StringOut:
Readcode GLCD_Addr, GLCD_Char ' Get a character
if GLCD_Char = 0 then GLCD_StringDone ' Look for Null char, Stop if found

if glcd_x=> 123 then ' If end of line, cycle to next line
PosY = PosY + 1
glcd_x=GLCD_SX
endif

If glcd_x<64 then
lcd_data=0
cs1=0
cs2=1
posx=glcd_x
else
lcd_data=0
cs1=1
cs2=0
posx=glcd_x-64
endif

Gosub Lcd_SetX
gosub Lcd_SetY
gosub Lcd_SendChar ' puttext

GLCD_Addr = GLCD_Addr + 1 ' Point to next character
glcd_x=glcd_x + 1
goto GLCD_StringOut ' Continue with rest of the string
GLCD_StringDone:
return

'_________________________________________________ ______________________________
Lcd_SendChar:
lookdown GLCD_Char,_
[" !\#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~"],GLCD_CharNum
GLCD_Char = GLCD_CharNum +32
sELECT CASE GLCD_Char
Case 32
GLCD_FC(0)=$00:GLCD_FC(1)=$00:GLCD_FC(2)=$00:GLCD_ FC(3)=$00:GLCD_FC(4)=$00 ' // sp
Case 33
GLCD_FC(0)=$00:GLCD_FC(1)=$00:GLCD_FC(2)=$2f:GLCD_ FC(3)=$00:GLCD_FC(4)=$00 ' // !
Case 34
GLCD_FC(0)=$00:GLCD_FC(1)=$07:GLCD_FC(2)=$00:GLCD_ FC(3)=$07:GLCD_FC(4)=$00 ' // " (shown as \ in Lookdown table)
Case 35
GLCD_FC(0)=$14:GLCD_FC(1)=$7f:GLCD_FC(2)=$14:GLCD_ FC(3)=$7f:GLCD_FC(4)=$14 ' // #
Case 36
GLCD_FC(0)=$24:GLCD_FC(1)=$2a:GLCD_FC(2)=$7f:GLCD_ FC(3)=$2a:GLCD_FC(4)=$12 ' // $
Case 37
GLCD_FC(0)=$c4:GLCD_FC(1)=$c8:GLCD_FC(2)=$10:GLCD_ FC(3)=$26:GLCD_FC(4)=$46 ' // %
Case 38
GLCD_FC(0)=$36:GLCD_FC(1)=$49:GLCD_FC(2)=$55:GLCD_ FC(3)=$22:GLCD_FC(4)=$50 ' // &
Case 39
GLCD_FC(0)=$00:GLCD_FC(1)=$05:GLCD_FC(2)=$03:GLCD_ FC(3)=$00:GLCD_FC(4)=$00 ' // '
Case 40
GLCD_FC(0)=$00:GLCD_FC(1)=$1c:GLCD_FC(2)=$22:GLCD_ FC(3)=$41:GLCD_FC(4)=$00 ' // (
Case 41
GLCD_FC(0)=$00:GLCD_FC(1)=$41:GLCD_FC(2)=$22:GLCD_ FC(3)=$1c:GLCD_FC(4)=$00 ' // )
Case 42
GLCD_FC(0)=$14:GLCD_FC(1)=$08:GLCD_FC(2)=$3E:GLCD_ FC(3)=$08:GLCD_FC(4)=$14 ' // *
Case 43
GLCD_FC(0)=$08:GLCD_FC(1)=$08:GLCD_FC(2)=$3E:GLCD_ FC(3)=$08:GLCD_FC(4)=$08 ' // +
Case 44
GLCD_FC(0)=$00:GLCD_FC(1)=$00:GLCD_FC(2)=$50:GLCD_ FC(3)=$30:GLCD_FC(4)=$00 ' // ,
Case 45
GLCD_FC(0)=$10:GLCD_FC(1)=$10:GLCD_FC(2)=$10:GLCD_ FC(3)=$10:GLCD_FC(4)=$10 ' // -
Case 46
GLCD_FC(0)=$00:GLCD_FC(1)=$60:GLCD_FC(2)=$60:GLCD_ FC(3)=$00:GLCD_FC(4)=$00 ' // .
Case 47
GLCD_FC(0)=$20:GLCD_FC(1)=$10:GLCD_FC(2)=$08:GLCD_ FC(3)=$04:GLCD_FC(4)=$02 ' // /
Case 48
GLCD_FC(0)=$3E:GLCD_FC(1)=$51:GLCD_FC(2)=$49:GLCD_ FC(3)=$45:GLCD_FC(4)=$3E ' // 0
Case 49
GLCD_FC(0)=$00:GLCD_FC(1)=$42:GLCD_FC(2)=$7F:GLCD_ FC(3)=$40:GLCD_FC(4)=$00 ' // 1
Case 50
GLCD_FC(0)=$42:GLCD_FC(1)=$61:GLCD_FC(2)=$51:GLCD_ FC(3)=$49:GLCD_FC(4)=$46 ' // 2
Case 51
GLCD_FC(0)=$21:GLCD_FC(1)=$41:GLCD_FC(2)=$45:GLCD_ FC(3)=$4B:GLCD_FC(4)=$31 ' // 3
Case 52
GLCD_FC(0)=$18:GLCD_FC(1)=$14:GLCD_FC(2)=$12:GLCD_ FC(3)=$7F:GLCD_FC(4)=$10 ' // 4
Case 53
GLCD_FC(0)=$27:GLCD_FC(1)=$45:GLCD_FC(2)=$45:GLCD_ FC(3)=$45:GLCD_FC(4)=$39 ' // 5
Case 54
GLCD_FC(0)=$3C:GLCD_FC(1)=$4A:GLCD_FC(2)=$49:GLCD_ FC(3)=$49:GLCD_FC(4)=$30 ' // 6
Case 55
GLCD_FC(0)=$01:GLCD_FC(1)=$71:GLCD_FC(2)=$09:GLCD_ FC(3)=$05:GLCD_FC(4)=$03 ' // 7
Case 56
GLCD_FC(0)=$36:GLCD_FC(1)=$49:GLCD_FC(2)=$49:GLCD_ FC(3)=$49:GLCD_FC(4)=$36 ' // 8
Case 57
GLCD_FC(0)=$06:GLCD_FC(1)=$49:GLCD_FC(2)=$49:GLCD_ FC(3)=$29:GLCD_FC(4)=$1E ' // 9
Case 58
GLCD_FC(0)=$00:GLCD_FC(1)=$36:GLCD_FC(2)=$36:GLCD_ FC(3)=$00:GLCD_FC(4)=$00 ' // :
Case 59
GLCD_FC(0)=$00:GLCD_FC(1)=$56:GLCD_FC(2)=$36:GLCD_ FC(3)=$00:GLCD_FC(4)=$00 ' // ";"
Case 60
GLCD_FC(0)=$08:GLCD_FC(1)=$14:GLCD_FC(2)=$22:GLCD_ FC(3)=$41:GLCD_FC(4)=$00 ' // <
Case 61
GLCD_FC(0)=$14:GLCD_FC(1)=$14:GLCD_FC(2)=$14:GLCD_ FC(3)=$14:GLCD_FC(4)=$14 ' // =
Case 62
GLCD_FC(0)=$00:GLCD_FC(1)=$41:GLCD_FC(2)=$22:GLCD_ FC(3)=$14:GLCD_FC(4)=$08 ' // >
Case 63
GLCD_FC(0)=$02:GLCD_FC(1)=$01:GLCD_FC(2)=$51:GLCD_ FC(3)=$09:GLCD_FC(4)=$06 ' // ?
Case 64
GLCD_FC(0)=$32:GLCD_FC(1)=$49:GLCD_FC(2)=$59:GLCD_ FC(3)=$51:GLCD_FC(4)=$3E ' // @
Case 65
GLCD_FC(0)=$7E:GLCD_FC(1)=$11:GLCD_FC(2)=$11:GLCD_ FC(3)=$11:GLCD_FC(4)=$7E ' // A
Case 66
GLCD_FC(0)=$7F:GLCD_FC(1)=$49:GLCD_FC(2)=$49:GLCD_ FC(3)=$49:GLCD_FC(4)=$36 ' // B
Case 67
GLCD_FC(0)=$3E:GLCD_FC(1)=$41:GLCD_FC(2)=$41:GLCD_ FC(3)=$41:GLCD_FC(4)=$22 ' // C
Case 68
GLCD_FC(0)=$7F:GLCD_FC(1)=$41:GLCD_FC(2)=$41:GLCD_ FC(3)=$22:GLCD_FC(4)=$1C ' // D
Case 69
GLCD_FC(0)=$7F:GLCD_FC(1)=$49:GLCD_FC(2)=$49:GLCD_ FC(3)=$49:GLCD_FC(4)=$41 ' // E
Case 70
GLCD_FC(0)=$7F:GLCD_FC(1)=$09:GLCD_FC(2)=$09:GLCD_ FC(3)=$09:GLCD_FC(4)=$01 ' // F
Case 71
GLCD_FC(0)=$3E:GLCD_FC(1)=$41:GLCD_FC(2)=$49:GLCD_ FC(3)=$49:GLCD_FC(4)=$7A ' // G
Case 72
GLCD_FC(0)=$7F:GLCD_FC(1)=$08:GLCD_FC(2)=$08:GLCD_ FC(3)=$08:GLCD_FC(4)=$7F ' // H
Case 73
GLCD_FC(0)=$00:GLCD_FC(1)=$41:GLCD_FC(2)=$7F:GLCD_ FC(3)=$41:GLCD_FC(4)=$00 ' // I
Case 74
GLCD_FC(0)=$20:GLCD_FC(1)=$40:GLCD_FC(2)=$41:GLCD_ FC(3)=$3F:GLCD_FC(4)=$01 ' // J
Case 75
GLCD_FC(0)=$7F:GLCD_FC(1)=$08:GLCD_FC(2)=$14:GLCD_ FC(3)=$22:GLCD_FC(4)=$41 ' // K
Case 76
GLCD_FC(0)=$7F:GLCD_FC(1)=$40:GLCD_FC(2)=$40:GLCD_ FC(3)=$40:GLCD_FC(4)=$40 ' // L
Case 77
GLCD_FC(0)=$7F:GLCD_FC(1)=$02:GLCD_FC(2)=$0C:GLCD_ FC(3)=$02:GLCD_FC(4)=$7F ' // M
Case 78
GLCD_FC(0)=$7F:GLCD_FC(1)=$04:GLCD_FC(2)=$08:GLCD_ FC(3)=$10:GLCD_FC(4)=$7F ' // N
Case 79
GLCD_FC(0)=$3E:GLCD_FC(1)=$41:GLCD_FC(2)=$41:GLCD_ FC(3)=$41:GLCD_FC(4)=$3E ' // O
Case 80
GLCD_FC(0)=$7F:GLCD_FC(1)=$09:GLCD_FC(2)=$09:GLCD_ FC(3)=$09:GLCD_FC(4)=$06 ' // P
Case 81
GLCD_FC(0)=$3E:GLCD_FC(1)=$41:GLCD_FC(2)=$51:GLCD_ FC(3)=$21:GLCD_FC(4)=$5E ' // Q
Case 82
GLCD_FC(0)=$7F:GLCD_FC(1)=$09:GLCD_FC(2)=$19:GLCD_ FC(3)=$29:GLCD_FC(4)=$46 ' // R
Case 83
GLCD_FC(0)=$46:GLCD_FC(1)=$49:GLCD_FC(2)=$49:GLCD_ FC(3)=$49:GLCD_FC(4)=$31 ' // S
Case 84
GLCD_FC(0)=$01:GLCD_FC(1)=$01:GLCD_FC(2)=$7F:GLCD_ FC(3)=$01:GLCD_FC(4)=$01 ' // T
Case 85
GLCD_FC(0)=$3F:GLCD_FC(1)=$40:GLCD_FC(2)=$40:GLCD_ FC(3)=$40:GLCD_FC(4)=$3F ' // U
Case 86
GLCD_FC(0)=$1F:GLCD_FC(1)=$20:GLCD_FC(2)=$40:GLCD_ FC(3)=$20:GLCD_FC(4)=$1F ' // V
Case 87
GLCD_FC(0)=$3F:GLCD_FC(1)=$40:GLCD_FC(2)=$38:GLCD_ FC(3)=$40:GLCD_FC(4)=$3F ' // W
Case 88
GLCD_FC(0)=$63:GLCD_FC(1)=$14:GLCD_FC(2)=$08:GLCD_ FC(3)=$14:GLCD_FC(4)=$63 ' // X
Case 89
GLCD_FC(0)=$07:GLCD_FC(1)=$08:GLCD_FC(2)=$70:GLCD_ FC(3)=$08:GLCD_FC(4)=$07 ' // Y
Case 90
GLCD_FC(0)=$61:GLCD_FC(1)=$51:GLCD_FC(2)=$49:GLCD_ FC(3)=$45:GLCD_FC(4)=$43 ' // Z
Case 91
GLCD_FC(0)=$00:GLCD_FC(1)=$7F:GLCD_FC(2)=$41:GLCD_ FC(3)=$41:GLCD_FC(4)=$00 ' // [
Case 92
GLCD_FC(0)=$02:GLCD_FC(1)=$04:GLCD_FC(2)=$08:GLCD_ FC(3)=$10:GLCD_FC(4)=$20 ' // \ (we are using this for Case 34 " above)
Case 93
GLCD_FC(0)=$00:GLCD_FC(1)=$41:GLCD_FC(2)=$41:GLCD_ FC(3)=$7F:GLCD_FC(4)=$00 ' // ]
Case 94
GLCD_FC(0)=$04:GLCD_FC(1)=$02:GLCD_FC(2)=$01:GLCD_ FC(3)=$02:GLCD_FC(4)=$04 ' // ^
Case 95
GLCD_FC(0)=$40:GLCD_FC(1)=$40:GLCD_FC(2)=$40:GLCD_ FC(3)=$40:GLCD_FC(4)=$40 ' // _
Case 96
' GLCD_FC(0)=$00:GLCD_FC(1)=$01:GLCD_FC(2)=$02:GLCD_ FC(3)=$04:GLCD_FC(4)=$00 ' // `
GLCD_FC(0)=$02:GLCD_FC(1)=$04:GLCD_FC(2)=$08:GLCD_ FC(3)=$10:GLCD_FC(4)=$20 ' // \ (shown as ` in Lookdown table)
Case 97
GLCD_FC(0)=$20:GLCD_FC(1)=$54:GLCD_FC(2)=$54:GLCD_ FC(3)=$54:GLCD_FC(4)=$78 ' // a
Case 98
GLCD_FC(0)=$7F:GLCD_FC(1)=$48:GLCD_FC(2)=$44:GLCD_ FC(3)=$44:GLCD_FC(4)=$38 ' // b
Case 99
GLCD_FC(0)=$38:GLCD_FC(1)=$44:GLCD_FC(2)=$44:GLCD_ FC(3)=$44:GLCD_FC(4)=$20 ' // c
Case 100
GLCD_FC(0)=$38:GLCD_FC(1)=$44:GLCD_FC(2)=$44:GLCD_ FC(3)=$48:GLCD_FC(4)=$7F ' // d
Case 101
GLCD_FC(0)=$38:GLCD_FC(1)=$54:GLCD_FC(2)=$54:GLCD_ FC(3)=$54:GLCD_FC(4)=$18 ' // e
Case 102
GLCD_FC(0)=$08:GLCD_FC(1)=$7E:GLCD_FC(2)=$09:GLCD_ FC(3)=$01:GLCD_FC(4)=$02 ' // f
Case 103
GLCD_FC(0)=$0C:GLCD_FC(1)=$52:GLCD_FC(2)=$52:GLCD_ FC(3)=$52:GLCD_FC(4)=$3E ' // g
Case 104
GLCD_FC(0)=$7F:GLCD_FC(1)=$08:GLCD_FC(2)=$04:GLCD_ FC(3)=$04:GLCD_FC(4)=$78 ' // h
Case 105
GLCD_FC(0)=$00:GLCD_FC(1)=$44:GLCD_FC(2)=$7D:GLCD_ FC(3)=$40:GLCD_FC(4)=$00 ' // i
Case 106
GLCD_FC(0)=$20:GLCD_FC(1)=$40:GLCD_FC(2)=$44:GLCD_ FC(3)=$3D:GLCD_FC(4)=$00 ' // j
Case 107
GLCD_FC(0)=$7F:GLCD_FC(1)=$10:GLCD_FC(2)=$28:GLCD_ FC(3)=$44:GLCD_FC(4)=$00 ' // k
Case 108
GLCD_FC(0)=$00:GLCD_FC(1)=$41:GLCD_FC(2)=$7F:GLCD_ FC(3)=$40:GLCD_FC(4)=$00 ' // l
Case 109
GLCD_FC(0)=$7C:GLCD_FC(1)=$04:GLCD_FC(2)=$18:GLCD_ FC(3)=$04:GLCD_FC(4)=$78 ' // m
Case 110
GLCD_FC(0)=$7C:GLCD_FC(1)=$08:GLCD_FC(2)=$04:GLCD_ FC(3)=$04:GLCD_FC(4)=$78 ' // n
Case 111
GLCD_FC(0)=$38:GLCD_FC(1)=$44:GLCD_FC(2)=$44:GLCD_ FC(3)=$44:GLCD_FC(4)=$38 ' // o
Case 112
GLCD_FC(0)=$7C:GLCD_FC(1)=$14:GLCD_FC(2)=$14:GLCD_ FC(3)=$14:GLCD_FC(4)=$08 ' // p
Case 113
GLCD_FC(0)=$08:GLCD_FC(1)=$14:GLCD_FC(2)=$14:GLCD_ FC(3)=$18:GLCD_FC(4)=$7C ' // q
Case 114
GLCD_FC(0)=$7C:GLCD_FC(1)=$08:GLCD_FC(2)=$04:GLCD_ FC(3)=$04:GLCD_FC(4)=$08 ' // r
Case 115
GLCD_FC(0)=$48:GLCD_FC(1)=$54:GLCD_FC(2)=$54:GLCD_ FC(3)=$54:GLCD_FC(4)=$20 ' // s
Case 116
GLCD_FC(0)=$04:GLCD_FC(1)=$3F:GLCD_FC(2)=$44:GLCD_ FC(3)=$40:GLCD_FC(4)=$20 ' // t
Case 117
GLCD_FC(0)=$3C:GLCD_FC(1)=$40:GLCD_FC(2)=$40:GLCD_ FC(3)=$20:GLCD_FC(4)=$7C ' // u
Case 118
GLCD_FC(0)=$1C:GLCD_FC(1)=$20:GLCD_FC(2)=$40:GLCD_ FC(3)=$20:GLCD_FC(4)=$1C ' // v
Case 119
GLCD_FC(0)=$3C:GLCD_FC(1)=$40:GLCD_FC(2)=$30:GLCD_ FC(3)=$40:GLCD_FC(4)=$3C ' // w
Case 120
GLCD_FC(0)=$44:GLCD_FC(1)=$28:GLCD_FC(2)=$10:GLCD_ FC(3)=$28:GLCD_FC(4)=$44 ' // x
Case 121
GLCD_FC(0)=$0C:GLCD_FC(1)=$50:GLCD_FC(2)=$50:GLCD_ FC(3)=$50:GLCD_FC(4)=$3C ' // y
Case 122
GLCD_FC(0)=$44:GLCD_FC(1)=$64:GLCD_FC(2)=$54:GLCD_ FC(3)=$4C:GLCD_FC(4)=$44 ' // z
case 123
' GLCD_FC(0)=$00:GLCD_FC(1)=$08:GLCD_FC(2)=$36:GLCD_ FC(3)=$41:GLCD_FC(4)=$00' // {
GLCD_FC(0)=$10:GLCD_FC(1)=$24:GLCD_FC(2)=$20:GLCD_ FC(3)=$24:GLCD_FC(4)=$10 ' // Smily face (shown as { in Lookdown table)
case 124
' GLCD_FC(0)=$00:GLCD_FC(1)=$00:GLCD_FC(2)=$7F:GLCD_ FC(3)=$00:GLCD_FC(4)=$00 ' // |
GLCD_FC(0)=$20:GLCD_FC(1)=$40:GLCD_FC(2)=$20:GLCD_ FC(3)=$10:GLCD_FC(4)=$08 ' // Tick (shown as | in Lookdown table)
case 125
' GLCD_FC(0)=$00:GLCD_FC(1)=$41:GLCD_FC(2)=$36:GLCD_ FC(3)=$08:GLCD_FC(4)=$00' // }
GLCD_FC(0)=$20:GLCD_FC(1)=$14:GLCD_FC(2)=$10:GLCD_ FC(3)=$14:GLCD_FC(4)=$20 ' // Frown face (shown as } in Lookdown table)
case 126
GLCD_FC(0)=$10:GLCD_FC(1)=$08:GLCD_FC(2)=$08:GLCD_ FC(3)=$10:GLCD_FC(4)=$08' // ~
' case 127
' GLCD_FC(0)=$10:GLCD_FC(1)=$08:GLCD_FC(2)=$08:GLCD_ FC(3)=$10:GLCD_FC(4)=$08' // DEL
' Case 128
' GLCD_FC(0)=$55:GLCD_FC(1)=$2A:GLCD_FC(2)=$55:GLCD_ FC(3)=$2A:GLCD_FC(4)=$55 ' // 55 (shaded)
end SELECT
for GLCD_n0 = 0 to 4

If glcd_x=64 then
lcd_data=0
cs1=1
cs2=0
posx=0
gosub lcd_setx
gosub lcd_sety
endif
glcd_x=glcd_x + 1
lcd_data=GLCD_FC(GLCD_n0)
GOSUB Lcd_Pod
next GLCD_n0
return
'_________________________________________________ ______________________________

Lcd_Init:
posx=0
posy=0
rw=0
cs1=0
cs2=0
e=1
LCD_DATA=0
rst=0
pause 1
rst=1
cs1=1
cs2=1
gosub Lcd_On
LCD_DATA=192
gosub Lcd_Kom
gosub Lcd_clr
return


Lcd_Pod:
rs=1
e=0
pauseus 1
e=1
pauseus 1
return
Lcd_Kom:
rs=0
e=0
pauseus 1
e=1
pauseus 1
return

Lcd_SetX:
LCD_DATA=64+posx
gosub Lcd_Kom
return

Lcd_SetY:
LCD_DATA=184+posy
gosub Lcd_Kom
return

Lcd_Clr:
for GLCD_n0=0 to 7
posy=GLCD_n0
gosub Lcd_SetY
posx=0
gosub Lcd_SetX
LCD_DATA=0
for GLCD_n1=0 to 63
gosub Lcd_pod
next GLCD_n1
next GLCD_n0
return

Lcd_Off:
LCD_DATA=62
gosub Lcd_kom
return

Lcd_On:
LCD_DATA=63
gosub Lcd_Kom
return

OverLCD:


include "glcd.pbp"
z var byte
z=12
pause 2000
pocetak:
@ PrintStr 1,0,"Some text and move to second line if first line isn't enought bla bla"
PAUSE 2000
@ PrintStr 7,4,"test"
'@ PrintVar 3,6, _z ' I allways get random number
pause 1000
end

Text works correctly, but the variable can not make it to work.
Code is not mine, I downloaded it from the forum and make some changes.

astanapane
- 29th April 2011, 21:16
that's very interesting, thank you a lot.

But why they dont make one for all of us?

Demon
- 30th April 2011, 02:49
Look at what I found going through my archives:



'************************************************* ***********************
'GLIPICW.BAS Graphic application for use with a KS0108 (or compatible)
'graphic LCD controller connected to a Microchip(TM) PIC 16F877
'Written in MELabs PicBasicPro(TM) Ver 3.32
'Beta version 0.8.0
'================== NOT FOR COMMERICIAL USE =============================
'
' Author: Ranjit Diol - COMPSys LLC, March 2000
' (c) Copyright Ranjit Diol, 2001
'
' DISCLAIMER: This file is being released as non-commericial
' freeware. It is being provided "AS IS", neither the author,
' nor COMPSys LLC shall be held liable for any damages caused
' by its use.
'
' LICENSE: This application may be used in its entirety or
' in parts within some other non-commercial application as long
' as the author is given credit for those parts used.
'
' Contact: [email protected] for more information
'
'************************************************* ***********************
' IMPORTANT, PLEASE NOTE THE FOLLOWING
'This application assumes you have a 64KBit external eeprom connected
'via I2C. Without that you will only be able to send images directly
'to the LCD display and not be able to store them -- See the readme.txt
'for the Windows GLiPIC interface.
'
'Adjust the PIN assignments as neccessary for your prototype
'This was tested using a 20MHz xtal if you use a different OSC speed
'you may have to make some adjustement in the 'strobe' subroutine.
'************************************************* ***********************

DEFINE ONINT_USED 1 'Required if using ISP
DEFINE OSC 20 'OSC speed, you may have to tweak the 'strobe'
'routine's e_pause constant for other speeds
ADCON1 = 7 'Make all pins digital, you may adjust as needed

SPBRG=0 '************ NOTE ***********
RCSTA=0 'This is required if you are using
TXSTA=2 'Shane Tolmie's bootloader (PICLoader)
'*****************************

dat VAR PORTD 'LCD bus Pins 7-14 LSB-MSB
scl VAR PORTC.3 'I2C SCL for ext eeprom
sda VAR PORTC.4 'I2C SDA for ext eeprom
in_pin VAR PORTC.7 'Serial input pin
out_pin VAR PORTC.6 'Serial output pin
e VAR PORTC.0 'Enable pin on LCD
cd VAR PORTC.1 'Data/Command Pin 4 on LCD
rw VAR PORTC.2 'Read/Write Pin 5 on LCD
cs1 VAR PORTB.1 'ChipSelect1 Pin 15 on LCD
cs2 VAR PORTB.2 'ChipSelect2 Pin 16 on LCD
rst VAR PORTC.5 'Reset Pin 17 on LCD
'Set pins for output
TRISB.0 = 0
TRISB.1 = 0
TRISB.2 = 0
TRISD = 0
TRISC.0 = 0
TRISC.1 = 0
TRISC.2 = 0
TRISC.3 = 0
TRISC.4 = 0
TRISC.5 = 0
'Constants used
ser_baud CON 32 '19200 baud serout/serin
ctl CON $A0 'EEprom control code
row CON $b8 'LCD page 0
last_row CON $bf 'LCD page 7
col CON $40 'Line byte position 0
last_col CON 63 'Last column (1-64)
first_col CON 0 'First column
max_col CON 128 'Last column (1-127)
max_line CON 8 'Line 8 (based on 1-8)
max_pos CON 64 'Column 64 positon per side (1-64)
cr CON 13 'CR for serout
lf CON 10 'LF for serout
disp_on CON $3f 'LCD Display ON
disp_off CON $3e 'LCD Display OFF
disp_ram CON $c0 'Ram Display 0 (Page 0 at top of display)
blank CON $00 'Blank character
e_pause CON 10 'Pauseus 6 for Strobe routine
'Word variables used
eepaddr VAR WORD
addr VAR WORD
'Arrays used
in_array VAR byte[32]
in_ctl VAR byte[8]
'Byte Variables used
buff_count VAR BYTE 'buffer count
hex_nibble VAR BYTE 'hex nibble from serin
in_ascii VAR BYTE 'ASCII char from serin
buf_cnt VAR BYTE 'buffer counter
byte_pos VAR BYTE 'To keep track of a byte's position
in_byte VAR BYTE 'The incoming byte
tmp VAR BYTE 'Temporary var
index VAR BYTE 'Index for arrays
j VAR BYTE 'General counter
k VAR BYTE 'General counter
line VAR BYTE 'An LCD row
delay VAR BYTE 'Execution delay, used with 'pause'
'Initialize variables
hex_nibble = 0
byte_pos = 0
delay = 10
in_byte = 0
tmp = 0
index = 0

'Reset LCD
dat = 0 ' Clear PORTD
cd = 0
rw = 0
e = 0
cs1 = 1
cs2 = 0
rst = 1
pause 100 'Let things stabilize
rst = 0
pause 10 ' Reset LCD
rst = 1
pause 500

'Jump over subroutines to main program
goto main
' **** (GO)SUB ROUTINES ****
strobe:
e = 1
pauseus e_pause
e = 0
return
clearall:
cd = 0 ' Command mode
dat = disp_off ' Display Off
gosub strobe
cs1=1
cs2=0
for index = 1 to 2
for j = row to last_row
cd = 0 'Command mode
gosub strobe ' Write the data
dat = col ' Column address = 0
gosub strobe
dat = j
gosub strobe
cd = 1 ' Write mode
for k = first_col to last_col
dat = blank
gosub strobe
next
next
swap cs1,cs2
next
cs1=0
cs2=1
cd=0
dat=row
gosub strobe
dat = disp_ram ' Ram Line 0
gosub strobe
dat=col
gosub strobe
dat = disp_on 'display on
gosub strobe
cs1=1
cs2=0
dat=row
gosub strobe
dat = disp_ram ' Ram Line 0
gosub strobe
dat=col
gosub strobe
dat = disp_on 'display on
gosub strobe
cd = 1 ' Set Data command
cs1 = 1 ' Left side active
cs2 = 0
return

init: 'Initialization
cd = 0 ' Set command mode
cs1 = 1 ' Left Side on
cs2 = 0 ' Right Side off
for index = 1 to 2
dat = disp_off ' Display Off
dat = disp_ram ' Ram Line 0
gosub strobe ' Write the data
dat = col ' Y address = 0
gosub strobe
dat = row ' Page = 0
gosub strobe
dat = disp_on ' Display On
gosub strobe
swap cs1,cs2
next
cs1=1
cs2=0

return
'****Place char on LCD Routine *****
'Place byte of data on lcd assumes in_byte, byte_pos and line (line)
'Char position on LCD byte_pos = 0-127 (Horiz), ROW 0-7 (vert)
putbyte:
dat = in_byte 'Display the byte
gosub strobe
byte_pos=byte_pos+1 'Increment position
'Now do some LCD house cleaning and adjust counters
if byte_pos=max_pos then
cs1=0
cs2=1
cd = 0
dat = col
gosub strobe
dat = disp_ram
gosub strobe
dat = row + line
gosub strobe
cd = 1
endif
if byte_pos = max_col then 'Check if
line = line + 1 'New Line
if line = max_line then
line = 0
endif
byte_pos = 0 'Reset byte_pos
cs1=1
cs2=0
cd = 0
dat=col
gosub strobe
dat = row + line
gosub strobe
dat = disp_ram
gosub strobe
cd =1
endif

return
'***** Convert incoming ascii to hex byte Routine *****
find:
Lookdown in_array[index],["0123456789abcdef"],hex_nibble
return

'===============================
' **** BEGIN MAIN PROGRAM ******
'===============================

main:
gosub init ' Initialize LCD
gosub clearall ' Clear all pages
serout2 out_pin,ser_baud,["Load image..."]
goto term
logo: gosub init ' Initialize LCD
gosub clearall ' Clear all pages

'**** DISPLAY IMAGES IN EXTERNAL 64KBit EEPROM VIA I2C *****
' Load opening screen from eeprom assuming a 64KBit eeprom
byte_pos=0
line =0
for addr = 0 to 8192
I2CREAD sda,scl,ctl,addr,[in_byte]
gosub putbyte
if (addr=1024) OR (addr=2048) OR (addr= 3072) OR (addr=4096) OR (addr=5120) OR (addr=6144) OR (addr=7168) OR (addr=8192) then
pause 4000
gosub init
gosub clearall
endif
next
pause 4000
gosub init
gosub clearall
'goto logo 'Continue looping inifitum!
'********************************************
'Terminal Subroutine
term: 'Assumes Home Position
'Setup variables
j=0
index=0
k=0
'line=0
addr=0
in_ascii = 0
buff_count = 32
delay = 10
'addr = 0
'byte_pos = 0
'Get the initial parameters
get_param:
addr = 0
byte_pos = 0
line=0
serin2 in_pin,ser_baud,[wait ("*"),STR in_ctl\9]
for index = 0 to 8
Lookdown in_ctl[index],["0123456789abcdef"],hex_nibble
in_ctl[index]=hex_nibble
next
delay = (in_ctl[7]<<4) | in_ctl[8]
buff_count = (in_ctl[1]<<4) | in_ctl[2]
addr.byte1 = (in_ctl[3] <<4) | in_ctl[4]
addr.byte0 = (in_ctl[5] <<4) | in_ctl[6]
buf_cnt = (buff_count - 1)
eepaddr = addr
j=in_ctl[0]
if j = 3 then lcd_loop 'Display directly on LCD
if j = 1 then eep_loop 'Load ext eeprom
if j = 2 then logo 'Display images loop
goto get_param


eep_loop:

serin2 in_pin,ser_baud,5000,get_param,[wait ("]"),STR in_array\buff_count] 'Wait for ] and the load in_array
for index = 0 to (buff_count - 1)
gosub find 'Get char and place in array
in_array[index]=hex_nibble
next
for index = 0 to (buff_count - 1) step 2
in_byte = (in_array[index]<<4) | (in_array[index+1]) 'Form a hex number MSB-LSB
I2CWRITE sda,scl,ctl,addr,[in_byte]
pause 5
addr=addr+1
next
goto eep_loop
lcd_loop:
serin2 in_pin,ser_baud,5000,get_param,[wait ("]"),STR in_array\buff_count] 'Wait for ] and the load in_array
for index = 0 to (buff_count - 1)
gosub find 'Get char and place in array
in_array[index]=hex_nibble
next

for index = 0 to (buff_count - 1) step 2
in_byte = (in_array[index]<<4) | (in_array[index+1]) 'Form a hex number MSB-LSB
gosub putbyte


next

goto lcd_loop
'*********** E N D ************
end
' **** END OF MAIN PROGRAM ****

Demon
- 30th April 2011, 02:53
It had the following text file for pinout:



GLIPIC BOARD Ver C and and Higher
=================================
The GL board 20 pin header has the following pinouts:
PIN ----- PIC PIN ------------ KS0108 pin
01---------- GND --------------- GND
02-----------Vdd 5v--------------Vdd
03---- wiper of 20k pot-----------Vo
04-----------PORTC.1--------------D/I
05---------- PORTC.2--------------R/W
06-----------PORTC.0-------------- E
07-----------PORTD.0--------------DB0
08-----------PORTD.1--------------DB1
09-----------PORTD.2--------------DB2
10-----------PORTD.3--------------DB3
11-----------PORTD.4--------------DB4
12-----------PORTD.5--------------DB5
13-----------PORTD.6--------------DB6
14-----------PORTD.7--------------DB7
15-----------PORTB.1--------------CS1
16-----------PORTB.1--------------CS2
17-----------PORTC.5-------------RESET
18-------one end of 20k pot----- Vee(connects to Vo via the 20k pot)
19-----------PORTE.1---Do not connect to KS0108 LCD*
20-----------PORTE.2---Do not connect to KS0108 LCD*

*If the LCD has a backlight LCD PINS 19 and 20 are used to power the backlight. Usually, for an LED backlight PIN19 is the A (anode) and PIN 20 is K (cathode). However, on some displays the order is reversed. Check LCD documentation before connecting power to them!
If you have a 128x64 KS0108 LCD with the above pinouts, then you can test out the GL board by running the Windows app GLUTIL2.EXE.


All the credit goes to the good people at Compsys.
http://www.compsys1.com/workbench/On_top_of_the_Bench/KS0108/ks0108_controller.html

I had saved these files back in 2005 when I was starting on LCDs.

pedja089
- 30th April 2011, 13:30
I first I tried so I just used a lookup instead of eeprom ....
Here's the code


trisb=0
trisd=0
portb=0
portd=0
symbol RW=portb.3
symbol RS = portb.2
symbol E = portb.4
symbol CS1 = portb.0
symbol CS2 = portb.1
symbol RST = portb.5
Symbol LCDDATA=portd
i var byte
X var byte
Y var byte
pocetak:
call init

LCDDATA=0
call clr
cs1=0
x=1
call setx

y=0
call sety
for i=0 to 63
Lookup i, [$00,$00,$FE,$FE,$FE,$FE,$1E,$1E,$1E,$1E,$1E,$1E,$1 E,$1E,$FE,$FE,$FC,$F8,$00,$FE,$FE,$FE,$FE,$0E,$0E, $0E,$0E,$0E,$0E,$0C,$00,$00,$00,$FE,$FE,$FE,$FE,$0 E,$0E,$0E,$0E,$0E,$0E,$0E,$FE,$FC,$F8,$F0,$00,0,$F E,$FE,$FE,$FE,$0E,$0E,$0E,$0E,$0E,$0E,$FE,$FE,$FC, $F8], LCDDATA
call pod
next i
x=2
y=0
call sety
call setx
for i=0 to 63
Lookup i, [$00,$00,$FF,$FF,$FF,$FF,$F0,$F0,$F0,$F0,$F0,$F0,$F 0,$F0,$FF,$FF,$7F,$3F,$00,$FF,$FF,$FF,$FF,$E0,$E0, $E0,$E0,$E0,$E0,$E0,$00,$00,$E0,$FF,$FF,$FF,$FF,$E 0,$E0,$C0,$00,$00,$00,$00,$FF,$FF,$FF,$FF,$00,0,$F F,$FF,$FF,$FF,$80,$80,$80,$80,$80,$80,$FF,$FF,$FF, $FF], LCDDATA
call pod
next i
x=3
y=0
call sety
call setx
for i=0 to 63
Lookup i, [$00,$00,$FF,$FF,$FF,$FF,$00,$00,$00,$00,$00,$00,$0 0,$00,$00,$00,$00,$00,$00,$FF,$FF,$FF,$FF,$01,$01, $01,$01,$01,$01,$01,$00,$00,$01,$FF,$FF,$FF,$FF,$0 1,$01,$01,$00,$00,$00,$00,$FF,$FF,$FF,$FF,$00,0,$F F,$FF,$FF,$FF,$07,$07,$07,$07,$07,$07,$FF,$FF,$FF, $FF], LCDDATA
call pod
next i

x=4
y=0
call sety
call setx
for i=0 to 63
Lookup i, [$00,$00,$FF,$FF,$FF,$FF,$00,$00,$00,$00,$00,$00,$0 0,$00,$00,$00,$00,$00,$00,$FF,$FF,$FF,$FF,$E0,$E0, $E0,$E0,$E0,$E0,$E0,$E0,$00,$00,$FF,$FF,$FF,$FF,$E 0,$E0,$E0,$E0,$E0,$E0,$E0,$FF,$FF,$FF,$FF,$00,0,$F F,$FF,$FF,$FF,$00,$00,$00,$00,$00,$00,$FF,$FF,$FF, $FF], LCDDATA
call pod
next i

LCDDATA=0
cs1=1
cs2=0

x=1
call setx
for i=0 to 63
Lookup i, [$00,$00,$FE,$FE,$FE,$FE,$1E,$1E,$1E,$1E,$1E,$1E,$1 E,$1E,$FE,$FE,$FC,$F8,$00,$FE,$FE,$FE,$FE,$1E,$1E, $1E,$1E,$1E,$1E,$FE,$FE,$FC,$F8,$00,$FE,$FE,$FE,$F E,$0E,$0E,$0E,$0E,$0E,$0E,$0E,$FE,$FE,$FC,$F8,$00, $00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$0 0,$00], LCDDATA
call pod
next i
x=2
call setx
for i=0 to 63
Lookup i, [$00,$00,$FF,$FF,$FF,$FF,$00,$00,$00,$00,$00,$00,$0 0,$00,$FF,$FF,$FF,$FF,$00,$FF,$FF,$FF,$FF,$80,$80, $80,$80,$80,$80,$FF,$FF,$FF,$FF,$00,$FF,$FF,$FF,$F F,$80,$80,$80,$80,$80,$80,$80,$FF,$FF,$FF,$FF,$00, $00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$0 0,$00], LCDDATA
call pod
next i
x=3
call setx
for i=0 to 63
Lookup i, [$00,$00,$FF,$FF,$FF,$FF,$00,$00,$00,$00,$00,$00,$0 0,$00,$FF,$FF,$FF,$FF,$00,$FF,$FF,$FF,$FF,$07,$07, $07,$07,$07,$07,$FF,$FF,$FF,$FF,$00,$07,$07,$07,$0 7,$07,$07,$07,$07,$07,$07,$07,$FF,$FF,$FF,$FF,$00, $00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$0 0,$00], LCDDATA
call pod
next i
x=4
call setx
for i=0 to 63
Lookup i, [$00,$00,$FF,$FF,$FF,$FF,$E0,$E0,$E0,$E0,$E0,$E0,$E 0,$E0,$FF,$FF,$FF,$FF,$00,$FF,$FF,$FF,$FF,$E0,$E0, $E0,$E0,$E0,$E0,$FF,$FF,$FF,$FF,$00,$00,$E0,$E0,$E 0,$E0,$E0,$E0,$E0,$E0,$E0,$E0,$FF,$FF,$FF,$FF,$00, $00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$0 0,$00], LCDDATA
call pod
next i
PAUSE 5000

cs1=1
cs2=1
CALL CLr
x=0
y=0
call setx
call sety
LCDDATA=0
CS2=1
cs1=0
y=10
x=1
call setx
call sety
for i=0 to 63
Lookup i, [$00,$7E,$12,$1E,$00,$00,$7E,$4A,$4A,$4A,$00,$7E,$4 2,$42,$3C,$00,$60,$40,$7E,$00,$60,$1C,$12,$1C,$60, $00,$7E,$42,$7E,$00,$7E,$4A,$7E,$00,$5E,$52,$7E,$0 0], LCDDATA
call pod
next i

y=26
x=3
call setx
call sety

for i=0 to 37
Lookup i, [$00,$3E,$40,$3C,$02,$3C,$40,$3E,$00,$00,$3E,$40,$3 C,$02,$3C,$40,$3E,$00,$00,$3E,$40,$3C,$02,$3C,$40, $3E,0,64,0,$7E,$4A,$4A,$4A,$00,$7E,$40,$40,$00], LCDDATA
call pod
next i

cs2=0
cs1=1

x=3
call setx
for i=0 to 63
Lookup i, [$7E,$4A,$4A,$4A,$00,$7E,$10,$18,$24,$42,$02,$7E,$0 2,$02,$00,$7E,$0A,$1A,$6E,$00,$3C,$42,$42,$42,$3C, $00,$7E,$0C,$30,$7E,$00,$00,$7E,$00,$7E,$10,$18,$2 4,$42,$00,$60,$1C,$12,$1C,$60,$00,$40,$00,$7E,$48, $78,$00,$60,$1C,$12,$1C,$60,0], LCDDATA
call pod
next i
cs2=1
cs1=1
pause 2000
for i=63 to 32 step -1
LCDDATA=192+i
call kom
pause 400
next i

goto pocetak
end


Init:
x=0
y=0
rw=0
cs1=0
cs2=0
e=1
LCDDATA=0
rst=0
pause 1
rst=1
cs1=1
cs2=1

call Dispon
LCDDATA=192
call kom
return

Pod:
rs=1
e=0
pauseus 1
e=1
return
Kom:
rs=0
e=0
pauseus 1
e=1
return

SetX:
LCDDATA=184+x
call Kom
return

SetY:
LCDDATA=64+y
call Kom
return

Clr:
for x=0 to 7
call setx
y=0
call sety
LCDDATA=0
for i=0 to 63
call pod
next i
next x
return

DispOff:
LCDDATA=62
call kom
return

DispOn:
LCDDATA=63
call kom
return


But then the problem was that every time I want to print something, I have to draw a picture of the entire display, or create the font, and for each letter copy 5 bytes. Then I found a forum for the LCD of Nokia 3310, and tried to correct for KS0108.
I hope to be able to finish it, but now I am busy doing other things, so...

srspinho
- 10th May 2012, 22:25
Hi guys,

I have been talking to our friend pedja089 about the lib in the first lib.

I did some good improvements, and now, I can print strings and Variables correctly.

I have already started writing some basic graphic routines, and I would like to publish it here as a contribution if our friend pedja089 agree with it, and I think he will.

To test it I did a small simple digital clock, just to check if printing is working.

The code compiles ok when I use a 18F4550 as a target controller. The hex's size is about 4500 bytes.

But, when I change to the 16F877, (which has 8kb available) it always show me the following erros :

Message[303] c:\teste_~1\glcd_p~1.asm 207 : Program word too large.Truncated to core size. (6573)
Message[303] c:\teste_~1\glcd_p~1.asm 207 : Program word too large.Truncated to core size. (7420)
Message[303] c:\teste_~1\glcd_p~1.asm 207 : Program word too large.Truncated to core size. (436C)
Message[303] c:\teste_~1\glcd_p~1.asm 207 : Program word too large.Truncated to core size. (6F63)
Message[303] c:\teste_~1\glcd_p~1.asm 207 : Program word too large.Truncated to core size. (6800)
Message[303] c:\teste_~1\glcd_p~1.asm 207 : Program word too large.Truncated to core size. (7820)

The line 207 in the Asm code is :

data Str, 0

from the macro :

PrintStr macro x, y, Str
local TheString, OverStr
goto OverStr
TheString
data Str, 0
OverStr
MOVE?CB x, _GLCD_X
MOVE?CB x, _GLCD_SX
MOVE?CB y, _PosY
MOVE?CW TheString, _GLCD_Addr
L?CALL _GLCD_StringOut
endm

I admit that I am absolutely noob on writing/uderstanding assembler.

Does some one have any ideao of what is wrong with this Macro.

Is this restricted to 18F series ?

Thank you !

regards,

Sérgio

mister_e
- 11th May 2012, 10:37
Yup 18F don't work the same way for embedded strings. You may want to have a look at least at the following.

http://www.pbpgroup.com/modules/wfsection/article.php?articleid=10

Notice the use of da vs Data and how to retrieve them.

You could also have a look at my NOKIA driver/wrapper.
http://www.picbasic.co.uk/forum/showthread.php?t=327&page=54

srspinho
- 11th May 2012, 14:00
Thank you Mister_e !


I will spend some time this weekend trying to make the Lib better.

I would like to make it work with 16F series (877 and above) and 18F and make it public.

There are a lot of nice and cheap KS0108 for sale on eBay. I bought some from the seller Wide Hk and they are small and nice. Perfect for embeded solutions.

Well, let´s study the posts and try to fix it !

regards,

Sérgio

muddy0409
- 23rd October 2014, 02:26
I know there are heaps of different GLCD controller types around, but surely the gurus at MELabs could toss a coin and pick one that they consider to be the most popular (KS0108?) and do some GLCDOUT type stuff for that controller? After all, they did exactly that when they selected the Hitachi 447?? (whatever) controller they wrote the LCDOUT stuff for? That has proven quite usable?
My 2 cents worth, but I won't hold my breath.

Ioannis
- 23rd October 2014, 08:44
Or a couple of different libraries to cover a few flavors of GLCDs. Like other compilers do.

Ioannis

HenrikOlsson
- 23rd October 2014, 09:38
Sure, if they did it I wouldn't protest against it.
But, as you say, there are plenty of graphic LCD controllers but basically only ONE standard for characters based displays and that IS the HD44780 (or compatibles). It's also a lot easier to drive than the graphical controllers, trust me I've tried with the RA6963C and the SSD1307. One issue is that the HD44780 basically just works and doesn't care about the number of characters per line etc, it doesn't care about the size (appart from number of lines) of the panel it's actually driving. But the graphical controllers are usually quite flexible when it comes to resolution of the panel and needs to be configured properly (not to mention timings, multiplex ratios etc etc.

My experience with MeLabs is that what they do they do properly and to do a general purpose GLCD driver to their standars is a LOT of work.

I wonder what they ARE working on at MELABS HQ nowadays, there's been no updates to compiler for 18 months. Darrels recent and unfortunate passing must have put a real dent in available resources :(

/Henrik.