Olle_Filzlaus
31.12.2006, 03:51
Hallo,
ich habe da mal ein Programm geschrieben um auf ein Display große Zahlen drauf zu bekommen. DA stand ich vor einem ähnlichen Problem.
ich habe dir mal mein Test Code angehangen.
Da wird einfach von 1 - 0 gezählt. Er läd dann einfach aus der Subroutine die Zeichen und setzt sie auf dem display wieder zusammen.
Hatte damals auch ein Betrag zu dem Thema laufen. Nannte sich glaube ich "Display mit großen Zeichen"
'**********************************
'* Atmega8 mit großen Zahlen *
'**********************************
$regfile "m8def.dat"
$crystal = 1000000
'blaues display
Config Lcdpin = Pin , Db4 = Portd.2 , Db5 = Portd.3 , Db6 = Portd.4 , Db7 = Portd.5 , E = Portd.1 , Rs = Portd.0
Config Lcdbus = 4
Config Lcd = 16 * 2
Declare Sub 1()
Declare Sub 2()
Declare Sub 3()
Declare Sub 4()
Declare Sub 5()
Declare Sub 6()
Declare Sub 7()
Declare Sub 8()
Declare Sub 9()
Declare Sub 0()
'****************************** Main *******************************************
Do
Call 1()
Locate 1 , 1
Lcd Chr(0)
Locate 1 , 2
Lcd Chr(1)
Locate 2 , 1
Lcd Chr(2)
Locate 2 , 2
Lcd Chr(3)
Call 2()
Locate 1 , 3
Lcd Chr(0)
Locate 1 , 4
Lcd Chr(1)
Locate 2 , 3
Lcd Chr(2)
Locate 2 , 4
Lcd Chr(3)
Call 3()
Locate 1 , 5
Lcd Chr(0)
Locate 1 , 6
Lcd Chr(1)
Locate 2 , 5
Lcd Chr(2)
Locate 2 , 6
Lcd Chr(3)
Call 4()
Locate 1 , 7
Lcd Chr(0)
Locate 1 , 8
Lcd Chr(1)
Locate 2 , 7
Lcd Chr(2)
Locate 2 , 8
Lcd Chr(3)
Call 5()
Locate 1 , 9
Lcd Chr(0)
Locate 1 , 10
Lcd Chr(1)
Locate 2 , 9
Lcd Chr(2)
Locate 2 , 10
Lcd Chr(3)
Call 6()
Locate 1 , 11
Lcd Chr(0)
Locate 1 , 12
Lcd Chr(1)
Locate 2 , 11
Lcd Chr(2)
Locate 2 , 12
Lcd Chr(3)
Call 7()
Locate 1 , 13
Lcd Chr(0)
Locate 1 , 14
Lcd Chr(1)
Locate 2 , 13
Lcd Chr(2)
Locate 2 , 14
Lcd Chr(3)
Call 8()
Locate 1 , 15
Lcd Chr(0)
Locate 1 , 16
Lcd Chr(1)
Locate 2 , 15
Lcd Chr(2)
Locate 2 , 16
Lcd Chr(3)
' Call 9()
' Call 0()
Loop
'********* Unterverzeichnisse **************************************************
Sub 1
'Zeichen definieren
'**** 1 ****
Deflcdchar 0 , 32 , 1 , 3 , 7 , 15 , 1 , 1 , 1 'links oben
Deflcdchar 1 , 32 , 16 , 16 , 16 , 16 , 16 , 16 , 16 'rechts oben
Deflcdchar 2 , 1 , 1 , 1 , 1 , 1 , 7 , 15 , 32 'links unten
Deflcdchar 3 , 16 , 16 , 16 , 16 , 16 , 30 , 31 , 32 'rechts unten
End Sub
'***********************
Sub 2
'**** 2 ****
Deflcdchar 0 , 32 , 7 , 15 , 32 , 32 , 32 , 32 , 7 ' replace ? with number (0-7)
Deflcdchar 1 , 32 , 28 , 30 , 6 , 6 , 6 , 6 , 30 ' replace ? with number (0-7)
Deflcdchar 2 , 15 , 12 , 12 , 12 , 12 , 15 , 7 , 32 ' replace ? with number (0-7)
Deflcdchar 3 , 28 , 32 , 32 , 32 , 32 , 28 , 30 , 32 ' replace ? with number (0-7)
End Sub
Sub 3
'**** 3 ****
Deflcdchar 0 , 32 , 7 , 15 , 32 , 32 , 32 , 32 , 3 ' replace ? with number (0-7)
Deflcdchar 1 , 32 , 28 , 30 , 6 , 6 , 6 , 6 , 28 ' replace ? with number (0-7)
Deflcdchar 2 , 3 , 32 , 32 , 32 , 32 , 15 , 7 , 32 ' replace ? with number (0-7)
Deflcdchar 3 , 28 , 6 , 6 , 6 , 6 , 30 , 28 , 32 ' replace ? with number (0-7)
End Sub
Sub 4
'**** 4 ****
Deflcdchar 0 , 32 , 12 , 12 , 12 , 12 , 12 , 12 , 15 ' replace ? with number (0-7)
Deflcdchar 1 , 32 , 6 , 6 , 6 , 6 , 6 , 6 , 30 ' replace ? with number (0-7)
Deflcdchar 2 , 15 , 32 , 32 , 32 , 32 , 32 , 32 , 32 ' replace ? with number (0-7)
Deflcdchar 3 , 30 , 6 , 6 , 6 , 6 , 6 , 6 , 32 ' replace ? with number (0-7)
End Sub
Sub 5
'**** 5 ****
Deflcdchar 0 , 32 , 7 , 15 , 12 , 12 , 12 , 12 , 15 ' replace ? with number (0-7)
Deflcdchar 1 , 32 , 28 , 30 , 32 , 32 , 32 , 32 , 28 ' replace ? with number (0-7)
Deflcdchar 2 , 7 , 32 , 32 , 32 , 32 , 15 , 7 , 32 ' replace ? with number (0-7)
Deflcdchar 3 , 30 , 6 , 6 , 6 , 6 , 30 , 28 , 32 ' replace ? with number (0-7)
End Sub
Sub 6
'**** 6 ****
Deflcdchar 0 , 32 , 7 , 15 , 12 , 12 , 12 , 12 , 15 ' replace ? with number (0-7)
Deflcdchar 1 , 32 , 28 , 30 , 32 , 32 , 32 , 32 , 28 ' replace ? with number (0-7)
Deflcdchar 2 , 15 , 12 , 12 , 12 , 12 , 15 , 7 , 32 ' replace ? with number (0-7)
Deflcdchar 3 , 30 , 6 , 6 , 6 , 6 , 30 , 28 , 32 ' replace ? with number (0-7)
End Sub
Sub 7
'**** 7 ****
Deflcdchar 0 , 32 , 15 , 15 , 32 , 32 , 32 , 32 , 32 ' replace ? with number (0-7)
Deflcdchar 1 , 32 , 30 , 30 , 6 , 6 , 12 , 12 , 24 ' replace ? with number (0-7)
Deflcdchar 2 , 32 , 1 , 1 , 1 , 1 , 1 , 1 , 32 ' replace ? with number (0-7)
Deflcdchar 3 , 24 , 16 , 16 , 16 , 16 , 16 , 16 , 32 ' replace ? with number (0-7)
End Sub
Sub 8
'**** 8 ****
Deflcdchar 0 , 32 , 7 , 15 , 12 , 12 , 12 , 12 , 15 ' replace ? with number (0-7)
Deflcdchar 1 , 32 , 28 , 30 , 6 , 6 , 6 , 6 , 30 ' replace ? with number (0-7)
Deflcdchar 2 , 7 , 12 , 12 , 12 , 12 , 15 , 7 , 32 ' replace ? with number (0-7)
Deflcdchar 3 , 28 , 6 , 6 , 6 , 6 , 30 , 28 , 32 ' replace ? with number (0-7)
End Sub
Sub 9
'**** 9 ****
Deflcdchar 0 , 32 , 7 , 15 , 12 , 12 , 12 , 12 , 15 ' replace ? with number (0-7)
Deflcdchar 1 , 32 , 28 , 30 , 6 , 6 , 6 , 6 , 30 ' replace ? with number (0-7)
Deflcdchar 2 , 7 , 32 , 32 , 32 , 32 , 15 , 7 , 32 ' replace ? with number (0-7)
Deflcdchar 3 , 30 , 6 , 6 , 6 , 6 , 30 , 28 , 32 ' replace ? with number (0-7)
End Sub
Sub 0
'**** 0 ****
Deflcdchar 0 , 32 , 7 , 15 , 12 , 12 , 12 , 12 , 12 ' replace ? with number (0-7)
Deflcdchar 1 , 32 , 28 , 30 , 6 , 6 , 6 , 6 , 6 ' replace ? with number (0-7)
Deflcdchar 2 , 12 , 12 , 12 , 12 , 12 , 15 , 7 , 32 ' replace ? with number (0-7)
Deflcdchar 3 , 6 , 6 , 6 , 6 , 6 , 30 , 28 , 32 ' replace ? with number (0-7)
End Sub
Falls noch fragen sind. frage einfach, wenn du ne andere Art, eventuell sogar ne leichtre art gefunden hast die zeichen darzustellen, schreibe sie bitte.
cu Arno
Powered by vBulletin® Version 4.2.5 Copyright ©2024 Adduco Digital e.K. und vBulletin Solutions, Inc. Alle Rechte vorbehalten.