Grafikdisplay EA-DIP128 KS108 Text drehen

    Diese Seite verwendet Cookies. Durch die Nutzung unserer Seite erklären Sie sich damit einverstanden, dass wir Cookies setzen. Weitere Informationen

    Aufgrund technischer Veränderungen ist der Mailverkehr innerhalb des Forums (Private Nachrichten) nur noch eingeschränkt möglich. Die Einschränkung ist notwendig, um zusätzliche Betriebskosten für das Forum zu vermeiden. Näheres zu den Hintergründen im Thread "Aktuelles zum Forum".Wir bitten um Verständnis.

    Hinweis kann nach Kenntnisnahme deaktiviert werden!

    • Grafikdisplay EA-DIP128 KS108 Text drehen

      Vielleich braucht ja wer diese Möglichkeit. Ich wollte mein Display in Portät Darstellung mit Text füllen.
      Hab keine Funktion gefunden die dieses Display dazu bewegt es so darzustellen.
      Hab auf eine Softwarelösung zurückgegriffen. Nachteil , sehr langsam.
      Bei mir macht das nichts, ich benutze es nur um Spannungen anzuzeigen.
      Original ist von Evert Dekker

      BASCOM-Quellcode

      1. ' Insanity
      2. ' Grafikdisplay KS108
      3. ' By Evert Dekker 2007 GraphicFont@Evertdekker dotje com
      4. $regfile = "m1284pdef.dat"
      5. $crystal = 20000000
      6. $hwstack = 128
      7. $swstack = 128
      8. $framesize = 64
      9. ' Spannungsteiler mit 15k zu 1k
      10. Const Spannungs_Fakor = 0.04
      11. ' Für Singlebearbeitung
      12. Config Single = SCIENTIFIC , Digits = 1
      13. 'Bibliothek für KS0108
      14. $lib "glcdKS108.lib"
      15. Config Graphlcd = 128 * 64sed , Dataport = Portc , Controlport = Portd , Ce = 5 , Ce2 = 4 , Cd = 1 , Rd = 2 , Reset = 0 , Enable = 3
      16. CLS
      17. Declare Sub Lcdtext(byval S As String , Byval Xoffset As Byte , Byval Yoffset As Byte , Byval Fontset As Byte , Byval Inverse As Byte , Byval Rotation As Byte)
      18. 'Lcdtest String , Xoffset , Yoffset , Fontset , Inverse , Rotation
      19. Wait 1
      20. ' Pulsweitenmodulation
      21. Config Timer2 = Pwm , Compare B Pwm = Clear Down , Prescale = 1
      22. Dim Analogwert As Integer
      23. Dim Dummy as String*10
      24. Dim Ergebnis as Single
      25. Declare Function Analog(byval Kanal As Byte , Byval Anzahl As Word ) As Word
      26. ' Analog
      27. Config Adc = Single , Prescaler = Auto , Reference = Internal_2.56
      28. Start Adc
      29. 'PWM - Displaybeleuchtung
      30. Config Portd.6 = Output
      31. 'LED
      32. Config Portd.7 = Output
      33. Portd.7 = 1 ' LED
      34. Pwm2b = 100
      35. Showpic 25 , 0 , Logo
      36. wait 2
      37. Cls
      38. Do
      39. Call LCDtext("Spannungs ",125,1,2,0,1)
      40. Call LCDtext(" Test",115,1,2,0,1)
      41. Analogwert = Analog(1,500)
      42. Call LCDtext("U1 =",100,1,2,0,1)
      43. Ergebnis = Analogwert * Spannungs_Fakor
      44. Dummy = " " + Str(Ergebnis,1)
      45. Dummy = Right(Dummy,4)+"V"
      46. Call LCDtext(Dummy,100,32,2,0,1)
      47. Analogwert = Analog(2,500)
      48. Call LCDtext("U2 =",85,1,2,0,1)
      49. Ergebnis = Analogwert * Spannungs_Fakor
      50. Dummy = " " + Str(Ergebnis,1)
      51. Dummy = Right(Dummy,4)+"V"
      52. Call LCDtext(Dummy,85,32,2,0,1)
      53. Analogwert = Analog(3,500)
      54. Call LCDtext("U3 =",70,1,2,0,1)
      55. Ergebnis = Analogwert * Spannungs_Fakor
      56. Dummy = " " + Str(Ergebnis,1)
      57. Dummy = Right(Dummy,4)+"V"
      58. Call LCDtext(Dummy,70,32,2,0,1)
      59. Analogwert = Analog(4,500)
      60. Call LCDtext("U4 =",55,1,2,0,1)
      61. Ergebnis = Analogwert * Spannungs_Fakor
      62. Dummy = " " + Str(Ergebnis,1)
      63. Dummy = Right(Dummy,4)+"V"
      64. Call LCDtext(Dummy,55,32,2,0,1)
      65. Analogwert = Analog(5,500)
      66. Call LCDtext("U5 =",40,1,2,0,1)
      67. Ergebnis = Analogwert * Spannungs_Fakor
      68. Dummy = " " + Str(Ergebnis,1)
      69. Dummy = Right(Dummy,4)+"V"
      70. Call LCDtext(Dummy,40,32,2,0,1)
      71. Call LCDtext("Me",10,50,2,0,1)
      72. Toggle Portd.7
      73. Loop
      74. End
      75. Function Analog(kanal , Anzahl)
      76. Local Xschleife As Word
      77. Local Xanalogmesswert As Word
      78. Local Xanalogmesswert_summe As Long
      79. Local Xanalog_mittel As Long
      80. If Anzahl =< 0 Then Anzahl = 1
      81. Xanalogmesswert_summe = 0
      82. For Xschleife = 1 To Anzahl
      83. Xanalogmesswert = Getadc(kanal)
      84. Xanalogmesswert_summe = Xanalogmesswert_summe + Xanalogmesswert
      85. Next
      86. Xanalog_mittel = Xanalogmesswert_summe / Anzahl
      87. Xanalogmesswert = Xanalog_mittel
      88. Analog = Xanalogmesswert
      89. End Function
      90. ' Routine Original von
      91. '------------------------------------------------------------------
      92. ' GRAPHIC FONT
      93. ' Use the Bascom font file's for all the graphic display's,
      94. ' include inverted and/or rotated text.
      95. ' By Evert Dekker 2007 GraphicFont@Evertdekker dotje com
      96. ' Created with Bascom-Avr: 1.11.8.8
      97. '------------------------------------------------------------------
      98. ' Habs angepasst das es mit 2.0.83 läuft
      99. Sub Lcdtext(byval S As String , Xoffset As Byte , Yoffset As Byte , Fontset As Byte , Inverse As Byte , Rotation As Byte)
      100. Local Tempstring As String * 1 , Temp As Byte 'Dim local the variables
      101. Local A As Byte , Pixels As Byte , Count As Byte , Carcount As Byte , Lus As Byte
      102. Local Row As Byte , Byteseach As Byte , Blocksize As Byte , Dummy As Byte
      103. Local Colums As Byte , Columcount As Byte , Rowcount As Byte , Stringsize As Byte
      104. Local Xpos As Byte , Ypos As Byte , Pixel As Byte , Pixelcount As Byte
      105. If Inverse > 1 Then Inverse = 0 'Inverse can't be greater then 1
      106. If Rotation > 3 Then Rotation = 0 'There are only 4 rotation's
      107. Stringsize = Len(s) - 1 'Size of the text string -1 because we must start with 0
      108. For Carcount = 0 To Stringsize 'Loop for the numbers of caracters that must be displayed
      109. If Fontset = 1 Then Restore Font8x8 'Add or remove here fontset's that you need or not,
      110. If Fontset = 2 Then Restore Font6x8 'If you dont know the name, open the font file in wordpad, and there it is,
      111. If Fontset = 3 Then Restore Font5x5 'right on top.
      112. Temp = Carcount + 1 'Cut the text string in seperate caracters
      113. Tempstring = Mid(s , Temp , 1)
      114. Read Row : Read Byteseach : Read Blocksize : Read Dummy 'Read the first 4 bytes from the font file
      115. Temp = Asc(tempstring) - 32 'Font files start with caracter 32
      116. For Lus = 1 To Temp 'Do dummie read to point to the correct line in the fontfile
      117. For Count = 1 To Blocksize
      118. Read Pixels
      119. Next Count
      120. Next Lus
      121. Colums = Blocksize / Row 'Calculate the numbers of colums
      122. Row = Row * 8 'Row is always 8 pixels high = 1 byte, so working with row in steps of 8.
      123. Row = Row - 1 'Want to start with row=0 instead of 1
      124. Colums = Colums - 1 'Same for the colums
      125. Select Case Rotation
      126. Case 0 '0 degrees rotation
      127. For Rowcount = 0 To Row Step 8 'Loop for numbers of rows
      128. A = Rowcount + Yoffset
      129. For Columcount = 0 To Colums 'Loop for numbers of Colums
      130. Read Pixels : If Inverse = 1 Then Toggle Pixels 'Read the byte from the file and if inverse = true then invert de byte
      131. Xpos = Columcount 'Do some calculation to get the caracter on the correct Xposition
      132. Temp = Carcount * Byteseach
      133. Xpos = Xpos + Temp
      134. Xpos = Xpos + Xoffset
      135. For PixelCount = 0 To 7 'Loop for 8 pixels to be set or not
      136. Ypos = A + PixelCount 'Each pixel on his own spot
      137. Pixel = Pixels.0 'Set the pixel (or not)
      138. Pset Xpos , Ypos , Pixel 'Finaly we can set the pixel
      139. Shift Pixels , Right 'Shift the byte 1 bit to the right so the next pixel comes availible
      140. incr Pixel
      141. Next
      142. Next Columcount
      143. Next Rowcount
      144. Case 1 '90 degrees rotation
      145. For Rowcount = Row To 0 Step -8 'Loop is now counting down
      146. A = Rowcount + Xoffset
      147. A = A - 15 'Correction to set Xpos on Xoffset with rotation
      148. For Columcount = 0 To Colums
      149. Read Pixels : If Inverse = 1 Then Toggle Pixels
      150. Xpos = Columcount
      151. Temp = Carcount * Byteseach
      152. Xpos = Xpos + Temp
      153. Xpos = Xpos + Yoffset 'We want that Xoffset is still Xoffset, so we need here the change from x to y
      154. For Pixelcount = 7 To 0 Step -1
      155. Ypos = A + Pixelcount
      156. Pixel = Pixels.0
      157. Pset Ypos , Xpos , Pixel
      158. Shift Pixels , Right
      159. incr Pixel
      160. Next
      161. Next Columcount
      162. Next Rowcount
      163. Case 2 '180 degrees rotation
      164. For Rowcount = Row To 0 Step -8
      165. A = Rowcount + Yoffset
      166. A = A - 7 'Correction to set Xpos on Xoffset with rotation
      167. For Columcount = Colums To 0 Step -1
      168. Read Pixels : If Inverse = 1 Then Toggle Pixels
      169. Xpos = Columcount
      170. Temp = Carcount * Byteseach
      171. Xpos = Xpos - Temp
      172. Xpos = Xpos - 8 'Correction to set Xpos on Xoffset with rotation
      173. Xpos = Xpos + Xoffset
      174. For Pixelcount = 7 To 0 Step -1
      175. Ypos = A + Pixelcount
      176. Pixel = Pixels.0
      177. Pset Xpos , Ypos , Pixel
      178. Shift Pixels , Right
      179. incr Pixel
      180. Next
      181. Next Columcount
      182. Next Rowcount
      183. Case 3 '270 degrees rotation
      184. For Rowcount = 0 To Row Step 8
      185. A = Rowcount + Xoffset
      186. For Columcount = Colums To 0 Step -1
      187. Read Pixels : If Inverse = 1 Then Toggle Pixels
      188. Xpos = Columcount
      189. Temp = Carcount * Byteseach
      190. Xpos = Xpos - Temp
      191. Xpos = Xpos - 8 'Correction to set Xpos on Xoffset with rotation
      192. Xpos = Xpos + Yoffset
      193. For Pixelcount = 0 To 7
      194. Ypos = A + Pixelcount
      195. Pixel = Pixels.0
      196. Pset Ypos , Xpos , Pixel
      197. Shift Pixels , Right
      198. incr Pixel
      199. Next
      200. Next Columcount
      201. Next Rowcount
      202. End Select
      203. Next Carcount
      204. End Sub 'End of this amazing subroutine
      205. Logo:
      206. $bgf "Ich_SW.bgf"
      207. $include "Font8x8.font"
      208. $include "Font6x8.font"
      209. $include "Font5x5.font"
      Alles anzeigen
    • Das hat wohl noch keiner versucht? :| Die lib kanns nicht. :(
      Ein "liegender" Font? Jedoch muß dann jedes Zeichen eine Locate zu gewiesen bekommen.
      Dennoch bestimmt schneller als es Pixelweise auszugeben.
      Oder ein Bildspeicher im Avr einrichten? Der kann dann Blockweise oder vollständig übertragen werden.
      Jedoch um die Schrift passend da rein zu bekommen braucht es eine Poutine die dann auch gleich das Display versorgen könnte.
      Die eingesetzt Routine so anpassen das sie nicht jedes Pixel setzt sonder einen Block (8x8)Bits sammelt und es dann es Byteweise Überträgt = Liegender Font

      Der Chip selbst läßt sich nicht umschalten? Und dunkel/ausgeblendet beschreiben a_67_e210de67

      Dieser Beitrag wurde bereits 2 mal editiert, zuletzt von Pluto25 ()