Forum: Mikrocontroller und Digitale Elektronik Seltsames Verhalten Mega644p und S65 LCD


von Kay P. (kay)


Angehängte Dateien:

Lesenswert?

Hallo zusammen,

ich habe ein Problem mit Steuerung die ich gebaut habe. Über einen 
Schiebeschalter kann ich die Hintergrundbeleuchtung des S65 LCD 
einschalten. Wenn ich die Beleuchtung einschalte, dann resettet sich der 
Atmega644p sporadisch. Der Atmega besitzt die obligatorische 
Resetbeschaltung mit einem Widerstand. Ich dachte mir zu Beginn erst, 
das die 5V Spannungsversorgung vielleicht zusammenbricht. Dies ist 
jedoch nicht der Fall. Mit meinem Oszilloskop kann ich auch keine 
Spitzen erkennen. Einen Schaltplan habe ich nicht. Der Plan entstand im 
Kopf. Watchdog und BOD sind per Fuses ausgeschalten. Hier ist ein Code 
mit dem ich das ganze momentan teste.

########################################################################
########################################################################
'-------------------------------------- Chipdefinition 
-------------------------------------------------------
$regfile = "m644pdef.dat"
$crystal = 18432000
$hwstack = 64
$swstack = 128
$framesize = 64
$baud = 19200
'------------------------------------- Definition Paramter/Kommando 
------------------------------
Const Kommando = 1
Const Parameter = 0
'------------------------------------- Portdefinition 
--------------------------------------------------------
Rs Alias Portb.1
Cs Alias Portb.2
Sclk Alias Portb.3
Sdata Alias Portb.4
Lcdreset Alias Portb.0
Ddrb = &B00011111
Config Portd.7 = Output
Config Pind.6 = Input
Config Pind.2 = Input
Config Pind.3 = Input
Config Pinc.5 = Input
Config Pinc.4 = Input
Config Pinc.3 = Input
Config Pinc.2 = Input

'--- Uhr ---
Config Date = Dmy , Separator = .
Config Clock = Soft , Gosub = Sectic
Tccr2a = &B0000_0000 
'Timer/Counter Control Register TCCR2A
Tccr2b = &B0000_0101 
'Timer/Counter Control Register TCCR2B
Time$ = "21:00:00"
Date$ = "09.11.09"
Enable Interrupts

'------------------------------------- Farbwerte definieren 
--------------------------------------------------
Const Blau = &B0000000000011111
Const Gelb = &HFFE0
Const Rot = &B1111100000000000
Const Gruen = &B0000011111100000
Const Schwarz = &B0000000000000000
Const Weiss = &B1111111111111111
Const Hellgruen = &B1001111111110011
Const Dunkelgruen = &B0000001101100000
Const Dunkelrot = &B1001100000000000
Const Dunkelblau = &B0000000000010011
Const Hellblau = &B1101111011011111
Const Orange = &B1111110011000110
Const Orange2 = &B1111101110000011
Const Lila = &B1111100000011111

'------------------------------------- Sub Deklarierung 
-------------------------------------------------
Declare Sub Cls_bottomtop(byval Color As Word)
Declare Sub Cls_leftright(byval Color As Word)
Declare Sub Lcd_print(byval Lcd_text As String , Byval Lcd_posx As Byte 
, Byval Lcd_posy As Byte , Byval Fontsize As Byte , Byval Lcd_fcolor As 
Word , Byval Lcd_bcolor As Word)
Declare Sub Pset1(byval Lx1 As Byte , Byvally1 As Byte , Byvalcolor As 
Word)
Declare Sub Lcd_box(byval Lx1 As Byte , Byval Ly1 As Byte , Byval Lx2 As 
Byte , Byval Ly2 As Byte , Byval Color As Word)
'------------------------------------- Dims 
------------------------------------------------------------------

