'--------------------------------------------------------------------------
'Name: Mega32 GrafikBoard mit Display 128x64
'AVR Mega32
'Funktion: Test der Mega32 Platine mit GrafikDisplay
'-------------------------------------------------------------------------
$regfile = "m32def.dat"
$crystal = 14745600
$hwstack = 32
$swstack = 10
$framesize = 40
'Anschluss:
'-----------------------------------------------------------------
'Display Mega32
'
'1 GND GND
'2 Vdd +5V
'3 Vo zum 10k Poti Schleifer
'4 DI/CD PortA.3
'5 Rd/Wr PortA.4
'6 Enable PortA.5
'7-14 D0-D7 PortC.0 ... C.7
'15 Cs1 PORTA.1
'16 Cs2 PortA.2
'17 RESET PORTA.0
'18 Vout zum Poti , andere Seite Poti auf Minus
'19 Led + Hintergrundbeleuchtung +
'20 Led - Hintergrundbeleuchtung -
'-------------------------------------------------------------------------
'-------------------------------------------------------------------------
Dim X As Byte
Dim Y As Byte
$lib "glcdKS108.lbx"
'-- DisplayAnschluss ------------------------------------------------------
'Datenport = PortC Bit 0...7
'Controllport = PortA
' Reset= Bit0
' CS1= Bit1
' CS2= Bit2
' DI/Cd= Bit3
' Rd/Wr= Bit4
' Enable=Bit5
'Wichtig! Der Kontrollport muss komplett auf einem Port liegen!
Config Graphlcd = 128 * 64sed , Dataport = Portc , Controlport = Porta , Ce = 1 , Ce2 = 2 , Cd = 3 , Rd = 4 , Reset = 0 , Enable = 5
Cls ' Löscht das Display
'--- Startbildschirm------------------------------------------------------
For Y = 1 To 30
Circle(64 , 32) , Y , 1
Waitms 100
Next
Wait 2
'Zeigt ein Bild
Showpic 0 , 0 , Demo
Wait 2
Cls
'-------------------------------------------------------------------------
'locate sollte auch funktionieren ?
Locate 1 , 1
Lcd "Test .....Grafik"
Locate 2 , 1 : Lcd "0123456789"
Wait 2
Cls Text
' zieht eine Linie PSET X,Y, ON/OFF
' PSET on.off param is 0 to clear a pixel and any other value to turn it on
For X = 0 To 140
Pset X , 20 , 255 ' set the pixel
Next
Wait 2
'-----------------------------------------------------------------------
Main:
Do
Loop
End
'-------------------------------------------------------------------------
Demo: 'include BildDaten
$bgf "demo.bgf