RE: [bascom] AVR hangs after 'config graphlcd" command? KS0108 display problem!
From |
Cseh Róbert <R.Cseh@Richter.hu> |
Date |
Tue, 2 May 2006 12:30:48 +0200 |
Thread-index |
AcZtsDEiHaLqi9rkS9O79LQ/hH7GawAIw3gw |
Thread-topic |
[bascom] AVR hangs after 'config graphlcd" command? KS0108 display problem! |
The working program with Bascom1.11.8.1 demo:
There is not lib, only lbx file!
The display is KS0108 chipset 64*128 pixel LCD.
Good luck,
Robert
$regfile = "m16def.dat" ' specify the
used micro
$crystal = 14745600 ' used crystal
frequency
$baud = 9600 ' use baud rate
'some routines to control the display are in the glcdKS108.lib file
'$lib "glcdKS108.lib"
$lib "glcdKS108.lbx"
Config Pind.5 = Output 'LCD
háttérvilágítás
Portd.5 = 1
Print "Cnf"; ' printing will
still work as only the receiver pin is disabled
'First we define that we use a graphic LCD
Config Graphlcd = 128 * 64sed , Dataport = Portb , Controlport = Porta , Ce =
1 , Ce2 = 2 , Cd = 5 , Rd = 4 , Reset = 0 , Enable = 3
'The dataport is the portname that is connected to the data lines of the LCD
'The controlport is the portname which pins are used to control the lcd
'CE =CS1 Chip select
'CE2=CS2 Chip select second chip
'CD=Data/instruction
'RD=Read
'RESET = reset
'ENABLE= Chip Enable
'Dim variables (y not used)
Dim X As Byte , Y As Byte
Print "-Cls";
Cls
Wait 1
'specify the font we want to use
Setfont Font8x8
Print "-1";
'You can use locate but the columns have a range from 1-128
'When you want to show somthing on the LCD, use the LDAT command
'LCDAT Y , COL, value
Lcdat 1 , 1 , "123"
'lcdat accepts an additional param for inversing the text
Lcdat 2 , 1 , "123" , 1 ' will inverse
the text
'Now use a different font
'Setfont Font8x8
'since the 16*16 font uses 2 rows, show on row 3
'Lcdat 1 , 1 , "2345"
'Lcdat 2 , 56 , "2345656"
Print "-Gr";
Wait 1
Line(0 , 0) -(127 , 64) , 1 'make line
Wait 2
Line(0 , 0) -(127 , 64) , 0 'remove line
For Y = 1 To 20
Circle(30 , 30) , Y , 1
Waitms 100
Next
Wait 1
Glcdcmd &H3E , 1 : Glcdcmd &H3E , 2 ' both displays
off
Wait 1
Glcdcmd &H3F , 1 : Glcdcmd &H3F , 2 'both on
'GLCDCMD accepts an additional param to select the chip
'With multiple, GLCDCMD statements, it is best to specify the chip only the
first time
Print "-Pic"
Showpic 0 , 0 , Plaatje 'show a
comnpressed picture
End 'end program
'we need to include the font files
'Notice that this is a testfont with only numbers defined !
'$include "smallfont8x8.font"
$include "font8x8.font"
'$include "font16x16.font"
Plaatje:
'include the picture data
$bgf "ks108.bgf"