Hallo,
ich möchte gerne ein 320x240 LCD betreiben.
mein Controller ist ein ATMEGA 128 und der LCD Controller ein S1D13700.
ich programmiere in C (AVRStudio).
ich weiß momentan echt nicht mehr weiter.
ich habe im Internet ein Beispiel gefunden für einen ATMega 324.
also ja fast passend.
scheitern tut das ganze aber glaube ich ganz wo anderst.
ich habe eine Debuggerfunktion (JTAG ICE).
damit sehe ich dass mir der Controller überhaupt nicht über die
Initialisierung der Displayports hinauskommt.
hier mal der code:
1 | #include <avr/io.h>
|
2 | #include "sed1335.h"
|
3 | #include "graphic.h"
|
4 | #include "logos.h"
|
5 | #include <util/delay.h>
|
6 | #include "compat/deprecated.h"
|
7 |
|
8 | void pixel_test(void);
|
9 | void logo_test(void);
|
10 | void line_test(void);
|
11 | void circle_test(void);
|
12 |
|
13 |
|
14 | int main(void)
|
15 | {
|
16 | sbi(DDRB,7);
|
17 | cbi(PORTB,7);
|
18 |
|
19 |
|
20 | //PWM (Timer2)
|
21 | TCCR2 = 0b01100001; //PWM einstellen
|
22 | TCNT2 = 0;
|
23 | OCR2 = 180; //PWM-Wert von 0-255
|
24 |
|
25 | /* Start stability test */
|
26 | _delay_ms(300);
|
27 |
|
28 | GLCD_Initialize();
|
29 |
|
30 |
|
31 |
|
32 | while(1)
|
33 | {
|
34 | logo_test();
|
35 | _delay_ms(3000);
|
36 | pixel_test();
|
37 | _delay_ms(3000);
|
38 | line_test();
|
39 | _delay_ms(3000);
|
40 | circle_test();
|
41 | _delay_ms(3000);
|
42 | }
|
43 | }
|
44 | void logo_test(void)
|
45 | {
|
46 | char buf[] = "Stability Test";
|
47 | GLCD_ClearText();
|
48 | GLCD_ClearGraphic();
|
49 | GLCD_TextGoTo(0,0);
|
50 | GLCD_WriteText(buf);
|
51 | GLCD_TextGoTo(26,29);
|
52 | GLCD_WriteText(buf);
|
53 | GLCD_Bitmap((char *) logos, 0, 0, 320, 240);
|
54 | }
|
55 | void pixel_test(void)
|
56 | {
|
57 | int x;
|
58 | int y;
|
59 | unsigned char c;
|
60 |
|
61 | GLCD_ClearText();
|
62 | GLCD_ClearGraphic();
|
63 |
|
64 | c = 0;
|
65 | for (y = 0; y < 240; y++)
|
66 | {
|
67 | c = !c;
|
68 | for (x = 0; x < 320; x++)
|
69 | {
|
70 | c = !c;
|
71 | GLCD_SetPixel(x,y,c);
|
72 | }
|
73 | }
|
74 | }
|
75 | void line_test(void)
|
76 | {
|
77 |
|
78 | int x1;
|
79 | int y1;
|
80 | int x2;
|
81 | int y2;
|
82 | int i;
|
83 |
|
84 | GLCD_ClearText();
|
85 | GLCD_ClearGraphic();
|
86 |
|
87 | x1 = 0; y1 = 0; x2 = 319; y2 = 239;
|
88 |
|
89 | for (i = 0; i < 160; i++)
|
90 | {
|
91 | GLCD_Line(x1, y1,x2,y2);
|
92 | x1+=2;
|
93 | x2-=2;
|
94 | }
|
95 |
|
96 | x1 = 0; y1 = 0; x2 = 319; y2 = 239;
|
97 |
|
98 | for (i = 0; i < 120; i++)
|
99 | {
|
100 | GLCD_Line(x1, y1,x2,y2);
|
101 | y1+=2;
|
102 | y2-=2;
|
103 | }
|
104 |
|
105 | }
|
106 | void circle_test(void)
|
107 | {
|
108 | int x1;
|
109 | int y1;
|
110 | int r;
|
111 | int i;
|
112 |
|
113 | x1 = 160; y1 = 120; r = 10;
|
114 |
|
115 | GLCD_ClearText();
|
116 | GLCD_ClearGraphic();
|
117 |
|
118 | for (i = 0; i < 55; i++)
|
119 | {
|
120 | GLCD_Circle(x1,y1,r);
|
121 | r += 2;
|
122 | }
|
123 | }
|
so und der fehler ist der, dass ich gar nicht bis in die while-schleife
komme.
nach durchlaufen der Funktion "GLCD_InitializePorts();" fängt der
Debugger wieder von vorne an wie als ober ein Reset durchgeführt würde
oda so ähnlich.
ich schnalls nicht mehr.
bitte helft mir!!!!
es kann ja normal nicht am beispiel liegen das ist original und
unverändert bis auf meine Datenports und Controllports vom LCD.
vll eine einstellung im Studio oder Fusebits??
danke für jede hilfe
martin!!!!