muss man sein Programm erneut compilieren, sonst haben die Einstellungen
keine Auswirkung auf den Hex-Code, den man hernach in den µC brennt.
'--------------------------------------------------------------------
' EADIP122.BAS
' demonstrates the SED1520 based graphical display support
'--------------------------------------------------------------------
'some routines to control the display are in the glcdsed1520.lib file
'IMPORTANT : since the SED1520 uses 2 chips, the columns are split into 2 of 60.
'This means that data after column 61 will not print correct. You need to locate the data on the second halve
$regfile = "m16def.dat"
$crystal = 8000000
$baud = 0 ' use baud rate
$hwstack = 32 ' default use 32 for the hardware stack
$swstack = 10 ' default use 10 for the SW stack
$framesize = 40 ' default use 40 for the frame space
$lib "glcdsed1520.lbx"
$initmicro 'user connected RESET of LCD to pin portd.7, kann geändert werden
'Routine _init_micro
'First we define that we use a graphic LCD
'notice that this library supports extended syntax where you can specify different port pins for CD and RD
'The connections of the LCD used in this demo
' LCD pin connected to LCD pin
' ______________________________________________
'|9 = D2 D3 = 10 |
'|8 = D1 D4 = 11 |
'|7 = D0 D5 = 12 |
'|6 = E1 D6 = 13 |
'|5 = R/W D7 = 14 |
'|4 = A0 E2 = 15 |
'|3 = VEE, negative Spannung RES = 16 |
'|2 = VDD (+5V) A = 17 |
'|1 = VSS (GND) C = 18 |
' ----------------------------------------------
Config Graphlcd = 128 * 64sed , Dataport = Porta , Controlport = Portd , Ce = 6 , Ce2 = 2 , Cd = 4 , Rd = 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 = E1 Chip Enable/ Chip select
'CE2= E2 Chip select / chip enable of chip 2
'CD = A0 Data direction
'RD = R/W H=Read
'Dim variables (y not used)
Dim X As Byte , Y As Byte
'clear the screen
Cls
Wait 1
'specify the font we want to use
Setfont Font8x8
'You can use locate but the columns have a range from 1-132
'When you want to show somthing on the LCD, use the LDAT command
'LCDAT Y , COL, value
Lcdat 1 , 1 , "123456789012345"
Lcdat 3 , 80 , "11"
'lcdat accepts an additional param for inversing the text
Lcdat 4 , 100 , "Inverse" , 1 ' will inverse the text
Wait 2
Line(0 , 0) -(180 , 31) , 1
Wait 2
Showpic 0 , 0 , Plaatje 'show a comnpressed picture
Wait 2
Cls
Box(0 , 0) -(60 , 20) , 1
Wait 2
Cls
'create a bargraph effect
Boxfill(0 , 0) -(60 , 10) , 1
Boxfill(2 , 2) -(40 , 8) , 0
Setfont Font16x16
Lcdat 1 , 80 , "16x"
End 'end program
'-------------------------------------------------------------------------------
' WICHTIG, hier wird der Resetpin angesteuert
_init_micro: 'Reset für LCD
Config Pind.7 = Output
Portd.7 = 0
Wait 1
Portd.7 = 1
Return
'-------------------------------------------------------------------------------
'in diesen Abschitt, Schriften und Grafiken eintragen,
'mussen im (gleichem) Verzeichnis wie z.B. EADIP122.BAS
'we need to include the font files
$include "font8x8.font"
$include "font16x16.font"
Plaatje:
'include the picture data
$bgf "smile.bgf"
$lib "glcdLC7981.lib"
Config [B]Graphlcd = 160 * 80[/B] , Dataport = Portb , Controlport = Portd , Rs = 0 , Rw = 2 , [U]Cd = 1 , Wr = 3 , Rd = 2 , Reset = 5 , Mode = 6[/U]
klar doch. Ich werd in meinem FAQ-Inhaltsverzeichnis noch die TypenWird die Datenbank gepflegt?
'____________________________________________________________________
'
'Name : Atmega16_LCD_20x2.bas
'Autor : ACVision (c) 2006 - 2010, M.Gewohn
'Funktion : LCD - Test: WINSTAR WH2002A-YYH-JT mit HB, KS0066- kompatibel
'µC : Atmega16 - 16
'____________________________________________________________________
'
$regfile = "m16def.dat"
$crystal = 8000000
'$baud = 38400
$hwstack = 40
$swstack = 20
$framesize = 40
'____________________________________________________________________
'_____ Compiler- Direktiven/ LIB's einbinden ______________________________
'
'____________________________________________________________________
'_____ Ports definieren _________________________________________________
'
DDRA = &B0000_0000 ' PortB - Eingang
portA = &B1111_1111 ' Pullups aktiviert
'
DDRB = &B0000_0000 ' PortB - Eingang
portb = &B1111_1111 ' Pullups aktiviert
'
DDRC = &B1111_1111 ' PortC - Ausgang
portc = &B0000_0000 ' Pullups deaktiviert
'
DDRD = &B0000_0000 ' PortD = Eingang
portd = &B1111_1111 ' Pullups aktiviert'
'____________________________________________________________________
'_____ Variablen - Subroutinen - Label ____________________________________
'
'____________________________________________________________________
'_____ Pins zuweisen __________________________________________________
'
Config Lcd = 20 * 2
Config Lcdpin = pin , RS = Portc.1 , E = Portc.2 , DB4 = Portc.4 , DB5 = Portc.5 , DB6 = Portc.6 , DB7 = Portc.7
'Config Lcdbus = 4
'
'____________________________________________________________________
'_____ Hauptprogramm ________________________________________________
'
waitms 200
cursor off
cls
'
locate 1 , 1
Lcd "Hallo AVR- Forum,"
locate 2 , 1
Lcd "20x2 Winstar WH2002A"
'
do
loop
End
'____________________________________________________________________
'
'Name : Atmega16_LCD_24x2.bas
'Autor : ACVision (c) 2006 - 2010, M.Gewohn
'Funktion : LCD - Test: Seiko LS 2432 mit KS0066
'µC : Atmega16 - 16
'____________________________________________________________________
'
$regfile = "m16def.dat"
$crystal = 8000000
'$baud = 38400
$hwstack = 40
$swstack = 20
$framesize = 40
'____________________________________________________________________
'_____ Compiler- Direktiven/ LIB's einbinden ______________________________
'
'____________________________________________________________________
'_____ Ports definieren _________________________________________________
'
DDRA = &B0000_0000 ' PortB - Eingang
portA = &B1111_1111 ' Pullups aktiviert
'
DDRB = &B0000_0000 ' PortB - Eingang
portb = &B1111_1111 ' Pullups aktiviert
'
DDRC = &B1111_1111 ' PortC - Ausgang
portc = &B0000_0000 ' Pullups deaktiviert
'
DDRD = &B0000_0000 ' PortD = Eingang
portd = &B1111_1111 ' Pullups aktiviert'
'____________________________________________________________________
'_____ Variablen - Subroutinen - Label ____________________________________
'
'____________________________________________________________________
'_____ Pins zuweisen __________________________________________________
'
Config Lcd = 24 * 2
Config Lcdpin = pin , RS = Portc.1 , E = Portc.2 , DB4 = Portc.4 , DB5 = Portc.5 , DB6 = Portc.6 , DB7 = Portc.7
'Config Lcdbus = 4
'
'____________________________________________________________________
'_____ Hauptprogramm ________________________________________________
'
waitms 200
cursor off
cls
'
locate 1 , 1
Lcd "Hallo AVR- Forum,"
locate 2 , 1
Lcd "LCD 24x2 - Seiko LS 2432"
'
do
loop
End
besten Dank :hello:gern. Beide Displays können unter Bascom problemlos angesteuert werden.
Hier die Beispielcodes, die Datenblätter sind leider zu gross für den Anhang.
- WINSTAR: KS0066- kompatibel
- Seiko: KS0066l
'____________________________________________________________________
'
'Name : Atmega16_LCD_20x4.bas
'Autor : ACVision (c) 2006 - 2010, M.Gewohn
'Funktion : LCD - Test: POWERTIP 2004-AB, 20x4, Controller HD44780
'µC : Atmega16 - 16
'____________________________________________________________________
'
$regfile = "m16def.dat"
$crystal = 8000000
'$baud = 38400
$hwstack = 40
$swstack = 20
$framesize = 40
'____________________________________________________________________
'_____ Compiler- Direktiven/ LIB's einbinden ______________________________
'
'____________________________________________________________________
'_____ Ports definieren _________________________________________________
'
DDRA = &B0000_0000 ' PortB - Eingang
portA = &B1111_1111 ' Pullups aktiviert
'
DDRB = &B0000_0000 ' PortB - Eingang
portb = &B1111_1111 ' Pullups aktiviert
'
DDRC = &B1111_1111 ' PortC - Ausgang
portc = &B0000_0000 ' Pullups deaktiviert
'
DDRD = &B0000_0000 ' PortD = Eingang
portd = &B1111_1111 ' Pullups aktiviert'
'____________________________________________________________________
'_____ Variablen - Subroutinen - Label ____________________________________
'
'____________________________________________________________________
'_____ Pins zuweisen __________________________________________________
'
Config Lcd = 20 * 4
Config Lcdpin = pin , RS = Portc.1 , E = Portc.2 , DB4 = Portc.4 , DB5 = Portc.5 , DB6 = Portc.6 , DB7 = Portc.7
Config Lcdbus = 4
'
'____________________________________________________________________
'_____ Hauptprogramm ________________________________________________
'
waitms 200
cursor off
cls
'
locate 1 , 1
Lcd "Hallo AVR - Forum,"
locate 2 , 1
Lcd "Wintek 2004-AB,"
locate 3 , 1
lcd "20x4 mit HD44780."
locate 4 , 1
lcd "Grandpa @ AVR-Praxis" '
do
loop
End