Mr-400-Volt
03.08.2008, 20:58
Hier mal der Code, der erst am anfang ist.................
$regfile "m16def.dat"
$crystal = 12000000
Config Graphlcd = 240 * 64 , Dataport = Portb , Controlport = Portd , Ce = 1 , Cd = 0 , Wr = 3 , Rd = 2 , Reset = 4 , Fs = 4 , Mode = 6
Config Timer1 = Timer , Prescale = 256
Deflcdchar 0 , 32 , 4 , 14 , 21 , 4 , 4 , 4 , 32
Deflcdchar 1 , 32 , 4 , 4 , 4 , 21 , 14 , 4 , 32
Deflcdchar 3 , 32 , 4 , 8 , 31 , 31 , 2 , 4 , 32
On Timer1 U_lade
Const Timervorgabe = 18661
Enable Timer1
Enable Interrupts
Dim Hauptmenue As Byte
Dim Ladestrom(4) As Word
Dim Entladestrom(4) As Word
Dim Erhaltungsladung(4) As Byte
Dim Ladeschacht As Byte
Dim Ladespannung(4) As Single
Dim X As Byte , Y As Byte , B As Byte
Dim Menue_y As Byte
Dim Sekunde As Word
For X = 1 To 4
Ladestrom(x) = 500
Entladestrom(x) = 100
Erhaltungsladung(x) = 10
Next X
Hauptmenue:
Hauptmenue = 1
Menue_y = 1
Cls
Cursor Blink
Locate 1 , 1
Lcd "************ Akku Lader Pro ************"
Locate 2 , 1
Lcd "1 - Laden"
Locate 3 , 1
Lcd "2 - Entladen"
Locate 4 , 1
Lcd "3 - Erhaltungsladung"
Locate 5 , 1
Lcd "4 - Akku Formatieren"
Locate 6 , 1
Lcd "5 - Automatik"
Locate 7 , 1
Lcd "6 - Einstellungen"
Locate 8 , 1
Lcd "****************************************"
Do
Locate Y , 1
If Pinc.0 = 0 Then
Menue_y = Menue_y + 1
If Menue_y > 6 Then Menue_y = 6
Gosub Warte
End If
If Pinc.1 = 0 Then
Menue_y = Menue_y - 1
If Menue_y < 1 Then Menue_y = 1
Gosub Warte
End If
Y = Menue_y + 1
If Pinc.2 = 0 Then
Select Case Menue_y
Case 1 : Goto Laden
Case 2 : Goto Entladen
Case 3 : Goto Erhaltungsladung
Case 4 : Goto Formatieren
Case 5 : Goto Automatik
Case 6 : Goto Einstellungen
End Select
End If
Waitms 100
Loop
Laden:
Cls
Cursor Off
Locate 1 , 1
Lcd "Schacht1 Schacht2 Schacht3 Schacht4 "
Locate 3 , 1
Lcd "I=" ; Ladestrom(1) ; "mA"
Locate 3 , 11
Lcd "I=" ; Ladestrom(2) ; "mA"
Locate 3 , 21
Lcd "I=" ; Ladestrom(3) ; "mA"
Locate 3 , 31
Lcd "I=" ; Ladestrom(4) ; "mA"
Locate 4 , 1
Lcd "U=" ; Ladespannung(1) ; "V"
Locate 4 , 11
Lcd "U=" ; Ladespannung(2) ; "V"
Locate 4 , 21
Lcd "U=" ; Ladespannung(3) ; "V"
Locate 4 , 31
Lcd "U=" ; Ladespannung(4) ; "V"
Wait 5
Goto Hauptmenue
Entladen:
Cls
Locate 1 , 1
Lcd "************ Akkus Entladen ************"
Wait 3
Goto Hauptmenue
Erhaltungsladung:
Cls
Locate 1 , 1
Lcd "*********** Erhaltungsladung ***********"
Wait 3
Goto Hauptmenue
Formatieren:
Cls
Locate 1 , 1
Lcd "********** Akkus Formatieren ***********"
Wait 3
Goto Hauptmenue
Automatik:
Cls
Locate 1 , 1
Lcd "********** Automatik-Programm **********"
Wait 3
Goto Hauptmenue
Einstellungen:
Cls
X = 1
Locate 1 , 1
Lcd "************ Einstellungen ************"
Locate 3 , 1
Lcd "I-Laden 1 :" ; Ladestrom(1) ; "mA"
Locate 3 , 20
Lcd "I-Laden 2 :" ; Ladestrom(2) ; "mA"
Locate 4 , 1
Lcd "I-Laden 3 :" ; Ladestrom(3) ; "mA"
Locate 4 , 20
Lcd "I-Laden 4 :" ; Ladestrom(4) ; "mA"
Locate 5 , 1
Lcd "I-Entl. 1 :" ; Entladestrom(1) ; "mA"
Locate 5 , 20
Lcd "I-Entl. 2 :" ; Entladestrom(2) ; "mA"
Locate 6 , 1
Lcd "I-Entl. 3 :" ; Entladestrom(3) ; "mA"
Locate 6 , 20
Lcd "I-Entl. 4 :" ; Entladestrom(4) ; "mA"
Locate 7 , 1
Lcd "I-Erha. 1 :" ; Erhaltungsladung(1) ; "mA"
Locate 7 , 20
Lcd "I-Erha. 2 :" ; Erhaltungsladung(2) ; "mA"
Locate 8 , 1
Lcd "I-Erha. 3 :" ; Erhaltungsladung(3) ; "mA"
Locate 8 , 20
Lcd "I-Erha. 4 :" ; Erhaltungsladung(4) ; "mA"
Wait 5
Goto Hauptmenue
U_lade:
Timer1 = Timervorgabe
Incr Sekunde
Return
Warte:
If Pinc.0 = 0 Then Goto Warte
If Pinc.1 = 0 Then Goto Warte
Return
End 'end program
peterfido
03.08.2008, 21:41
Eigene Zeichen kannst du bei diesem Display nicht mit deflcdchar erstellen.
Ich rufe am Anfang des Programmes nach dem Display Init folgende Sub auf, welche eigene Zeichen zum Display schickt, welche dann ab chr(160) zur Verfügung stehen:
Sub Sonderzeichen()
$asm
ldi r24,&h03 ;CG-RAM
rcall _GWrite_Data
clr r24
rcall _GWrite_Data
ldi r24,&H22
rcall _GWrite_Cmd
clr r24 ;CG-RAM komplett gefüllt - 160
rcall _GWrite_Data
ldi r24,&h1c
rcall _GWrite_Data
ldi r24,&H24
rcall _GWrite_Cmd
ldi r24,&hff
rcall _GWrite_Data
ldi r24,&Hc0
rcall _GWrite_Cmd
ldi r24,&hff
rcall _GWrite_Data
ldi r24,&Hc0
rcall _GWrite_Cmd
ldi r24,&hff
rcall _GWrite_Data
ldi r24,&Hc0
rcall _GWrite_Cmd
ldi r24,&hff
rcall _GWrite_Data
ldi r24,&Hc0
rcall _GWrite_Cmd
ldi r24,&hff
rcall _GWrite_Data
ldi r24,&Hc0
rcall _GWrite_Cmd
ldi r24,&hff
rcall _GWrite_Data
ldi r24,&Hc0
rcall _GWrite_Cmd
ldi r24,&hff
rcall _GWrite_Data
ldi r24,&Hc0
rcall _GWrite_Cmd
ldi r24,&hff
rcall _GWrite_Data
ldi r24,&Hc0
rcall _GWrite_Cmd
ldi r24,&h1e ;CG-Ram gefülltes O - 161
rcall _GWrite_Data
ldi r24,&Hc0
rcall _GWrite_Cmd
ldi r24,&hFF
rcall _GWrite_Data
ldi r24,&Hc0
rcall _GWrite_Cmd
ldi r24,&hff
rcall _GWrite_Data
ldi r24,&Hc0
rcall _GWrite_Cmd
ldi r24,&hff
rcall _GWrite_Data
ldi r24,&Hc0
rcall _GWrite_Cmd
ldi r24,&hff
rcall _GWrite_Data
ldi r24,&Hc0
rcall _GWrite_Cmd
ldi r24,&hff
rcall _GWrite_Data
ldi r24,&Hc0
rcall _GWrite_Cmd
ldi r24,&hff
rcall _GWrite_Data
ldi r24,&Hc0
rcall _GWrite_Cmd
ldi r24,&h1e
rcall _GWrite_Data
ldi r24,&Hc0
rcall _GWrite_Cmd
ldi r24,&hff ;CG-Ram Antenne - 162
rcall _GWrite_Data
ldi r24,&Hc0
rcall _GWrite_Cmd
ldi r24,&hff
rcall _GWrite_Data
ldi r24,&Hc0
rcall _GWrite_Cmd
ldi r24,&h1e
rcall _GWrite_Data
ldi r24,&Hc0
rcall _GWrite_Cmd
ldi r24,&h1e
rcall _GWrite_Data
ldi r24,&Hc0
rcall _GWrite_Cmd
ldi r24,&h0c
rcall _GWrite_Data
ldi r24,&Hc0
rcall _GWrite_Cmd
ldi r24,&h0c
rcall _GWrite_Data
ldi r24,&Hc0
rcall _GWrite_Cmd
clr r24
rcall _GWrite_Data
ldi r24,&Hc0
rcall _GWrite_Cmd
clr r24
rcall _GWrite_Data
ldi r24,&Hc0
rcall _GWrite_Cmd
clr r24 ;CG-Ram Smilie - 163
rcall _GWrite_Data
ldi r24,&Hc0
rcall _GWrite_Cmd
clr r24
rcall _GWrite_Data
ldi r24,&Hc0
rcall _GWrite_Cmd
ldi r24,&h14
rcall _GWrite_Data
ldi r24,&Hc0
rcall _GWrite_Cmd
clr r24
rcall _GWrite_Data
ldi r24,&Hc0
rcall _GWrite_Cmd
ldi r24,&h22
rcall _GWrite_Data
ldi r24,&Hc0
rcall _GWrite_Cmd
ldi r24,&h1c
rcall _GWrite_Data
ldi r24,&Hc0
rcall _GWrite_Cmd
clr r24
rcall _GWrite_Data
ldi r24,&Hc0
rcall _GWrite_Cmd
clr r24
rcall _GWrite_Data
ldi r24,&Hc0
rcall _GWrite_Cmd
ldi r24,&h30 ;CG-Ram PR - 164
rcall _GWrite_Data
ldi r24,&Hc0
rcall _GWrite_Cmd
ldi r24,&h28
rcall _GWrite_Data
ldi r24,&Hc0
rcall _GWrite_Cmd
ldi r24,&h30
rcall _GWrite_Data
ldi r24,&Hc0
rcall _GWrite_Cmd
ldi r24,&h26
rcall _GWrite_Data
ldi r24,&Hc0
rcall _GWrite_Cmd
ldi r24,&h25
rcall _GWrite_Data
ldi r24,&Hc0
rcall _GWrite_Cmd
ldi r24,&h06
rcall _GWrite_Data
ldi r24,&Hc0
rcall _GWrite_Cmd
ldi r24,&h05
rcall _GWrite_Data
ldi r24,&Hc0
rcall _GWrite_Cmd
ldi r24,&h05
rcall _GWrite_Data
ldi r24,&Hc0
rcall _GWrite_Cmd
ldi r24,&h1f ;CG-Ram PR liegend 31,5,2,32,31,5,26,32 - 165
rcall _GWrite_Data ; 1f, 05,02,20,1f,05,1a,20
ldi r24,&Hc0 ;stehend 30,28,30,26,25,6,5,5
rcall _GWrite_Cmd
ldi r24,&h05
rcall _GWrite_Data
ldi r24,&Hc0
rcall _GWrite_Cmd
ldi r24,&h02
rcall _GWrite_Data
ldi r24,&Hc0
rcall _GWrite_Cmd
ldi r24,&h20
rcall _GWrite_Data
ldi r24,&Hc0
rcall _GWrite_Cmd
ldi r24,&h1f
rcall _GWrite_Data
ldi r24,&Hc0
rcall _GWrite_Cmd
ldi r24,&h05
rcall _GWrite_Data
ldi r24,&Hc0
rcall _GWrite_Cmd
ldi r24,&h1a
rcall _GWrite_Data
ldi r24,&Hc0
rcall _GWrite_Cmd
ldi r24,&h20
rcall _GWrite_Data
ldi r24,&Hc0
rcall _GWrite_Cmd
ldi r24,&h1f ;CG-Ram PC liegend 31,5,2,32,14,17,10,32 - 166
rcall _GWrite_Data ; 1f, 05,02,20,0e,11,0a,20
ldi r24,&Hc0 ; stehend 30,28,32,25,24,5,2,0
rcall _GWrite_Cmd
ldi r24,&h05
rcall _GWrite_Data
ldi r24,&Hc0
rcall _GWrite_Cmd
ldi r24,&h02
rcall _GWrite_Data
ldi r24,&Hc0
rcall _GWrite_Cmd
ldi r24,&h00
rcall _GWrite_Data
ldi r24,&Hc0
rcall _GWrite_Cmd
ldi r24,&h0e
rcall _GWrite_Data
ldi r24,&Hc0
rcall _GWrite_Cmd
ldi r24,&h11
rcall _GWrite_Data
ldi r24,&Hc0
rcall _GWrite_Cmd
ldi r24,&h0a
rcall _GWrite_Data
ldi r24,&Hc0
rcall _GWrite_Cmd
ldi r24,&h00
rcall _GWrite_Data
ldi r24,&Hc0
rcall _GWrite_Cmd
clr r24 ;Herz 0,36,7F,7F,3E,1C,8,0 - 167
rcall _GWrite_Data
ldi r24,&Hc0
rcall _GWrite_Cmd
ldi r24,&hA
rcall _GWrite_Data
ldi r24,&Hc0
rcall _GWrite_Cmd
ldi r24,&h1F
rcall _GWrite_Data
ldi r24,&Hc0
rcall _GWrite_Cmd
ldi r24,&h1F
rcall _GWrite_Data
ldi r24,&Hc0
rcall _GWrite_Cmd
ldi r24,&h0E
rcall _GWrite_Data
ldi r24,&Hc0
rcall _GWrite_Cmd
ldi r24,&h04
rcall _GWrite_Data
ldi r24,&Hc0
rcall _GWrite_Cmd
clr r24
rcall _GWrite_Data
ldi r24,&Hc0
rcall _GWrite_Cmd
clr r24
rcall _GWrite_Data
ldi r24,&Hc0
rcall _GWrite_Cmd
clr r24 ;CG-Ram trauriges Smilie - 168
rcall _GWrite_Data
ldi r24,&Hc0
rcall _GWrite_Cmd
clr r24
rcall _GWrite_Data
ldi r24,&Hc0
rcall _GWrite_Cmd
ldi r24,&h14
rcall _GWrite_Data
ldi r24,&Hc0
rcall _GWrite_Cmd
clr r24
rcall _GWrite_Data
ldi r24,&Hc0
rcall _GWrite_Cmd
ldi r24,&h1c
rcall _GWrite_Data
ldi r24,&Hc0
rcall _GWrite_Cmd
ldi r24,&h22
rcall _GWrite_Data
ldi r24,&Hc0
rcall _GWrite_Cmd
clr r24
rcall _GWrite_Data
ldi r24,&Hc0
rcall _GWrite_Cmd
clr r24
rcall _GWrite_Data
ldi r24,&Hc0
rcall _GWrite_Cmd
clr r24 ;CG-Ram neutrales Smilie - 169
rcall _GWrite_Data
ldi r24,&Hc0
rcall _GWrite_Cmd
clr r24
rcall _GWrite_Data
ldi r24,&Hc0
rcall _GWrite_Cmd
ldi r24,&h14
rcall _GWrite_Data
ldi r24,&Hc0
rcall _GWrite_Cmd
clr r24
rcall _GWrite_Data
ldi r24,&Hc0
rcall _GWrite_Cmd
clr r24
rcall _GWrite_Data
ldi r24,&Hc0
rcall _GWrite_Cmd
ldi r24,&h3E
rcall _GWrite_Data
ldi r24,&Hc0
rcall _GWrite_Cmd
clr r24
rcall _GWrite_Data
ldi r24,&Hc0
rcall _GWrite_Cmd
clr r24
rcall _GWrite_Data
ldi r24,&Hc0
rcall _GWrite_Cmd
$end Asm
End Sub
Kann sein, dass dieser Weg nicht der Optimale ist, denn ich habe die
Routine nach einem Blick ins Datenblatt des Displaycontrollers entworfen.
Powered by vBulletin® Version 4.2.5 Copyright ©2024 Adduco Digital e.K. und vBulletin Solutions, Inc. Alle Rechte vorbehalten.