Anzeige 1,8" Uhranzeige

    This site uses cookies. By continuing to browse this site, you are agreeing to our Cookie Policy.

    • Hallo HansHans,

      anbei das Programm, leider zählt er die Stunden nicht hoch, ich habe den Fehler aber noch nicht gefunden.

      Gruß Thomas

      Source Code

      1. '*******************************************************************************
      2. 'Programm for Display ST7735R 1.8Zoll 128x160
      3. ' and Display ILI9163 1.8Zoll 128x160
      4. 'Bascom IDE 2.0.7.7
      5. '
      6. 'Version:13012014
      7. 'By Hkipnik
      8. ' © Copyright by H.Kipnik 2012
      9. 'Date 13.01.2014
      10. '*******************************************************************************
      11. ' SD Card CS --> portD.7
      12. ' Miso --> portb.4
      13. 'Display
      14. ' CS --> portb.2
      15. ' DC --> portb.1
      16. ' reset --> portb.0
      17. ' Mosi --> portb.3
      18. ' Clock --> portb.5
      19. '
      20. '
      21. '*******************************************************************************
      22. $regfile = "m328pdef.dat"
      23. $crystal = 16000000
      24. $hwstack = 50
      25. $swstack = 150
      26. $framesize = 150
      27. $baud = 57600
      28. '*******************************************************************************
      29. Const Sdcard = 0 'use SD Card = 1 no SD Card = 0
      30. Const Modus = 1 '0=Portrait 1=Landscape
      31. Const Driver = 1 '0=ST7735 1=ILI9163
      32. 'only Display ST7735
      33. 'Display typ Red or black Tab have different RGB order
      34. 'color of the display plastic wrap
      35. Const Disp_typ = 0 'RGB order 0=Black Tab 1=Red Tab
      36. '*******************************************************************************
      37. Config Portb.2 = Output
      38. Config Portb.1 = Output
      39. Config Portb.0 = Output
      40. Lcd_cs Alias Portb.2
      41. Lcd_dc Alias Portb.1
      42. Lcd_reset Alias Portb.0
      43. Lcd_reset = 1
      44. Lcd_cs = 1
      45. Lcd_dc = 1
      46. '*******************************************************************************
      47. 'Include Declaration
      48. $include "TFTDriver\ST7735_declarations.inc"
      49. '*******************************************************************************
      50. 'Use For Demo
      51. Dim Help_str As String * 15
      52. Dim Temp_str As String * 15
      53. Dim Zahler As Byte
      54. Dim Bahn1 As String * 20
      55. Dim Bahn2 As String * 20
      56. Dim Bahn3 As String * 20
      57. Dim Bahn4 As String * 20
      58. Dim Bahn5 As String * 20
      59. Dim Bahn6 As String * 20
      60. Dim Bahn7 As String * 20
      61. Dim Stund As String * 20
      62. Dim Minut As String * 20
      63. Dim B1 as Byte
      64. Dim B2 as Byte
      65. Dim B3 as Byte
      66. Dim B4 as Byte
      67. Dim B5 as Byte
      68. Dim B6 as Byte
      69. Dim B7 as Byte
      70. Dim Sd as Byte
      71. Dim Mi As Byte
      72. Dim Schleife As Byte
      73. Dim Schleife2 As Byte
      74. B1 = 20
      75. B2 = 15
      76. B3 = 28
      77. B4 = 32
      78. B5 = 11
      79. B6 = 23
      80. B7 = 8
      81. Sd = 12
      82. Mi = 45
      83. Schleife2 = 59
      84. '*******************************************************************************
      85. 'Init SD Card and Spi
      86. #if Sdcard = 1
      87. $include "Avr-Dos\Config_MMCSD_HC.bas"
      88. $include "Avr-Dos\Config_AVR-DOS.bas"
      89. Init_sd_card
      90. #endif
      91. #if Sdcard = 0
      92. ' Config Portb.0 = Output 'auch wenn nicht genutzt
      93. ' Portb.0 = 1
      94. Config Spi = Hard , Interrupt = Off , Data Order = Msb , Master = Yes , Polarity = High , Phase = 1 , Clockrate = 4 , Noss = 1
      95. Spsr.0 = 1
      96. Spiinit
      97. #endif
      98. '*******************************************************************************
      99. 'Init the Dispaly
      100. Lcd_init
      101. Lcd_clear Black
      102. '*******************************************************************************
      103. #if Sdcard = 1
      104. Call Init_sd_card() 'Init SD Card
      105. Temp_str = "SD Card= " + Str(sd_ok)
      106. Lcd_text Temp_str , 1 , 1 , 1 , Yellow , Black
      107. ' 1 OK
      108. ' 0 Error
      109. Temp_str = "SD Card Typ= " + Str(mmcsd_cardtype)
      110. Lcd_text Temp_str , 1 , 20 , 1 , Yellow , Black
      111. ' 0 can't init the Card
      112. ' 1 MMC
      113. ' 2 SDSC Spec. 1.x
      114. ' 4 SDSC Spec. 2.0 or later
      115. ' 12 SDHC Spec. 2.0 or later
      116. Wait 2
      117. Lcd_clear Black
      118. #endif
      119. do
      120. Lcd_clear Blue
      121. Lcd_text "HAMBURG HBF Gleis Abf." , 1 , 3 , 4 , White , Blue
      122. Lcd_text "ICE577" , 1 , 20 , 4 , Black , White
      123. Lcd_text "ICE321" , 1 , 32 , 4 , Black , White
      124. Lcd_text "ICE437" , 1 , 44 , 4 , Black , White
      125. Lcd_text "RE8513" , 1 , 56 , 4 , Black , White
      126. Lcd_text "RE2566" , 1 , 68 , 4 , Black , White
      127. Lcd_text "ICE566" , 1 , 80 , 4 , Black , White
      128. Lcd_text "RE3548" , 1 , 92 , 4 , Black , White
      129. For Schleife = 1 to 60
      130. Bahn1 = "Berlin HBF 2 " + str(B1) + " min"
      131. Lcd_text Bahn1 , 42 , 20 , 4 , White , Blue
      132. Bahn2 = "Koeln HBF 3 " + str(B2) + " min"
      133. Lcd_text Bahn2 , 42 , 32 , 4 , White , Blue
      134. Bahn3 = "Kiel HBF 5 " + str(B3) + " min"
      135. Lcd_text Bahn3 , 42 , 44 , 4 , White , Blue
      136. Bahn4 = "HH-Altona 8 " + str(B4) + " min"
      137. Lcd_text Bahn4 , 42 , 56 , 4 , White , Blue
      138. Bahn5 = "Luebeck 4 " + str(B5) + " min"
      139. Lcd_text Bahn5 , 42 , 68 , 4 , White , Blue
      140. Bahn6 = "Hagen HBF 1 " + str(B6) + " min"
      141. Lcd_text Bahn6 , 42 , 80 , 4 , White , Blue
      142. Bahn7 = "Bremen 6 " + str(B7) + " min"
      143. Lcd_text Bahn7 , 42 , 92 , 4 , White , Blue
      144. Lcd_text "Uhrzeit" , 25 , 118 , 4 , White , Blue
      145. Stund = " " + str(Sd) + ":"
      146. Lcd_text Stund , 70 , 118 , 4 , White , Blue
      147. Lcd_text " " , 92 , 118 , 4 , White , Blue
      148. Minut = " " + str(Mi) + " "
      149. Lcd_text Minut , 100 , 118 , 4 , White , Blue
      150. decr Schleife2
      151. decr B1
      152. decr B2
      153. decr B3
      154. decr B4
      155. decr B5
      156. decr B6
      157. decr B7
      158. incr Mi
      159. if B1 = 0 then B1 = 60
      160. if B2 = 0 then B2 = 60
      161. if B3 = 0 then B3 = 60
      162. if B4 = 0 then B4 = 60
      163. if B5 = 0 then B5 = 60
      164. if B6 = 0 then B6 = 60
      165. if B7 = 0 then B7 = 60
      166. if Mi = 60 then Mi = 0
      167. if sd = 23 then sd = 0
      168. if Schleife2 = 0 then incr Sd
      169. wait 1
      170. next Schleife
      171. loop
      172. Do
      173. '*******************************************************************************
      174. 'test landscape
      175. '*******************************************************************************
      176. #if Modus = 1
      177. For Zahler = 1 To 182
      178. Help_str = Str(zahler)
      179. Temp_str = Format(help_str , "000")
      180. Temp_str = Temp_str + ".bin"
      181. ' Lcd_pic 0 , 0 , 160 , 120 , Temp_str
      182. Next
      183. #endif
      184. Loop
      185. End
      186. '*******************************************************************************
      187. $include "TFTDriver\ST7735_functions-1.inc"
      188. #if Sdcard = 1
      189. $include "Avr-Dos\SD_card_init.inc"
      190. #endif
      191. $include "Font\Font8x8.font"
      192. $include "Font\Font12x16.font"
      193. $include "Font\font8x12.font"
      194. $include "Font\font6x10.font"
      195. $include "Font\font10x16.font"
      Display All
    • decr B1
      decr B2
      decr B3
      decr B4
      decr B5
      decr B6
      decr B7
      incr Minuten
      if B1 = 0 then B1 = 60
      if B2 = 0 then B2 = 60
      if B3 = 0 then B3 = 60
      if B4 = 0 then B4 = 60
      if B5 = 0 then B5 = 60
      if B6 = 0 then B6 = 60
      if B7 = 0 then B7 = 60
      if Minuten = 60 then Minuten = 0
      if Minuten = 0 then incr Stunden
      if Stunden = 24 then Stunden = 0
    • Verschachteln heißt, dann die Strukturen ineinander liegen.

      BASCOM Source Code

      1. Beispiel nicht verschachtelt
      2. If a=1 then
      3. ' mach was
      4. End If
      5. If b=2 then
      6. ' mach was
      7. End If
      8. Das sind 2 einzelne Abfragen, die nichts mit einander zu tun haben.
      9. Beispiel Verschachtelt:
      10. If a=1 then
      11. ' mach was
      12. If b=2 then
      13. ' mach was
      14. End If
      15. End If
      16. Eine Abfrage beinhaltet eine andere.
      17. Das geht auch mit Schleifen oder Slect Case Abfragen.
      Display All
      verstanden?
    • Hallo Mitch,

      anbei der jetzige Code, sind denn die if Abfragen im Programm falsch ?
      Laufen tut das Programm anscheinend.

      Gruß Thomas

      Source Code

      1. '*******************************************************************************
      2. 'Programm for Display ST7735R 1.8Zoll 128x160
      3. ' and Display ILI9163 1.8Zoll 128x160
      4. 'Bascom IDE 2.0.7.7
      5. '
      6. 'Version:13012014
      7. 'By Hkipnik
      8. ' © Copyright by H.Kipnik 2012
      9. 'Date 13.01.2014
      10. '*******************************************************************************
      11. ' SD Card CS --> portD.7
      12. ' Miso --> portb.4
      13. 'Display
      14. ' CS --> portb.2
      15. ' DC --> portb.1
      16. ' reset --> portb.0
      17. ' Mosi --> portb.3
      18. ' Clock --> portb.5
      19. '
      20. '
      21. '*******************************************************************************
      22. $regfile = "m328pdef.dat"
      23. $crystal = 16000000
      24. $hwstack = 50
      25. $swstack = 150
      26. $framesize = 150
      27. $baud = 57600
      28. '*******************************************************************************
      29. Const Sdcard = 0 'use SD Card = 1 no SD Card = 0
      30. Const Modus = 1 '0=Portrait 1=Landscape
      31. Const Driver = 1 '0=ST7735 1=ILI9163
      32. 'only Display ST7735
      33. 'Display typ Red or black Tab have different RGB order
      34. 'color of the display plastic wrap
      35. Const Disp_typ = 0 'RGB order 0=Black Tab 1=Red Tab
      36. '*******************************************************************************
      37. Config Portb.2 = Output
      38. Config Portb.1 = Output
      39. Config Portb.0 = Output
      40. Lcd_cs Alias Portb.2
      41. Lcd_dc Alias Portb.1
      42. Lcd_reset Alias Portb.0
      43. Lcd_reset = 1
      44. Lcd_cs = 1
      45. Lcd_dc = 1
      46. '*******************************************************************************
      47. 'Include Declaration
      48. $include "TFTDriver\ST7735_declarations.inc"
      49. '*******************************************************************************
      50. 'Use For Demo
      51. Dim Help_str As String * 15
      52. Dim Temp_str As String * 15
      53. Dim Zahler As Byte
      54. Dim Bahn1 As String * 20
      55. Dim Bahn2 As String * 20
      56. Dim Bahn3 As String * 20
      57. Dim Bahn4 As String * 20
      58. Dim Bahn5 As String * 20
      59. Dim Bahn6 As String * 20
      60. Dim Bahn7 As String * 20
      61. Dim Stund As String * 20
      62. Dim Minut As String * 20
      63. Dim B1 as Byte
      64. Dim B2 as Byte
      65. Dim B3 as Byte
      66. Dim B4 as Byte
      67. Dim B5 as Byte
      68. Dim B6 as Byte
      69. Dim B7 as Byte
      70. Dim Stunden as Byte
      71. Dim Minuten As Byte
      72. Dim Schleife As Byte
      73. Dim Schleife2 As Byte
      74. B1 = 20
      75. B2 = 15
      76. B3 = 28
      77. B4 = 32
      78. B5 = 11
      79. B6 = 23
      80. B7 = 8
      81. Stunden = 12
      82. Minuten = 45
      83. Schleife2 = 60
      84. '*******************************************************************************
      85. 'Init SD Card and Spi
      86. #if Sdcard = 1
      87. $include "Avr-Dos\Config_MMCSD_HC.bas"
      88. $include "Avr-Dos\Config_AVR-DOS.bas"
      89. Init_sd_card
      90. #endif
      91. #if Sdcard = 0
      92. ' Config Portb.0 = Output 'auch wenn nicht genutzt
      93. ' Portb.0 = 1
      94. Config Spi = Hard , Interrupt = Off , Data Order = Msb , Master = Yes , Polarity = High , Phase = 1 , Clockrate = 4 , Noss = 1
      95. Spsr.0 = 1
      96. Spiinit
      97. #endif
      98. '*******************************************************************************
      99. 'Init the Dispaly
      100. Lcd_init
      101. Lcd_clear Black
      102. '*******************************************************************************
      103. #if Sdcard = 1
      104. Call Init_sd_card() 'Init SD Card
      105. Temp_str = "SD Card= " + Str(sd_ok)
      106. Lcd_text Temp_str , 1 , 1 , 1 , Yellow , Black
      107. ' 1 OK
      108. ' 0 Error
      109. Temp_str = "SD Card Typ= " + Str(mmcsd_cardtype)
      110. Lcd_text Temp_str , 1 , 20 , 1 , Yellow , Black
      111. ' 0 can't init the Card
      112. ' 1 MMC
      113. ' 2 SDSC Spec. 1.x
      114. ' 4 SDSC Spec. 2.0 or later
      115. ' 12 SDHC Spec. 2.0 or later
      116. Wait 2
      117. Lcd_clear Black
      118. #endif
      119. do
      120. For Schleife = 1 to 60
      121. Lcd_clear Blue
      122. Lcd_text "HAMBURG HBF Gleis Abf." , 1 , 3 , 4 , White , Blue
      123. Lcd_text "ICE577" , 2 , 20 , 4 , Black , White
      124. Lcd_text "ICE321" , 2 , 32 , 4 , Black , White
      125. Lcd_text "ICE437" , 2 , 44 , 4 , Black , White
      126. Lcd_text "RE8513" , 2 , 56 , 4 , Black , White
      127. Lcd_text "RE2566" , 2 , 68 , 4 , Black , White
      128. Lcd_text "ICE566" , 2 , 80 , 4 , Black , White
      129. Lcd_text "RE3548" , 2 , 92 , 4 , Black , White
      130. Lcd_text "min" , 142 , 20 , 4 , White , Blue
      131. Lcd_text "min" , 142 , 32 , 4 , White , Blue
      132. Lcd_text "min" , 142 , 44 , 4 , White , Blue
      133. Lcd_text "min" , 142 , 56 , 4 , White , Blue
      134. Lcd_text "min" , 142, 68 , 4 , White , Blue
      135. Lcd_text "min" , 142 , 80 , 4 , White , Blue
      136. Lcd_text "min" , 142 , 92 , 4 , White , Blue
      137. lcd_text ":" , 100 , 118 , 4 , White , Blue
      138. Bahn1 = "Berlin HBF 2 " + str(B1)
      139. Lcd_text Bahn1 , 42 , 20 , 4 , White , Blue
      140. Bahn2 = "Koeln HBF 3 " + str(B2)
      141. Lcd_text Bahn2 , 42 , 32 , 4 , White , Blue
      142. Bahn3 = "Kiel HBF 5 " + str(B3)
      143. Lcd_text Bahn3 , 42 , 44 , 4 , White , Blue
      144. Bahn4 = "HH-Altona 8 " + str(B4)
      145. Lcd_text Bahn4 , 42 , 56 , 4 , White , Blue
      146. Bahn5 = "Luebeck 4 " + str(B5)
      147. Lcd_text Bahn5 , 42 , 68 , 4 , White , Blue
      148. Bahn6 = "Hagen HBF 1 " + str(B6)
      149. Lcd_text Bahn6 , 42 , 80 , 4 , White , Blue
      150. Bahn7 = "Bremen 6 " + str(B7)
      151. Lcd_text Bahn7 , 42 , 92 , 4 , White , Blue
      152. Lcd_text "Uhrzeit" , 10 , 118 , 4 , White , Blue
      153. Stund = " " + str(Stunden)
      154. Lcd_text Stund , 75 , 118 , 4 , White , Blue
      155. Minut = " " + str(Minuten)
      156. Lcd_text Minut , 105 , 118 , 4 , White , Blue
      157. decr B1
      158. decr B2
      159. decr B3
      160. decr B4
      161. decr B5
      162. decr B6
      163. decr B7
      164. incr Minuten
      165. if B1 = 0 then B1 = 60
      166. if B2 = 0 then B2 = 60
      167. if B3 = 0 then B3 = 60
      168. if B4 = 0 then B4 = 60
      169. if B5 = 0 then B5 = 60
      170. if B6 = 0 then B6 = 60
      171. if B7 = 0 then B7 = 60
      172. if Minuten = 60 then Minuten = 0
      173. if Minuten = 0 then incr Stunden
      174. if Stunden = 24 then Stunden = 0
      175. wait 60
      176. next Schleife
      177. loop
      178. Do
      179. '*******************************************************************************
      180. 'test landscape
      181. '*******************************************************************************
      182. #if Modus = 1
      183. For Zahler = 1 To 182
      184. Help_str = Str(zahler)
      185. Temp_str = Format(help_str , "000")
      186. Temp_str = Temp_str + ".bin"
      187. ' Lcd_pic 0 , 0 , 160 , 120 , Temp_str
      188. Next
      189. #endif
      190. Loop
      191. End
      192. '*******************************************************************************
      193. $include "TFTDriver\ST7735_functions-1.inc"
      194. #if Sdcard = 1
      195. $include "Avr-Dos\SD_card_init.inc"
      196. #endif
      197. $include "Font\Font8x8.font"
      198. $include "Font\Font12x16.font"
      199. $include "Font\font8x12.font"
      200. $include "Font\font6x10.font"
      201. $include "Font\font10x16.font"
      Display All
    • Thomas1964 wrote:

      if Minuten = 60 then Minuten = 0
      if Minuten = 0 then incr Stunden
      if Stunden = 24 then Stunden = 0
      Das ist so nicht korrekt.

      In Bascom gibt es ja den If-Befehl
      Zu einem If gehört normalerweise auch ein End If (auseinander geschrieben).

      Es gibt aber auch die verkürzte Version, wenn man das schreibt wie du.
      If <Bedingung=True> then <Anweisung> ' Die Anweisung muss in der gleichen Zeile stehen. Anweisungen über mehrere Zeilen geht nicht!

      Ausführlich ist das so:
      If <Bedingung=True> then
      'Hier können mehrere Anweisungen auf mehrere Zeilen verteilt stehen
      EndIf

      So wie du das schreibst, wird bei Minute 0 im 2 Sekunden Takt die Stunden erhöht.

      Diese sollen aber nur einmal erhöht werden und dzwar, wenn die Minuten von 59 auf 0 springen.

      Ach übrigens.
      Wenn der Compiler das Programm ohne Fehlermeldung compiliert, dann heißt das nur, dass für ihn das Programm syntaktisch in Ordnung ist.
      Für die Programm-Logik und den korrekten Ablauf bist du verantwortlich. D.h. Wenn der Compiler fehlerfrei compiliert, bedeutet das nicht, dass das Programm genau das tut, was du im Sinn hast.

      The post was edited 1 time, last by Mitch64 ().

    • Hallo Mitch, irgendwie peile ich das nicht,
      kannst du mir das mal in meinem Programm zeigen wie es richtig wäre ?
      Gruß Thomas

      hier jetzt der letzte Code, habe noch eine 0 Stelle vor den Minuten eingefügt.

      Source Code

      1. '*******************************************************************************
      2. 'Programm for Display ST7735R 1.8Zoll 128x160
      3. ' and Display ILI9163 1.8Zoll 128x160
      4. 'Bascom IDE 2.0.7.7
      5. '
      6. 'Version:13012014
      7. 'By Hkipnik
      8. ' © Copyright by H.Kipnik 2012
      9. 'Date 13.01.2014
      10. '*******************************************************************************
      11. ' SD Card CS --> portD.7
      12. ' Miso --> portb.4
      13. 'Display
      14. ' CS --> portb.2
      15. ' DC --> portb.1
      16. ' reset --> portb.0
      17. ' Mosi --> portb.3
      18. ' Clock --> portb.5
      19. '
      20. '
      21. '*******************************************************************************
      22. $regfile = "m328pdef.dat"
      23. $crystal = 16000000
      24. $hwstack = 50
      25. $swstack = 150
      26. $framesize = 150
      27. $baud = 57600
      28. '*******************************************************************************
      29. Const Sdcard = 0 'use SD Card = 1 no SD Card = 0
      30. Const Modus = 1 '0=Portrait 1=Landscape
      31. Const Driver = 1 '0=ST7735 1=ILI9163
      32. 'only Display ST7735
      33. 'Display typ Red or black Tab have different RGB order
      34. 'color of the display plastic wrap
      35. Const Disp_typ = 0 'RGB order 0=Black Tab 1=Red Tab
      36. '*******************************************************************************
      37. Config Portb.2 = Output
      38. Config Portb.1 = Output
      39. Config Portb.0 = Output
      40. Lcd_cs Alias Portb.2
      41. Lcd_dc Alias Portb.1
      42. Lcd_reset Alias Portb.0
      43. Lcd_reset = 1
      44. Lcd_cs = 1
      45. Lcd_dc = 1
      46. '*******************************************************************************
      47. 'Include Declaration
      48. $include "TFTDriver\ST7735_declarations.inc"
      49. '*******************************************************************************
      50. 'Use For Demo
      51. Dim Help_str As String * 15
      52. Dim Temp_str As String * 15
      53. Dim Zahler As Byte
      54. Dim Bahn1 As String * 20
      55. Dim Bahn2 As String * 20
      56. Dim Bahn3 As String * 20
      57. Dim Bahn4 As String * 20
      58. Dim Bahn5 As String * 20
      59. Dim Bahn6 As String * 20
      60. Dim Bahn7 As String * 20
      61. Dim Stund As String * 20
      62. Dim Minut As String * 20
      63. Dim B1 as Byte
      64. Dim B2 as Byte
      65. Dim B3 as Byte
      66. Dim B4 as Byte
      67. Dim B5 as Byte
      68. Dim B6 as Byte
      69. Dim B7 as Byte
      70. Dim Stunden as Byte
      71. Dim Minuten As Byte
      72. Dim Schleife As Byte
      73. Dim Schleife2 As Byte
      74. B1 = 8
      75. B2 = 15
      76. B3 = 23
      77. B4 = 27
      78. B5 = 31
      79. B6 = 35
      80. B7 = 42
      81. Stunden = 12
      82. Minuten = 00
      83. Schleife2 = 60
      84. '*******************************************************************************
      85. 'Init SD Card and Spi
      86. #if Sdcard = 1
      87. $include "Avr-Dos\Config_MMCSD_HC.bas"
      88. $include "Avr-Dos\Config_AVR-DOS.bas"
      89. Init_sd_card
      90. #endif
      91. #if Sdcard = 0
      92. ' Config Portb.0 = Output 'auch wenn nicht genutzt
      93. ' Portb.0 = 1
      94. Config Spi = Hard , Interrupt = Off , Data Order = Msb , Master = Yes , Polarity = High , Phase = 1 , Clockrate = 4 , Noss = 1
      95. Spsr.0 = 1
      96. Spiinit
      97. #endif
      98. '*******************************************************************************
      99. 'Init the Dispaly
      100. Lcd_init
      101. Lcd_clear Black
      102. '*******************************************************************************
      103. #if Sdcard = 1
      104. Call Init_sd_card() 'Init SD Card
      105. Temp_str = "SD Card= " + Str(sd_ok)
      106. Lcd_text Temp_str , 1 , 1 , 1 , Yellow , Black
      107. ' 1 OK
      108. ' 0 Error
      109. Temp_str = "SD Card Typ= " + Str(mmcsd_cardtype)
      110. Lcd_text Temp_str , 1 , 20 , 1 , Yellow , Black
      111. ' 0 can't init the Card
      112. ' 1 MMC
      113. ' 2 SDSC Spec. 1.x
      114. ' 4 SDSC Spec. 2.0 or later
      115. ' 12 SDHC Spec. 2.0 or later
      116. Wait 2
      117. Lcd_clear Black
      118. #endif
      119. do
      120. For Schleife = 1 to 60
      121. Lcd_clear Blue
      122. Lcd_text "HAMBURG HBF Gleis Abf." , 1 , 3 , 4 , White , Blue
      123. Lcd_text "ICE577" , 2 , 20 , 4 , Black , White
      124. Lcd_text "ICE321" , 2 , 32 , 4 , Black , White
      125. Lcd_text "ICE437" , 2 , 44 , 4 , Black , White
      126. Lcd_text "RE8513" , 2 , 56 , 4 , Black , White
      127. Lcd_text "RE2566" , 2 , 68 , 4 , Black , White
      128. Lcd_text "ICE566" , 2 , 80 , 4 , Black , White
      129. Lcd_text "RE3548" , 2 , 92 , 4 , Black , White
      130. Lcd_text "min" , 142 , 20 , 4 , White , Blue
      131. Lcd_text "min" , 142 , 32 , 4 , White , Blue
      132. Lcd_text "min" , 142 , 44 , 4 , White , Blue
      133. Lcd_text "min" , 142 , 56 , 4 , White , Blue
      134. Lcd_text "min" , 142, 68 , 4 , White , Blue
      135. Lcd_text "min" , 142 , 80 , 4 , White , Blue
      136. Lcd_text "min" , 142 , 92 , 4 , White , Blue
      137. lcd_text ":" , 95 , 118 , 4 , White , Blue
      138. Bahn1 = "Berlin HBF 2 " + str(B1)
      139. Lcd_text Bahn1 , 42 , 20 , 4 , White , Blue
      140. Bahn2 = "Koeln HBF 3 " + str(B2)
      141. Lcd_text Bahn2 , 42 , 32 , 4 , White , Blue
      142. Bahn3 = "Kiel HBF 5 " + str(B3)
      143. Lcd_text Bahn3 , 42 , 44 , 4 , White , Blue
      144. Bahn4 = "HH-Altona 8 " + str(B4)
      145. Lcd_text Bahn4 , 42 , 56 , 4 , White , Blue
      146. Bahn5 = "Luebeck 4 " + str(B5)
      147. Lcd_text Bahn5 , 42 , 68 , 4 , White , Blue
      148. Bahn6 = "Hagen HBF 1 " + str(B6)
      149. Lcd_text Bahn6 , 42 , 80 , 4 , White , Blue
      150. Bahn7 = "Bremen 6 " + str(B7)
      151. Lcd_text Bahn7 , 42 , 92 , 4 , White , Blue
      152. Lcd_text "Uhrzeit" , 10 , 118 , 4 , White , Blue
      153. Stund = " " + str(Stunden)
      154. Lcd_text Stund , 67 , 118 , 4 , White , Blue
      155. Minut = " " + str(Minuten)
      156. Lcd_text Minut , 112 , 118 , 4 , White , Blue
      157. decr B1
      158. decr B2
      159. decr B3
      160. decr B4
      161. decr B5
      162. decr B6
      163. decr B7
      164. incr Minuten
      165. if B1 = 0 then B1 = 60
      166. if B2 = 0 then B2 = 60
      167. if B3 = 0 then B3 = 60
      168. if B4 = 0 then B4 = 60
      169. if B5 = 0 then B5 = 60
      170. if B6 = 0 then B6 = 60
      171. if B7 = 0 then B7 = 60
      172. if Minuten = 60 then Minuten = 0
      173. if Minuten = 1 then lcd_text "0",107,118,4,White,Blue
      174. if Minuten = 2 then lcd_text "0",107,118,4,White,Blue
      175. if Minuten = 3 then lcd_text "0",107,118,4,White,Blue
      176. if Minuten = 4 then lcd_text "0",107,118,4,White,Blue
      177. if Minuten = 5 then lcd_text "0",107,118,4,White,Blue
      178. if Minuten = 6 then lcd_text "0",107,118,4,White,Blue
      179. if Minuten = 7 then lcd_text "0",107,118,4,White,Blue
      180. if Minuten = 8 then lcd_text "0",107,118,4,White,Blue
      181. if Minuten = 9 then lcd_text "0",107,118,4,White,Blue
      182. if Minuten = 0 then lcd_text "0",107,118,4,White,Blue
      183. if Minuten = 0 then incr Stunden
      184. if Stunden = 24 then Stunden = 0
      185. wait 60
      186. next Schleife
      187. loop
      188. Do
      189. '*******************************************************************************
      190. 'test landscape
      191. '*******************************************************************************
      192. #if Modus = 1
      193. For Zahler = 1 To 182
      194. Help_str = Str(zahler)
      195. Temp_str = Format(help_str , "000")
      196. Temp_str = Temp_str + ".bin"
      197. ' Lcd_pic 0 , 0 , 160 , 120 , Temp_str
      198. Next
      199. #endif
      200. Loop
      201. End
      202. '*******************************************************************************
      203. $include "TFTDriver\ST7735_functions-1.inc"
      204. #if Sdcard = 1
      205. $include "Avr-Dos\SD_card_init.inc"
      206. #endif
      207. $include "Font\Font8x8.font"
      208. $include "Font\Font12x16.font"
      209. $include "Font\font8x12.font"
      210. $include "Font\font6x10.font"
      211. $include "Font\font10x16.font"
      Display All
    • Hallo Mitch,
      habe ich jetzt mal abgeändert.
      Anbei der Code, vielen Dank für die Hilfe

      Source Code

      1. '*******************************************************************************
      2. 'Programm for Display ST7735R 1.8Zoll 128x160
      3. ' and Display ILI9163 1.8Zoll 128x160
      4. 'Bascom IDE 2.0.7.7
      5. '
      6. 'Version:13012014
      7. 'By Hkipnik
      8. ' © Copyright by H.Kipnik 2012
      9. 'Date 13.01.2014
      10. '*******************************************************************************
      11. ' SD Card CS --> portD.7
      12. ' Miso --> portb.4
      13. 'Display
      14. ' CS --> portb.2
      15. ' DC --> portb.1
      16. ' reset --> portb.0
      17. ' Mosi --> portb.3
      18. ' Clock --> portb.5
      19. '
      20. '
      21. '*******************************************************************************
      22. $regfile = "m328pdef.dat"
      23. $crystal = 16000000
      24. $hwstack = 50
      25. $swstack = 150
      26. $framesize = 150
      27. $baud = 57600
      28. '*******************************************************************************
      29. Const Sdcard = 0 'use SD Card = 1 no SD Card = 0
      30. Const Modus = 1 '0=Portrait 1=Landscape
      31. Const Driver = 1 '0=ST7735 1=ILI9163
      32. 'only Display ST7735
      33. 'Display typ Red or black Tab have different RGB order
      34. 'color of the display plastic wrap
      35. Const Disp_typ = 0 'RGB order 0=Black Tab 1=Red Tab
      36. '*******************************************************************************
      37. Config Portb.2 = Output
      38. Config Portb.1 = Output
      39. Config Portb.0 = Output
      40. Lcd_cs Alias Portb.2
      41. Lcd_dc Alias Portb.1
      42. Lcd_reset Alias Portb.0
      43. Lcd_reset = 1
      44. Lcd_cs = 1
      45. Lcd_dc = 1
      46. '*******************************************************************************
      47. 'Include Declaration
      48. $include "TFTDriver\ST7735_declarations.inc"
      49. '*******************************************************************************
      50. 'Use For Demo
      51. Dim Help_str As String * 15
      52. Dim Temp_str As String * 15
      53. Dim Zahler As Byte
      54. Dim Bahn1 As String * 20
      55. Dim Bahn2 As String * 20
      56. Dim Bahn3 As String * 20
      57. Dim Bahn4 As String * 20
      58. Dim Bahn5 As String * 20
      59. Dim Bahn6 As String * 20
      60. Dim Bahn7 As String * 20
      61. Dim Stund As String * 20
      62. Dim Minut As String * 20
      63. Dim B1 as Byte
      64. Dim B2 as Byte
      65. Dim B3 as Byte
      66. Dim B4 as Byte
      67. Dim B5 as Byte
      68. Dim B6 as Byte
      69. Dim B7 as Byte
      70. Dim Stunden as Byte
      71. Dim Minuten As Byte
      72. Dim Schleife As Byte
      73. Dim Schleife2 As Byte
      74. B1 = 8
      75. B2 = 15
      76. B3 = 23
      77. B4 = 27
      78. B5 = 31
      79. B6 = 35
      80. B7 = 42
      81. Stunden = 12
      82. Minuten = 00
      83. Schleife2 = 60
      84. '*******************************************************************************
      85. 'Init SD Card and Spi
      86. #if Sdcard = 1
      87. $include "Avr-Dos\Config_MMCSD_HC.bas"
      88. $include "Avr-Dos\Config_AVR-DOS.bas"
      89. Init_sd_card
      90. #endif
      91. #if Sdcard = 0
      92. ' Config Portb.0 = Output 'auch wenn nicht genutzt
      93. ' Portb.0 = 1
      94. Config Spi = Hard , Interrupt = Off , Data Order = Msb , Master = Yes , Polarity = High , Phase = 1 , Clockrate = 4 , Noss = 1
      95. Spsr.0 = 1
      96. Spiinit
      97. #endif
      98. '*******************************************************************************
      99. 'Init the Dispaly
      100. Lcd_init
      101. Lcd_clear Black
      102. '*******************************************************************************
      103. #if Sdcard = 1
      104. Call Init_sd_card() 'Init SD Card
      105. Temp_str = "SD Card= " + Str(sd_ok)
      106. Lcd_text Temp_str , 1 , 1 , 1 , Yellow , Black
      107. ' 1 OK
      108. ' 0 Error
      109. Temp_str = "SD Card Typ= " + Str(mmcsd_cardtype)
      110. Lcd_text Temp_str , 1 , 20 , 1 , Yellow , Black
      111. ' 0 can't init the Card
      112. ' 1 MMC
      113. ' 2 SDSC Spec. 1.x
      114. ' 4 SDSC Spec. 2.0 or later
      115. ' 12 SDHC Spec. 2.0 or later
      116. Wait 2
      117. Lcd_clear Black
      118. #endif
      119. do
      120. For Schleife = 1 to 60
      121. Lcd_clear Blue
      122. Lcd_text "HAMBURG HBF Gleis Abf." , 1 , 3 , 4 , White , Blue
      123. Lcd_text "ICE577" , 2 , 20 , 4 , Black , White
      124. Lcd_text "ICE321" , 2 , 32 , 4 , Black , White
      125. Lcd_text "ICE437" , 2 , 44 , 4 , Black , White
      126. Lcd_text "RE8513" , 2 , 56 , 4 , Black , White
      127. Lcd_text "RE2566" , 2 , 68 , 4 , Black , White
      128. Lcd_text "ICE566" , 2 , 80 , 4 , Black , White
      129. Lcd_text "RE3548" , 2 , 92 , 4 , Black , White
      130. Lcd_text "min" , 142 , 20 , 4 , White , Blue
      131. Lcd_text "min" , 142 , 32 , 4 , White , Blue
      132. Lcd_text "min" , 142 , 44 , 4 , White , Blue
      133. Lcd_text "min" , 142 , 56 , 4 , White , Blue
      134. Lcd_text "min" , 142, 68 , 4 , White , Blue
      135. Lcd_text "min" , 142 , 80 , 4 , White , Blue
      136. Lcd_text "min" , 142 , 92 , 4 , White , Blue
      137. lcd_text ":" , 95 , 118 , 4 , White , Blue
      138. Bahn1 = "Berlin HBF 2 " + str(B1)
      139. Lcd_text Bahn1 , 42 , 20 , 4 , White , Blue
      140. Bahn2 = "Koeln HBF 3 " + str(B2)
      141. Lcd_text Bahn2 , 42 , 32 , 4 , White , Blue
      142. Bahn3 = "Kiel HBF 5 " + str(B3)
      143. Lcd_text Bahn3 , 42 , 44 , 4 , White , Blue
      144. Bahn4 = "HH-Altona 8 " + str(B4)
      145. Lcd_text Bahn4 , 42 , 56 , 4 , White , Blue
      146. Bahn5 = "Luebeck 4 " + str(B5)
      147. Lcd_text Bahn5 , 42 , 68 , 4 , White , Blue
      148. Bahn6 = "Hagen HBF 1 " + str(B6)
      149. Lcd_text Bahn6 , 42 , 80 , 4 , White , Blue
      150. Bahn7 = "Bremen 6 " + str(B7)
      151. Lcd_text Bahn7 , 42 , 92 , 4 , White , Blue
      152. Lcd_text "Uhrzeit" , 10 , 118 , 4 , White , Blue
      153. Stund = " " + str(Stunden)
      154. Lcd_text Stund , 67 , 118 , 4 , White , Blue
      155. Minut = " " + str(Minuten)
      156. Lcd_text Minut , 112 , 118 , 4 , White , Blue
      157. decr B1
      158. decr B2
      159. decr B3
      160. decr B4
      161. decr B5
      162. decr B6
      163. decr B7
      164. incr Minuten
      165. if B1 = 0 then B1 = 60
      166. if B2 = 0 then B2 = 60
      167. if B3 = 0 then B3 = 60
      168. if B4 = 0 then B4 = 60
      169. if B5 = 0 then B5 = 60
      170. if B6 = 0 then B6 = 60
      171. if B7 = 0 then B7 = 60
      172. if Minuten = 1 then lcd_text "0",107,118,4,White,Blue
      173. if Minuten = 2 then lcd_text "0",107,118,4,White,Blue
      174. if Minuten = 3 then lcd_text "0",107,118,4,White,Blue
      175. if Minuten = 4 then lcd_text "0",107,118,4,White,Blue
      176. if Minuten = 5 then lcd_text "0",107,118,4,White,Blue
      177. if Minuten = 6 then lcd_text "0",107,118,4,White,Blue
      178. if Minuten = 7 then lcd_text "0",107,118,4,White,Blue
      179. if Minuten = 8 then lcd_text "0",107,118,4,White,Blue
      180. if Minuten = 9 then lcd_text "0",107,118,4,White,Blue
      181. if Minuten = 0 then lcd_text "0",107,118,4,White,Blue
      182. if Minuten = 60 then
      183. Minuten = 0
      184. incr Stunden
      185. if Stunden = 24 then Stunden = 0
      186. End if
      187. wait 60
      188. next Schleife
      189. loop
      190. Do
      191. '*******************************************************************************
      192. 'test landscape
      193. '*******************************************************************************
      194. #if Modus = 1
      195. For Zahler = 1 To 182
      196. Help_str = Str(zahler)
      197. Temp_str = Format(help_str , "000")
      198. Temp_str = Temp_str + ".bin"
      199. ' Lcd_pic 0 , 0 , 160 , 120 , Temp_str
      200. Next
      201. #endif
      202. Loop
      203. End
      204. '*******************************************************************************
      205. $include "TFTDriver\ST7735_functions-1.inc"
      206. #if Sdcard = 1
      207. $include "Avr-Dos\SD_card_init.inc"
      208. #endif
      209. $include "Font\Font8x8.font"
      210. $include "Font\Font12x16.font"
      211. $include "Font\font8x12.font"
      212. $include "Font\font6x10.font"
      213. $include "Font\font10x16.font"
      Display All