Dim Fontsize As Byte
Dim Lcd_posx As Byte
Dim Lcd_posy As Byte
Dim Lcd_fcolor As Word , Drehung As Byte
Dim Lcd_bcolor As Word
Dim Fontbreite As Byte , Fonthoehe As Byte , Xpixel As Byte , Ypixel As 
Byte
Dim R As Integer , X1 As Byte , X2 As Byte , Y1 As Byte , Y2 As Byte , E 
As Byte , F As Integer , G As Long , Zeichen As String * 1
Dim X1_a As Byte , X2_a As Byte
Dim A As Word , B As Byte , C As Integer , D As Integer , T1 As Byte , 
T2 As Byte
Dim Pix As Byte , Gapx As Double , Gapy As Double , S As Byte
Dim X As Byte , Y As Byte , H As Integer , M As Integer , Pixel As 
Integer , Schleife As Word , Hx As Integer , Hy As Integer , Xinc As 
Integer , Yinc As Integer
Dim Temp As Byte
Dim Trot As Byte , Tblau As Byte , Tgruen As Byte
Dim Lx1 As Byte , Ly1 As Byte , Zeichenarraylsb(16) As Byte , 
Zeichenarraymsb(16) As Byte
Dim Xg As Byte , Yg As Byte
Dim J As Word
Dim Temp1 As Byte , Temp2 As Byte , Temp3 As Byte , Temp4 As Byte
Dim Ausgabe As Word
Dim Tempw As Word
Dim Farbe As Word
Dim G_byte As Byte , Type As Byte
Dim Tempfb As Byte
Dim I As Word
Dim Q As Byte
Dim Zahler As String * 5
Dim Speed As Word
Dim Flag As Bit
Dim Flag_main As Bit
Dim Speed_ticks As Byte
Dim Sekunden As Byte
Dim Speed_string As String * 5
Dim Pos_string As String * 4
Dim Pos As Word

'------ Font ------
'---------------
Dim Fontb As Byte , Fonth As Byte
Dim Zeile As Word

'--- Init für Display ---
$include "resetinit.bas"

'--- Boot ---
Call Cls_bottomtop(weiss)                                   ' Screen 
weiß zeichnen
For Q = 0 To 176
Call Pset1(q , 23 , Schwarz)
Call Pset1(q , 106 , Schwarz)
Next Q

For Q = 0 To 23
Call Pset1(52 , Q , Schwarz )
Call Pset1(113 , Q , Schwarz )
Next Q

Call Lcd_print( "Info" , 2 , 2 , 0 , Blau , Weiss)
Call Lcd_print( "E/A" , 10 , 2 , 0 , Blau , Weiss )
Call Lcd_print( "Exit" , 17 , 2 , 0 , Blau , Weiss)
Call Lcd_print( "UKK Vers. 1.0.2 RuPo" , 2 , 8 , 1 , Blau , Weiss)
'Call Lcd_print( "Speed H-UTR :" , 2 , 12 , 0 , Blau , Weiss)
'Call Lcd_print( "Klammerpos. :" , 2 , 10 , 0 , Blau , Weiss)




'--- Hauptprogramm ---
Main:

Goto Main

Sectic:
Call Lcd_print(date$ , 8 , 6 , 1 , Schwarz , Weiss)
Call Lcd_print(time$ , 8 , 4 , 1 , Schwarz , Weiss)

Print "Datum: " ; Date$ ; "   " ; "Uhrzeit: " ; Time$

Return



'----------------------------------------------------------------------- 
----------------

'--------------------------------- Subs 
---------------------------------------------------------------
$include "subs.bas"
$include "color8X8.font"
$include "gui.bas"
$include "ea.bas"
###################################################################
###################################################################

Ich weiß momentan nicht mehr, wo ich noch suchen soll. Der 7809 für die 
Hintergrundbeleuchtung hat außer masse keine Verbindung zum Rest der 
Schaltung.

Kann mir jemand einen Tip geben, wo ich noch nachsehen könnte ?

Danke und Gruß
Kay

von Pete K. (pete77)


Lesenswert?

Hast Du AGND und AVCC beschaltet? Ich sehe keine Abblockkondensatoren.

Zieht die Hintergrundbeleuchtung zu viel Strom? Hast Du die electrical 
characteristics des 644 eingehalten?

von Kay P. (kay)


Lesenswert?

Hallo Pete,

danke für die Antwort. AGND und AVCC sind verschalten. Ich habe jedoch 
wirklich keine Ablockkondensatoren an diesen Pins. Das werde ich 
nachholen und testen. Die Hintergrundbeleuchtung zieht 19mA.

Gruß Kay

von Kay P. (kay)


Lesenswert?

Hallo,

nochmals danke für den Tip. Ich habe einen 100nF Ablockkondensator 
eingebaut und es läuft.

Gruß Kay

Bitte melde dich an um einen Beitrag zu schreiben. Anmeldung ist kostenlos und dauert nur eine Minute.
Bestehender Account
Schon ein Account bei Google/GoogleMail? Keine Anmeldung erforderlich!
Mit Google-Account einloggen
Noch kein Account? Hier anmelden.