 |
www.elektronik.si Forum o elektrotehniki in računalništvu
|
Poglej prejšnjo temo :: Poglej naslednjo temo |
Avtor |
Sporočilo |
rplink3r Član


Pridružen-a: Tor 06 Feb 2007 20:02 Prispevkov: 507 Aktiv.: 2.27 Kraj: Levec
|
Objavljeno: Tor Nov 13, 2007 12:54 am Naslov sporočila: 128x64 LCD problem |
|
|
Prvič delam z grafičnim displejem, zato sem se spravil na bascom primer KS108,
povezal sem lcd tako kot naj bi bil povezan PortA=Data PortC=Control, vezje je sestavljeno z Atmega16 ter eksternim oscilatorjem 11,0592Mhz. Dokler sem imel nastavljeno zadevo na eksterni oscilator, mi je po lcd-ju sicer nekaj risalo, vendar same zmazke. Spremenil sem lfuse, da imam interni 1Mhz oscilator(isto kodo v programu), in zadeva začne izpisovati pravilno.
Nevem kaj to ne dela.
Lcd:
http://www.display-elektronik.de/DEM128064BSYH-PY.pdf _________________ "The statement below is false."
"The statement above is true." |
|
Nazaj na vrh |
|
 |
mucek Član


 
Pridružen-a: Tor 01 Avg 2006 10:47 Prispevkov: 5531 Aktiv.: 24.04 Kraj: Domzale
|
Objavljeno: Tor Nov 13, 2007 9:17 am Naslov sporočila: |
|
|
Imaš v compilerju nastavljeno frekvenco kristala, ki ga uporabljaš (sicer se ti koda skompajla za neko default (očitno 1MHz) frekvenco)?
Kateri programski jezik sploh uporabljaš?
LP, Grega |
|
Nazaj na vrh |
|
 |
rplink3r Član


Pridružen-a: Tor 06 Feb 2007 20:02 Prispevkov: 507 Aktiv.: 2.27 Kraj: Levec
|
Objavljeno: Tor Nov 13, 2007 10:35 am Naslov sporočila: |
|
|
Koda: |
'-----------------------------------------------------------------------------------------
'name : ks108.bas
'copyright : (c) 1995-2005, MCS Electronics
'purpose : demonstrates the KS108 based graphical display support
'micro : Mega323
'suited for demo : no
'commercial addon needed : no
'-----------------------------------------------------------------------------------------
$regfile = "m16def.dat" ' specify the used micro
$crystal = 1000000 ' used crystal frequency ' use baud rate
'some routines to control the display are in the glcdKS108.lib file
$lib "glcdKS108.lbx"
'First we define that we use a graphic LCD
Config Graphlcd = 128 * 64sed , Dataport = Porta , Controlport = Portc , Ce = 0 , Ce2 = 1 , Cd = 4 , Rd = 3 , Reset = 2 , Enable = 6 , Mode = 8
'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
Cls
'specify the font we want to use
Setfont Font8x8
'You can use locate buant to show somthing on the LCD, use the LDAT command
'LCDATt the columns have a range from 1-128
'When you w 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"
Wait 1
Cls
Cls
Line(0 , 0) -(128 , 64) , 1 'make line
Wait 2
Line(0 , 0) -(128 , 64) , 0 'remove line
For Y = 1 To 20
Circle(30 , 30) , Y , 1
Waitms 100
Next
Cls
Cls
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
Cls
Cls
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"
|
Misliš tole:
$crystal = 1000000
nastavil sem na 11059200, ko sem imel oscilator. _________________ "The statement below is false."
"The statement above is true." |
|
Nazaj na vrh |
|
 |
dkone Član

Pridružen-a: Sre 07 Mar 2007 18:53 Prispevkov: 2116 Aktiv.: 9.50 Kraj: Krško
|
Objavljeno: Tor Nov 13, 2007 10:44 am Naslov sporočila: |
|
|
Jaz sem probal isti LCD na atmegi8518 in pa z oscilatorjem 12mhz in je delovalo BP. Potem sem se malo igral z notranjim in je tudi delovalo. Kaj če pa daš 12Mhz zunanji? _________________ Denis |
|
Nazaj na vrh |
|
 |
rplink3r Član


