- SF800 Solar Speicher Tutorial         
Seite 5 von 6 ErsteErste ... 3456 LetzteLetzte
Ergebnis 41 bis 50 von 53

Thema: Wecker mit 320x240 Touch, ATmega 2560, Ethernet, MMC und MP3

  1. #41
    tzlo
    Gast
    Anzeige

    Powerstation Test
    Zitat Zitat von Ratber
    Zitat Zitat von tzlo
    Also jetzt so wirds bei uns um 5:30 schon richtig helll und mein wecker klingelt erst um 6:25Uhr und bis dahin bin ich schon laaaaange wach und online x)
    Du hast es gut.

    5:30 bin ich längst auf der Arbeit und 6:30 mach ich die erste Kaffeepause.
    Jo, shit happens...ich gehe ja auch noch zur Schule^^

    Dann will ich auch mal nen bisschen Code posten (wär ganz Nett, wenn jemand drübergucken könnte, falls er fehler entdeckt [ist nidcht der ganze code, nur das initialiesieren vom screen und hauptmenü])

    Code:
    $regfile = "m2560def.DAT"
    $crystal = 18000
    $baud = 9200
    $eepleave
    $loadersize = 512
    $hwstack = 100
    $swstack = 75
    $framesize = 40
    $lib "glcdKS108.lib" 'Include the library for the KS-108 controler
    
    
    Config Graphlcd = 320 * 240sed , Dataport = Porta , Controlport = Portc , Ce = 0 , Ce2 = 1 , Cd = 2 , Rd = 3 , Reset = 5 , Enable = 4
    'The dataport is the portname that is connected to the data lines of the LCD
    'The controlport is the portname which pins are used to control the lcd
    'CE =CS1 Chip select
    'CE2=CS2 Chip select second chip
    'CD=Data/instruction
    'RD=Read
    'RESET = reset
    'ENABLE= Chip Enable
    
    
    Config Adc = Single , Prescaler = Auto , Reference = Internal 'Setting up the a/d convertor
    Config Timer1 = Timer , Prescale = 1024 ' Timer 1 sets the screen back to the mainmenu after 10sec
    Const Timer1preload = 58336 'Timer 1 preload for 1 sec interrupt
    
    
    Speaker Alias Portf.7 'Buzzer connected to portf.7, see circuit diagram
    Dim Temp As Byte , X As Word , Y As Word
    Dim Row As Byte , Keyarray(3) As Byte , Col As Byte , Key As Byte , Keylus As Byte
    Dim Keypressed As Byte , Menu As Byte
    Dim Timecount As Byte
    Setfont Font8x8
    Enable Ovf1
    Enable Interrupts
    On Timer1 1secint ' on overflow jump to 1 sec int routine
    Start Adc ' Start the A<->D convertor
    Stop Timer1
    
    Gosub Showmainmenu ' Starts with the Mainmenu
    ' =====Main=====
    Main:
    Do
    '*************************
    ' Here your main prog
    '*************************
     Gosub Readtouch  ' Read the touch cordinates
     Gosub Whichkey ' Which key is pressed
    If Menu > 1 Then ' Starts the timer if the menu is not the Mainmenu
      Start Timer1
    Else
     Stop Timer1
    End If
    
    If Keypressed > 0 Then ' Key is pressed
     Select Case Menu ' Depends on the menu that we are in what to do with the pressed key
     Case 1 : Select Case Keypressed 'Mainmenu
     Case 11 : Print " You pressed key: " ; Keypressed ; " in menu: " ; Menu
     Case 12 : Print " You pressed key: " ; Keypressed ; " in menu: " ; Menu
     Case 13 : Print " You pressed key: " ; Keypressed ; " in menu: " ; Menu
     Case 21 : Print " You pressed key: " ; Keypressed ; " in menu: " ; Menu
     Case 22 : Print " You pressed key: " ; Keypressed ; " in menu: " ; Menu
     Case 23 : Gosub Showlichteettafelmenu ' Shows a sub menu
     Case 31 : Print " You pressed key: " ; Keypressed ; " in menu: " ; Menu
     Case 32 : Print " You pressed key: " ; Keypressed ; " in menu: " ; Menu
     Case 33 : Print " You pressed key: " ; Keypressed ; " in menu: " ; Menu
     Case 41 : Print " You pressed key: " ; Keypressed ; " in menu: " ; Menu
     Case 42 : Print " You pressed key: " ; Keypressed ; " in menu: " ; Menu
     Case 43 : Print " You pressed key: " ; Keypressed ; " in menu: " ; Menu
     End Select
    
    Case 13 : Select Case Keypressed 'LichtEetafelmenu (menu 13)
     Case 11 : Print " You pressed key: " ; Keypressed ; " in menu: " ; Menu
     Case 12 : Print " You pressed key: " ; Keypressed ; " in menu: " ; Menu
     Case 13 : Gosub Showmainmenu ' Back to the mainmenu
     Case 21 : Print " You pressed key: " ; Keypressed ; " in menu: " ; Menu
     Case 22 : Print " You pressed key: " ; Keypressed ; " in menu: " ; Menu
     Case 23 : Print " You pressed key: " ; Keypressed ; " in menu: " ; Menu
     Case 31 : Print " You pressed key: " ; Keypressed ; " in menu: " ; Menu
     Case 32 : Print " You pressed key: " ; Keypressed ; " in menu: " ; Menu
     Case 33 : Print " You pressed key: " ; Keypressed ; " in menu: " ; Menu
     Case 41 : Print " You pressed key: " ; Keypressed ; " in menu: " ; Menu
     Case 42 : Print " You pressed key: " ; Keypressed ; " in menu: " ; Menu
     Case 43 : Print " You pressed key: " ; Keypressed ; " in menu: " ; Menu
     End Select
    End Select
     Keypressed = 0 ' Key is processed so put it back to 0
    End If
    Loop
    
    
    '=== Subroutines===
    $include "font8x8.font"
    
    1secint: ' Interrupt routine will set the screen back to the mainmenu in 10 seconds
    Incr Timecount ' increment every sec the counter with 1
    If Timecount => 10 Then ' here is the 10 sec
     Stop Timer1 : Timecount = 0
     Gosub Showmainmenu ' Sets the screen
    Else
     Timer1 = Timer1preload
    End If
    Return
    
    
    Showmainmenu: 'Shows the main menu
    Menu = 1 'Menu number
    Cls 'Clears the screen
    Showpic 0 , 0 , Headerhoofdmenu ' Draw the 9 pictures on the screen
    Showpic 0 , 16 , Jalvoor
    Showpic 32 , 16 , Jalachter
    Showpic 64 , 16 , Lichtkeuken
    Showpic 96 , 16 , Autoprog
    Showpic 0 , 40 , Lichtsalontafel
    Showpic 32 , 40 , Lichteettafel
    Showpic 64 , 40 , Schemerlamp
    Showpic 96 , 40 , Pijlrechts
    Return
    
    Showlichteettafelmenu: ' Shows the ShowLichtEetafel menu (sub menu 13)
    Menu = 13 ' Menu number
    Cls  'Clears the screen
    Showpic 0 , 0 , Headerlichteettafel ' Draw the 9 pictures on the screen
    Showpic 0 , 16 , Stopbutton
    Showpic 32 , 16 , Pijlomhoog
    Showpic 64 , 16 , F1preset
    Showpic 96 , 16 , F2preset
    Showpic 0 , 40 , Escbutton
    Showpic 32 , 40 , Pijlomlaag
    Showpic 64 , 40 , F3preset
    Showpic 96 , 40 , F4preset
    Return
    
    
    Whichkey: 'Determins which key is pressed
    Select Case X ' For the x value
     Case 200 To 340 : Col = 10 ' The cordinates on the touchscreen determins which key is pressed for example;
     Case 341 To 486 : Col = 20  ' 341 to 486 are the cordinates where between the second column is
     Case 487 To 635 : Col = 30
     Case 636 To 774 : Col = 40
     Case Else Col = 0
    End Select
    Select Case Y  ' For the y value
     Case 250 To 360 : Row = 1 ' The cordinates on the touchscreen determins which key is pressed for example;
     Case 361 To 540 : Row = 2 ' 361 to 540 are the cordinates where between the second row is
     Case 541 To 730 : Row = 3
     Case Else Row = 0
    End Select
    Key = Col + Row ' Add the row and column value so we get 1 key value
    If Key > 0 Then ' There is a key pressed
     Keyarray(keylus) = Key 'Must read the same key 3 times in a row, to prefent bouncing
     Incr Keylus
     If Keylus > 3 Then Keylus = 1
     If Keyarray(1) = Keyarray(2) Then
     If Keyarray(2) = Keyarray(3) Then ' Key is correct read 3 times the same
     Sound Speaker , 1 , 65000 ' Give a key beep
     Keypressed = Key
     Timecount = 0
     End If
     End If
     End If
    Return
    
    Readtouch:
    Config Pinf.0 = Output ' Makes port F.0 output
    Config Pinf.2 = Output ' Makes port F.0 output
    Set Portf.0 ' Sets port F.0 High
    Reset Portf.2 ' Sets port F.2 Low
    Ddrf.1 = 0 ' Sets port F.1 as input
    Ddrf.3 = 0 ' Sets port F.1 as input because we need it now as ad input
    Waitms 20 ' Wait until the port is stable
    Y = Getadc(3)  ' Read the ad value for the y
    Y = 1024 - Y ' Invert the reading
    'Print "VALUE Y : " ; Y ' for debugging
    Config Pinf.1 = Output  ' Makes port F.1 output
    Config Pinf.3 = Output ' Makes port F.3 output
    Reset Portf.1 ' Sets port F.1 Low
    Set Portf.3 ' Sets port F.3 High
    Ddrf.0 = 0 ' Sets port F.0 as input
    Ddrf.2 = 0 ' Sets port F.2 as input because we need it now as ad input
    Waitms 20 ' Wait until the port is stable
    X = Getadc(2) ' Read the ad value for the x
    X = 1024 - X ' Invert the reading
    'Print "VALUE X : " ; X
    Return
    
    
    '=====The buttons images=====
    Headerhoofdmenu:
    $bgf "HeaderHoofdmenu.bgf"
    Headerlichteettafel:
    $bgf "HeaderLichtEettafel.bgf"
    Jalvoor:
    $bgf "Jalvoor.bgf"
    Jalachter:
    $bgf "Jalachter.bgf"
    Lichtsalontafel:
    $bgf "LichtSalonTafel.bgf"
    Lichteettafel:
    $bgf "LichtEetTafel.bgf"
    Lichtkeuken:
    $bgf "Lichtkeuken.bgf"
    Schemerlamp:
    $bgf "Schemerlamp.bgf"
    Escbutton:
    $bgf "Esc.bgf"
    Pijlomhoog:
    $bgf "PijlOmhoog.bgf"
    Pijlomlaag:
    $bgf "PijlOmlaag.bgf"
    Pijlrechts:
    $bgf "PijlRechts.bgf"
    Pijllinks:
    $bgf "PijlLinks.bgf"
    Autoprog:
    $bgf "Autoprog.bgf"
    Stopbutton:
    $bgf "Stop.bgf"
    F1preset:
    $bgf "F1preset.bgf"
    F2preset:
    $bgf "F2preset.bgf"
    F3preset:
    $bgf "F3preset.bgf"
    F4preset:
    $bgf "F4preset.bgf"
    F3leeg:
    $bgf "F3Leeg.bgf"
    F4leeg:
    $bgf "F4Leeg.bgf"
    Leeg:
    $bgf "Leeg.bgf"
    Das ist erstaml in Bascom, aber der endgültige Code wird in C geproggt

    Nen EEPROM und nen externes SRAM werde ich noch hinzufügen....

    Mfg Tim

  2. #42
    tzlo
    Gast

    Soooooooooo

    So, ich bin jetzt bei dem Ethernet Board bei version 3, bei dem VS1001 Board bei Version 2 und bei dem USB2µC Wandler bei Version 2...

    Nun ein Paar Pic`s von den Platinen....

    Im Moment ist es so, das der Wecker komplett zerlegt ist, weil ich immerwieder neue platinen ätze... abeer vorab Das ist mein Gehäuse : TEKO AUS33!! Es hat folgende Daten:

    Allgemeines
    Typ Gehäuse Serie AUS/KL
    Farbe hellgrau RAL 9018
    Material Polystyrol

    Ausführung
    Ausführung 2x 1,0 mm Aluminiumplatten

    Maße
    Länge 198,0 mm
    Breite 178,0 mm
    Höhe 108,0 mm
    Miniaturansichten angehängter Grafiken Miniaturansichten angehängter Grafiken board_190.jpg   board_104.jpg   plan_209.jpg   board_414.jpg  

  3. #43
    Benutzer Stammmitglied
    Registriert seit
    04.11.2007
    Beiträge
    43
    Sehr schönes Projekt =D>

    Sehe leider die Bilder von den Platinen nicht. Wäre klasse, wenn du sie nochmals posten könntest

  4. #44
    Benutzer Stammmitglied
    Registriert seit
    04.11.2007
    Beiträge
    43
    hm, fehler lag bei mir

    klasse bilder !!!

  5. #45
    Neuer Benutzer Öfters hier
    Registriert seit
    05.07.2008
    Ort
    Bodenseekreis
    Beiträge
    17
    Hi tzlo,

    gibt es mal wieder neue Bilder und Codezeilen von Deinem Wecker?

    So du es dann realisiert, dokumentiert und den ganzen Code veröffentlicht hast, könnte ich mir ein bisschen Arbeit und Hirnmasse sparen und abkupfern. Eine Uhr brauche ich ja für mein kleines Projekt auch noch, Datum ebenso und ein bisschen Alarm könnte vielleicht auch nicht schaden, wenn ich meinen Funkwecker dann mal entsorge. Dann könnte ich Deinen Wecker auf meine Bedürfnisse zusammenschrumpfen und nachbauen.

    mfg Williboy

  6. #46
    tzlo
    Gast
    so ich will euch auchmal wieder auf dem laufenden halten!

    Also biher geschafft:#

    -ordentliche platine, aber noch beta phase (!!fast jeden tag!! min. 3-4 std dran gearbeitet!!!)
    - frot und rückseite vom gehäuse gemacht
    - hälfte der teile bestellt (200eus!!)

    und:

    nen ISP Adapter gekuft

  7. #47
    Neuer Benutzer Öfters hier
    Registriert seit
    28.09.2008
    Beiträge
    21
    Nicht übel, hattest du nicht schon Bauteile für 300 € angeschafft?

    Viel Erfolg weiterhin,

    Seb

  8. #48
    tzlo
    Gast
    ja sry oben verschrieben, das war jetzt die zweite ladung....

  9. #49
    Benutzer Stammmitglied
    Registriert seit
    27.02.2005
    Beiträge
    58
    Hallo,

    auf seite 2 steht ein Bascomcode für das Display für ein 320x240er LCD.
    Das funktioniert bei mir aber nicht.
    Der Parameter ist falsch.
    Bascom kann ja eigentlich nur bis 255, oder irre ich mich?
    Kann es sein das ich nicht die richtige .lib habe?
    Wäre dankbar für Hilfe.

    Code:
    $lib "glcdKS108.lib" 'Include the library for the KS-108 controler 
    
    
    Config Graphlcd = 320 * 240sed , Dataport = Porta , Controlport = Portc , Ce = 0 , Ce2 = 1 , Cd = 2 , Rd = 3 , Reset = 5 , Enable = 4

    by Holger

  10. #50
    Erfahrener Benutzer Robotik Einstein Avatar von Jaecko
    Registriert seit
    16.10.2006
    Ort
    Lkr. Rottal/Inn
    Alter
    42
    Beiträge
    2.009
    In der Bascom-Hilfe steht doch drin, welche Grössen alles möglich sind...

    "This must be 240 * 64, 128* 128, 128 * 64 , 160 * 48 , 240 * 128, 192 * 64 , SED180*32 or 192 * 64SED."
    #ifndef MfG
    #define MfG

Seite 5 von 6 ErsteErste ... 3456 LetzteLetzte

Berechtigungen

  • Neue Themen erstellen: Nein
  • Themen beantworten: Nein
  • Anhänge hochladen: Nein
  • Beiträge bearbeiten: Nein
  •  

fchao-Sinus-Wechselrichter AliExpress