Hallo HansHans,
anbei das Programm, leider zählt er die Stunden nicht hoch, ich habe den Fehler aber noch nicht gefunden.
Gruß Thomas
Alles anzeigen
anbei das Programm, leider zählt er die Stunden nicht hoch, ich habe den Fehler aber noch nicht gefunden.
Gruß Thomas
Quellcode
- '*******************************************************************************
- 'Programm for Display ST7735R 1.8Zoll 128x160
- ' and Display ILI9163 1.8Zoll 128x160
- 'Bascom IDE 2.0.7.7
- '
- 'Version:13012014
- 'By Hkipnik
- ' © Copyright by H.Kipnik 2012
- 'Date 13.01.2014
- '*******************************************************************************
- ' SD Card CS --> portD.7
- ' Miso --> portb.4
- 'Display
- ' CS --> portb.2
- ' DC --> portb.1
- ' reset --> portb.0
- ' Mosi --> portb.3
- ' Clock --> portb.5
- '
- '
- '*******************************************************************************
- $regfile = "m328pdef.dat"
- $crystal = 16000000
- $hwstack = 50
- $swstack = 150
- $framesize = 150
- $baud = 57600
- '*******************************************************************************
- Const Sdcard = 0 'use SD Card = 1 no SD Card = 0
- Const Modus = 1 '0=Portrait 1=Landscape
- Const Driver = 1 '0=ST7735 1=ILI9163
- 'only Display ST7735
- 'Display typ Red or black Tab have different RGB order
- 'color of the display plastic wrap
- Const Disp_typ = 0 'RGB order 0=Black Tab 1=Red Tab
- '*******************************************************************************
- Config Portb.2 = Output
- Config Portb.1 = Output
- Config Portb.0 = Output
- Lcd_cs Alias Portb.2
- Lcd_dc Alias Portb.1
- Lcd_reset Alias Portb.0
- Lcd_reset = 1
- Lcd_cs = 1
- Lcd_dc = 1
- '*******************************************************************************
- 'Include Declaration
- $include "TFTDriver\ST7735_declarations.inc"
- '*******************************************************************************
- 'Use For Demo
- Dim Help_str As String * 15
- Dim Temp_str As String * 15
- Dim Zahler As Byte
- Dim Bahn1 As String * 20
- Dim Bahn2 As String * 20
- Dim Bahn3 As String * 20
- Dim Bahn4 As String * 20
- Dim Bahn5 As String * 20
- Dim Bahn6 As String * 20
- Dim Bahn7 As String * 20
- Dim Stund As String * 20
- Dim Minut As String * 20
- Dim B1 as Byte
- Dim B2 as Byte
- Dim B3 as Byte
- Dim B4 as Byte
- Dim B5 as Byte
- Dim B6 as Byte
- Dim B7 as Byte
- Dim Sd as Byte
- Dim Mi As Byte
- Dim Schleife As Byte
- Dim Schleife2 As Byte
- B1 = 20
- B2 = 15
- B3 = 28
- B4 = 32
- B5 = 11
- B6 = 23
- B7 = 8
- Sd = 12
- Mi = 45
- Schleife2 = 59
- '*******************************************************************************
- 'Init SD Card and Spi
- #if Sdcard = 1
- $include "Avr-Dos\Config_MMCSD_HC.bas"
- $include "Avr-Dos\Config_AVR-DOS.bas"
- Init_sd_card
- #endif
- #if Sdcard = 0
- ' Config Portb.0 = Output 'auch wenn nicht genutzt
- ' Portb.0 = 1
- Config Spi = Hard , Interrupt = Off , Data Order = Msb , Master = Yes , Polarity = High , Phase = 1 , Clockrate = 4 , Noss = 1
- Spsr.0 = 1
- Spiinit
- #endif
- '*******************************************************************************
- 'Init the Dispaly
- Lcd_init
- Lcd_clear Black
- '*******************************************************************************
- #if Sdcard = 1
- Call Init_sd_card() 'Init SD Card
- Temp_str = "SD Card= " + Str(sd_ok)
- Lcd_text Temp_str , 1 , 1 , 1 , Yellow , Black
- ' 1 OK
- ' 0 Error
- Temp_str = "SD Card Typ= " + Str(mmcsd_cardtype)
- Lcd_text Temp_str , 1 , 20 , 1 , Yellow , Black
- ' 0 can't init the Card
- ' 1 MMC
- ' 2 SDSC Spec. 1.x
- ' 4 SDSC Spec. 2.0 or later
- ' 12 SDHC Spec. 2.0 or later
- Wait 2
- Lcd_clear Black
- #endif
- do
- Lcd_clear Blue
- Lcd_text "HAMBURG HBF Gleis Abf." , 1 , 3 , 4 , White , Blue
- Lcd_text "ICE577" , 1 , 20 , 4 , Black , White
- Lcd_text "ICE321" , 1 , 32 , 4 , Black , White
- Lcd_text "ICE437" , 1 , 44 , 4 , Black , White
- Lcd_text "RE8513" , 1 , 56 , 4 , Black , White
- Lcd_text "RE2566" , 1 , 68 , 4 , Black , White
- Lcd_text "ICE566" , 1 , 80 , 4 , Black , White
- Lcd_text "RE3548" , 1 , 92 , 4 , Black , White
- For Schleife = 1 to 60
- Bahn1 = "Berlin HBF 2 " + str(B1) + " min"
- Lcd_text Bahn1 , 42 , 20 , 4 , White , Blue
- Bahn2 = "Koeln HBF 3 " + str(B2) + " min"
- Lcd_text Bahn2 , 42 , 32 , 4 , White , Blue
- Bahn3 = "Kiel HBF 5 " + str(B3) + " min"
- Lcd_text Bahn3 , 42 , 44 , 4 , White , Blue
- Bahn4 = "HH-Altona 8 " + str(B4) + " min"
- Lcd_text Bahn4 , 42 , 56 , 4 , White , Blue
- Bahn5 = "Luebeck 4 " + str(B5) + " min"
- Lcd_text Bahn5 , 42 , 68 , 4 , White , Blue
- Bahn6 = "Hagen HBF 1 " + str(B6) + " min"
- Lcd_text Bahn6 , 42 , 80 , 4 , White , Blue
- Bahn7 = "Bremen 6 " + str(B7) + " min"
- Lcd_text Bahn7 , 42 , 92 , 4 , White , Blue
- Lcd_text "Uhrzeit" , 25 , 118 , 4 , White , Blue
- Stund = " " + str(Sd) + ":"
- Lcd_text Stund , 70 , 118 , 4 , White , Blue
- Lcd_text " " , 92 , 118 , 4 , White , Blue
- Minut = " " + str(Mi) + " "
- Lcd_text Minut , 100 , 118 , 4 , White , Blue
- decr Schleife2
- decr B1
- decr B2
- decr B3
- decr B4
- decr B5
- decr B6
- decr B7
- incr Mi
- 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 Mi = 60 then Mi = 0
- if sd = 23 then sd = 0
- if Schleife2 = 0 then incr Sd
- wait 1
- next Schleife
- loop
- Do
- '*******************************************************************************
- 'test landscape
- '*******************************************************************************
- #if Modus = 1
- For Zahler = 1 To 182
- Help_str = Str(zahler)
- Temp_str = Format(help_str , "000")
- Temp_str = Temp_str + ".bin"
- ' Lcd_pic 0 , 0 , 160 , 120 , Temp_str
- Next
- #endif
- Loop
- End
- '*******************************************************************************
- $include "TFTDriver\ST7735_functions-1.inc"
- #if Sdcard = 1
- $include "Avr-Dos\SD_card_init.inc"
- #endif
- $include "Font\Font8x8.font"
- $include "Font\Font12x16.font"
- $include "Font\font8x12.font"
- $include "Font\font6x10.font"
- $include "Font\font10x16.font"