Pridružen-a: Tor 06 Feb 2007 20:02 Prispevkov: 507 Aktiv.: 2.27 Kraj: Levec
|
Objavljeno: Tor Nov 13, 2007 11:00 am Naslov sporočila: |
|
|
Bom probal 12Mhz , samo z internim 8Mhz tudi noče delat. _________________ "The statement below is false."
"The statement above is true." |
|
Nazaj na vrh |
|
 |
rplink3r Član


Pridružen-a: Tor 06 Feb 2007 20:02 Prispevkov: 507 Aktiv.: 2.27 Kraj: Levec
|
Objavljeno: Tor Nov 13, 2007 7:23 pm Naslov sporočila: |
|
|
Sprobal sem z 12Mhz kvarcem, zadeva ne deluje, zanimivo pa, da pri 4Mhz in 1Mhz deluje vendar vseeno nekam čudno(časi)...
Vklopil sem Ckopt
Ter eksternal crystal 16k CK + 64ms _________________ "The statement below is false."
"The statement above is true." |
|
Nazaj na vrh |
|
 |
rplink3r Član


Pridružen-a: Tor 06 Feb 2007 20:02 Prispevkov: 507 Aktiv.: 2.27 Kraj: Levec
|
Objavljeno: Tor Nov 13, 2007 9:35 pm Naslov sporočila: |
|
|
Hmm, zgleda da je bila napaka čisto softwerska, sem mal pobrisal ven pa napisal nekaj bol preprosto, sicer nevem kaj je bilo narobe, ampak takšnale koda mi trenutno dela lepo na 11059200 oscilatorju.
Če komu kdaj prav pride...
Koda: |
'-----------------------------------------------------------------------------------------
'name : ks108.bas
'copyright : (c) 1995-2005, MCS Electronics
'purpose : demonstrates the KS108 based graphical display support
'micro : Mega323
'suited for demo : no
'commercial addon needed : no
'-----------------------------------------------------------------------------------------
$regfile = "m16def.dat" ' specify the used micro
$crystal = 11059200
$hwstack = 32
$swstack = 10
$framesize = 40
' used crystal frequency ' use baud rate
$baud = 19200
'some routines to control the display are in the glcdKS108.lib file
$lib "glcdKS108.lbx"
'First we define that we use a graphic LCD
Config Graphlcd = 128 * 64sed , Dataport = Porta , Controlport = Portc , Ce = 0 , Ce2 = 1 , Cd = 4 , Rd = 3 , Reset = 2 , Enable = 6 , Mode = 8
'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
'specify the font we want to use
Setfont Font8x8
Do
Cls
Wait 1
Line(0 , 0) -(127 , 64) , 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 , "12345678910"
Lcdat 2 , 56 , "2345656"
Wait 1 '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
Cls
Showpic 0 , 0 , Test
Wait 1
Loop
'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"
Test:
'include the picture data
$bgf "ks108.bgf"
|
 _________________ "The statement below is false."
"The statement above is true." |
|
Nazaj na vrh |
|
 |
mucek Član


 
Pridružen-a: Tor 01 Avg 2006 10:47 Prispevkov: 5531 Aktiv.: 24.04 Kraj: Domzale
|
Objavljeno: Sre Nov 14, 2007 11:54 am Naslov sporočila: |
|
|
Po mojem je bila problematična tale vrstica:
Koda: |
$crystal = 11059200 |
Zdaj si zadevo očitno popravil in dela.
LP, Grega |
|
Nazaj na vrh |
|
 |
rplink3r Član


Pridružen-a: Tor 06 Feb 2007 20:02 Prispevkov: 507 Aktiv.: 2.27 Kraj: Levec
|
Objavljeno: Čet Nov 15, 2007 3:21 pm Naslov sporočila: |
|
|
Ne, vrstico "$crystal = 11059200" sem pravilno nastavljal.
Bom pa preveril, kaj je delalo probleme, trenutno pa nimam časa. _________________ "The statement below is false."
"The statement above is true." |
|
Nazaj na vrh |
|
 |
|
|
Ne, ne moreš dodajati novih tem v tem forumu Ne, ne moreš odgovarjati na teme v tem forumu Ne, ne moreš urejati svojih prispevkov v tem forumu Ne, ne moreš brisati svojih prispevkov v tem forumu Ne ne moreš glasovati v anketi v tem forumu Ne, ne moreš pripeti datotek v tem forumu Ne, ne moreš povleči datotek v tem forumu
|
Uptime: 500 dni
Powered by phpBB © 2001, 2005 phpBB Group
|