Hy ich versuche mein 2x16 LCD (LMK62R125A1 - HD44780 mit LIB von Kai Klenovsek) in Betrieb zu nehmen aber es geht nicht. Hat keine LED daher PIN15&PIN16 nicht konnektiert. Pins hab ich alle durchgemessen und sollten ok sein. RS -> PC5 RW -> PC7 E -> PC6 D0-D7 -> PA0-PA7 hier die main: int main(void) { sei(); char Text = 'x'; lcd_init(); lcd_putchar(Text); return 0; } hier der header (nur Änderungen) /*! \brief Select display typ here * \param LCD_TYP 0 = 4x40 * \param LCD_TYP 1 = 2x40, 1x40 * \param LCD_TYP 2 = 2x24, 1x24 * \param LCD_TYP 3 = 4x20, 2x20, 1x20 * \param LCD_TYP 4 = 4x16, 2x16, 1x16 */ #define LCD_TYP 4 /*! \brief Select lcd controll mode here * \param LCD_MODE 8 = 8 Bit Mode * \param LCD_MODE 4 = 4 Bit Mode */ #define LCD_MODE 4 .... #define LCD_DDR_PORT DDRA /*!< Lcd data DDR */ #define LCD_DATA_PORT PORTA /*!< Lcd data PORT */ #define LCD_DATA_PIN PINA /*!< Lcd data PORTIN */ #define RS_DDR DDRC /*!< Data or command DDR */ #define RS_PORT PORTC /*!< Data or command PORT */ #define RS PORTC5 /*!< Data or command BIT */ #define ENA_DDR DDRC /*!< Enable DDR */ #define ENA_PORT PORTC /*!< Enable PORT */ #define ENA PORTC6 /*!< Enable BIT */ #define RW_DDR DDRC /*!< Read / write DDR */ #define RW_PORT PORTC /*!< Read / write PORT */ #define RW PORTC7 /*!< Read / write BIT */ #define BUSY_PORT PORTC /*!< Busy PORT */ #define BUSY_PIN_PORT PINC /*!< Busy PORTIN */ #define BUSY PORTC4 /*!< Busy BIT */ #define ENA2_DDR DDRC /*!< Enable 2 DDR */ #define ENA2_PORT PORTC /*!< Enable 2 PORT */ #define ENA2 PORTC3 /*!< Enable 2 BIT */
Da du nicht sagst, welchen µC du benutzt gehe ich jetzt mal von einem ATmega32 aus. Da du Port A benutzt, hast du wahrscheinlich AVCC nicht angeschloßen und der Port funktioniert ganz einfach nicht. Wichtig ist auch, alle GND zu beschalten.
Achja: #define LCD_MODE 4 Da du den ganzen Port nutzt, trag hier eine 8 ein.
ja nutze ein MEga32. Sorry. ich nutze den Port A für den Datenbus. AVCC liegt auf 5V nur AREF ist nicht konnektiert. kann ich aber auf GND legen. PORTA hab ich alle 8 dran aber wollte beides testen... reicht der code in der main so? P.S.: PORTC3&4 sind nicht vorhanden....
nachdem ich PIN3 am DISP (Vo keine Funktion) gelegt habe sehe ich die erste ZEile komplett schwarz. muss ich da den kontrast regeln?? dachte das ist nur bei Disp mit LED...
Kontrast musst du immer einstellen, egal ob Beleuchtung oder nicht. Stell ihn über ein Potentiometer so ein, wo es am besten zu sehen ist.
Die Steuerleitungen liegen ja auf PortC. Ist der verfügbar? Oder wird der noch vom JTAG blockiert? ...
also JTAG ist deaktiviert. Per PIN3(am LCD) und Poti auf Masse läßt sich die Intensität des schwarzen Balken verändern. Von leicht auf voll Dunkel. sollte aber nicht das Poti an 5V liegen(dabei passiert mit Poti nix!)? aber kann kein Zeichen sehen, nur den vollen Balken. jemand erfahrung mit speziell diesem LCD gemacht? Die Busy Funktion braucht ich bei dem Display nicht?
>Die Busy Funktion braucht ich bei dem Display nicht?
Das hängt vom Code ab. Da deine Datenleitungen
an PORTA hängen sollte der Busy Check natürlich
auch an PORTA stattfinden und nicht auf PORTC.
Poste den kompletten Code. Alles andere führt
hier nur zu rätselraten und bringt nichts.
.c
1 | /**************************************************************************
|
2 | *
|
3 | * INCLUDES
|
4 | *
|
5 | ***************************************************************************/
|
6 | #define F_CPU 4000000UL
|
7 | |
8 | #include <avr/io.h> |
9 | #include <avr/pgmspace.h> |
10 | #include <avr/io.h> |
11 | #include <stdio.h> |
12 | #include <stdlib.h> |
13 | #include <inttypes.h> |
14 | #include <avr/interrupt.h> |
15 | #include <util/delay.h> |
16 | #include "LCD.h" |
17 | |
18 | /**************************************************************************
|
19 | *
|
20 | * UART
|
21 | *
|
22 | ***************************************************************************/
|
23 | |
24 | |
25 | #define BAUD 1200UL
|
26 | #define UBRR_BAUD ((F_CPU)/(16*(BAUD))-1)
|
27 | |
28 | |
29 | /**************************************************************************
|
30 | *
|
31 | * MODUL GLOBAL VARS
|
32 | *
|
33 | ***************************************************************************/
|
34 | |
35 | #if LCD_TYP == 0
|
36 | static unsigned char actcntr = 1; /*!< Actual active lcd controller */ |
37 | #endif
|
38 | |
39 | |
40 | /**************************************************************************
|
41 | *
|
42 | * INTERNAL PROTOTYPES
|
43 | *
|
44 | **************************************************************************/
|
45 | |
46 | //:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
|
47 | /*!\fn static void lcd_waitbusy( void );
|
48 | * \brief Wait until lcd is ready */
|
49 | static void lcd_waitbusy( void ); |
50 | |
51 | |
52 | |
53 | //:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
|
54 | /*!\fn static void lcd_trig_enable( void );
|
55 | * \brief Controll enable pin from lcd */
|
56 | static void lcd_trig_enable( void ); |
57 | |
58 | |
59 | |
60 | /**************************************************************************
|
61 | *
|
62 | * DEFINES
|
63 | *
|
64 | ***************************************************************************/
|
65 | |
66 | // Lcd DDRAM register for 4x40 display
|
67 | #if LCD_TYP == 0
|
68 | #define MAXLINELENGHT 40
|
69 | prog_char screenpos[2] = { 0x80, 0xC0 }; |
70 | #endif
|
71 | |
72 | |
73 | // Lcd DDRAM register for 2x40 display
|
74 | #if LCD_TYP == 1
|
75 | #define MAXLINELENGHT 40
|
76 | prog_char screenpos[2] = { 0x80, 0xC0 }; |
77 | #endif
|
78 | |
79 | |
80 | // Lcd DDRAM register for 2x24 display
|
81 | #if LCD_TYP == 2
|
82 | #define MAXLINELENGHT 24
|
83 | prog_char screenpos[2] = { 0x80, 0xC0 }; |
84 | #endif
|
85 | |
86 | |
87 | // Lcd DDRAM register for 4x20 display
|
88 | #if LCD_TYP == 3
|
89 | #define MAXLINELENGHT 20
|
90 | prog_char screenpos[4] = { 0x80, 0xC0, 0x94, 0xD4 }; |
91 | #endif
|
92 | |
93 | |
94 | // Lcd DDRAM register for 4x16 display
|
95 | #if LCD_TYP == 4
|
96 | #define MAXLINELENGHT 16
|
97 | prog_char screenpos[4] = { 0x80, 0xC0, 0x90, 0xD0 }; |
98 | #endif
|
99 | |
100 | |
101 | |
102 | //:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
|
103 | |
104 | extern void lcd_init( void ) |
105 | |
106 | //:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
|
107 | {
|
108 | register unsigned char i = 1; |
109 | |
110 | LCD_DDR_PORT = 0xFF; // Set data port to ouput |
111 | RW_DDR |= (1<<RW); // Set r/w port to output |
112 | RS_DDR |= (1<<RS); // Set cmd or data port to output |
113 | ENA_DDR |= (1<<ENA); // Set enable port to output |
114 | |
115 | // Only if 4x40 lcd with second enable pin
|
116 | // is selected
|
117 | #if LCD_TYP == 0
|
118 | ENA2_DDR |= (1<<ENA2); // Set enable 2 port to output |
119 | #endif
|
120 | |
121 | // 8 bit mode part
|
122 | #if LCD_MODE == 8
|
123 | _delay_ms(15); |
124 | |
125 | #if LCD_TYP == 0
|
126 | // Init two controller
|
127 | for (i=1; i<=2; i++) |
128 | {
|
129 | #endif
|
130 | lcd_sendcom(LCD_INIT, i); // Diverse init managment |
131 | _delay_ms(5); |
132 | lcd_sendcom(LCD_INIT, i); |
133 | _delay_us(150); |
134 | lcd_sendcom(LCD_INIT, i); |
135 | lcd_sendcom(LCD_8_2LINE, i); |
136 | lcd_sendcom(LCD_ON, i); |
137 | lcd_sendcom(LCD_CLEAR, i); |
138 | lcd_sendcom(LCD_ENTRY_6, i); |
139 | #if LCD_TYP == 0
|
140 | actcntr = 2; |
141 | }
|
142 | actcntr = 1; |
143 | #endif
|
144 | #endif
|
145 | |
146 | // 4 bit mode part
|
147 | #if LCD_MODE == 4
|
148 | _delay_ms(15); // Diverse init managment |
149 | |
150 | #if LCD_TYP == 0
|
151 | // Init two controller
|
152 | for (i=1; i<=2; i++) |
153 | {
|
154 | #endif
|
155 | LCD_DATA_PORT = (LCD_DATA_PORT & 0x0F) | LCD_INIT; |
156 | lcd_trig_enable(); |
157 | _delay_ms(5); |
158 | LCD_DATA_PORT = (LCD_DATA_PORT & 0x0F) | LCD_INIT; |
159 | lcd_trig_enable(); |
160 | _delay_us(150); |
161 | LCD_DATA_PORT = (LCD_DATA_PORT & 0x0F) | LCD_INIT; |
162 | lcd_trig_enable(); |
163 | LCD_DATA_PORT = (LCD_DATA_PORT & 0x0F) | LCD_4_1LINE; |
164 | lcd_trig_enable(); |
165 | lcd_sendcom(LCD_4_2LINE, i); |
166 | lcd_sendcom(LCD_ON, i); |
167 | lcd_sendcom(LCD_CLEAR, i); |
168 | lcd_sendcom(LCD_ENTRY_6, i); |
169 | #if LCD_TYP == 0
|
170 | actcntr = 2; |
171 | }
|
172 | actcntr = 1; |
173 | #endif
|
174 | #endif
|
175 | }
|
176 | |
177 | |
178 | //:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
|
179 | |
180 | static void lcd_waitbusy( void ) |
181 | |
182 | //:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
|
183 | {
|
184 | LCD_DDR_PORT &= ~(1<<BUSY); |
185 | RS_LOW(); |
186 | RW_HIGH(); |
187 | #if LCD_TYP == 0
|
188 | actcntr == 1 ? ENA_HIGH() : ENA2_HIGH(); |
189 | #else
|
190 | ENA_HIGH(); |
191 | #endif
|
192 | _delay_us(1); |
193 | loop_until_bit_is_clear(BUSY_PIN_PORT,BUSY); // Wait until lcd is ready |
194 | #if LCD_TYP == 0
|
195 | actcntr == 1 ? ENA_LOW() : ENA2_LOW(); |
196 | #else
|
197 | ENA_LOW(); |
198 | #endif
|
199 | LCD_DDR_PORT |= (1<<BUSY); |
200 | }
|
201 | |
202 | |
203 | //:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
|
204 | |
205 | static void lcd_trig_enable( void ) |
206 | |
207 | //:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
|
208 | {
|
209 | // Only if 4x40 lcd is selected
|
210 | #if LCD_TYP == 0
|
211 | // Lcd controller 1
|
212 | if (actcntr == 1) |
213 | {
|
214 | ENA_HIGH(); |
215 | _delay_us(1); |
216 | ENA_LOW(); |
217 | }
|
218 | |
219 | // Lcd controller 2
|
220 | if (actcntr == 2) |
221 | {
|
222 | ENA2_HIGH(); |
223 | _delay_us(1); |
224 | ENA2_LOW(); |
225 | }
|
226 | #else
|
227 | ENA_HIGH(); |
228 | _delay_us(1); |
229 | ENA_LOW(); |
230 | #endif
|
231 | }
|
232 | |
233 | |
234 | |
235 | //:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
|
236 | |
237 | extern void lcd_sendcom( unsigned char command, unsigned char cntr ) |
238 | |
239 | //:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
|
240 | {
|
241 | lcd_waitbusy(); |
242 | RS_LOW(); |
243 | RW_LOW(); |
244 | |
245 | #if LCD_TYP == 0
|
246 | actcntr = cntr; |
247 | #endif
|
248 | |
249 | // 8 bit mode part
|
250 | #if LCD_MODE == 8
|
251 | LCD_DATA_PORT = command; |
252 | #endif
|
253 | |
254 | // 4 bit mode part
|
255 | #if LCD_MODE == 4
|
256 | // Send high byte
|
257 | LCD_DATA_PORT = (command & 0xF0) | (LCD_DATA_PORT & 0x0F); |
258 | lcd_trig_enable(); |
259 | BUSY_PORT &= ~(1<<BUSY); |
260 | // Send low byte
|
261 | LCD_DATA_PORT = ((command << 4) & 0xF0) | (LCD_DATA_PORT & 0x0F); |
262 | #endif
|
263 | lcd_trig_enable(); |
264 | LCD_DATA_PORT &= ~(1<<BUSY); |
265 | }
|
266 | |
267 | |
268 | |
269 | //:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
|
270 | |
271 | extern void lcd_setcur( unsigned char ypos, unsigned char xpos ) |
272 | |
273 | //:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
|
274 | {
|
275 | #if LCD_TYP == 0
|
276 | register unsigned char tmp; |
277 | |
278 | switch (ypos) |
279 | {
|
280 | case 3: |
281 | tmp = 2; |
282 | ypos = 1; |
283 | break; |
284 | |
285 | case 4: |
286 | tmp = 2; |
287 | ypos = 2; |
288 | break; |
289 | default:
|
290 | tmp = 1; |
291 | }
|
292 | |
293 | lcd_sendcom(pgm_read_byte(&screenpos[ypos-1]) + (xpos-1), tmp); |
294 | #else
|
295 | lcd_sendcom(pgm_read_byte(&screenpos[ypos-1]) + (xpos-1), 1); |
296 | #endif
|
297 | |
298 | |
299 | }
|
300 | |
301 | |
302 | |
303 | //:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
|
304 | |
305 | extern void lcd_putchar( unsigned char data ) |
306 | |
307 | //:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
|
308 | {
|
309 | lcd_waitbusy(); |
310 | RS_HIGH(); |
311 | RW_LOW(); |
312 | |
313 | // 8 bit mode part
|
314 | #if LCD_MODE == 8
|
315 | LCD_DATA_PORT = data; |
316 | #endif
|
317 | |
318 | // 4 bit mode part
|
319 | #if LCD_MODE == 4
|
320 | // send high byte
|
321 | LCD_DATA_PORT = (data & 0xF0) | (LCD_DATA_PORT & 0x0F); |
322 | lcd_trig_enable(); |
323 | // send low byte
|
324 | LCD_DATA_PORT = ((data << 4) & 0xF0) | (LCD_DATA_PORT & 0x0F); |
325 | #endif
|
326 | lcd_trig_enable(); |
327 | LCD_DATA_PORT &= ~(1<<BUSY); |
328 | }
|
329 | |
330 | |
331 | |
332 | //:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
|
333 | |
334 | extern void lcd_putstr( unsigned char *data ) |
335 | |
336 | //:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
|
337 | {
|
338 | register unsigned char c,i; |
339 | |
340 | i = MAXLINELENGHT; |
341 | |
342 | while ( (c = *data++) && i-- ) |
343 | lcd_putchar(c); |
344 | }
|
345 | |
346 | |
347 | |
348 | //:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
|
349 | |
350 | extern void lcd_putstr_xy( unsigned char *data, unsigned char ypos, unsigned char xpos ) |
351 | |
352 | //:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
|
353 | {
|
354 | lcd_setcur( ypos, xpos ); |
355 | lcd_putstr( data ); |
356 | }
|
357 | |
358 | |
359 | //:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
|
360 | |
361 | extern void lcd_putstr_pgm( const char *data ) |
362 | |
363 | //:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
|
364 | {
|
365 | register unsigned char c,i; |
366 | |
367 | i = MAXLINELENGHT; |
368 | |
369 | while ( (c = pgm_read_byte(data++)) && i--) |
370 | lcd_putchar(c); |
371 | }
|
372 | |
373 | |
374 | |
375 | //:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
|
376 | |
377 | extern void lcd_clearline( unsigned char line ) |
378 | |
379 | //:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
|
380 | {
|
381 | register unsigned char i; |
382 | |
383 | lcd_setcur(line, 1); |
384 | |
385 | for (i=1; i <= MAXLINELENGHT; i++) |
386 | lcd_putchar(0x20); |
387 | |
388 | lcd_setcur(line, 1); |
389 | }
|
390 | |
391 | int main(void) |
392 | {
|
393 | // RS232 aktivieren
|
394 | UCSRB |= (1 << TXEN) | ( 1 << RXEN ) | ( 1 << RXCIE ) ; // UART TX, RX einschalten |
395 | UCSRC |= ( 1 << UMSEL ) | ( 1<<UCSZ1 ) | ( 1<<UCSZ0 ) ; // Asynchron 8N1, Parity none |
396 | UBRRH = (uint8_t) (UBRR_BAUD>>8); // USART Baud |
397 | UBRRL = (uint8_t) UBRR_BAUD; |
398 | |
399 | sei(); |
400 | |
401 | char Titel = 'H'; |
402 | //lcd_waitbusy();
|
403 | |
404 | while (!(UCSRA & (1<<UDRE))); |
405 | UDR = 0x00; // TEST das er startet |
406 | |
407 | lcd_init(); |
408 | lcd_putchar(Titel); |
409 | |
410 | while (!(UCSRA & (1<<UDRE))); |
411 | UDR = 0x01; // TEST danach |
412 | _delay_ms(1000); |
413 | |
414 | return 0; |
415 | }
|
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!HEADER!!!!!!!!!!!!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! .h
1 | #ifndef LCDDRIVER_H
|
2 | #define LCDDRIVER_H
|
3 | |
4 | |
5 | /**************************************************************************
|
6 | *
|
7 | * DEFINES
|
8 | *
|
9 | ***************************************************************************/
|
10 | |
11 | /*! \brief Select display typ here
|
12 | * \param LCD_TYP 0 = 4x40
|
13 | * \param LCD_TYP 1 = 2x40, 1x40
|
14 | * \param LCD_TYP 2 = 2x24, 1x24
|
15 | * \param LCD_TYP 3 = 4x20, 2x20, 1x20
|
16 | * \param LCD_TYP 4 = 4x16, 2x16, 1x16 */
|
17 | #define LCD_TYP 4
|
18 | |
19 | |
20 | /*! \brief Select lcd controll mode here
|
21 | * \param LCD_MODE 8 = 8 Bit Mode
|
22 | * \param LCD_MODE 4 = 4 Bit Mode */
|
23 | #define LCD_MODE 8
|
24 | |
25 | |
26 | #define LCD_INIT 0x30 /*!< Lcd init sequenz */ |
27 | #define LCD_ON 0x0C /*!< Switch on lcd without cursor */ |
28 | #define LCD_ON_C 0x0E /*!< Switch on lcd with cursor */ |
29 | #define LCD_ON_CB 0x0F /*!< Switch on lcd with blinking cursor */ |
30 | #define LCD_OFF 0x08 /*!< Switch off lcd */ |
31 | #define LCD_CLEAR 0x01 /*!< Clear complete lcd */ |
32 | #define LCD_ENTRY_4 0x04 /*!< Display shift = OFF and decrement adress */ |
33 | #define LCD_ENTRY_5 0x05 /*!< Display shift = ON and decrement adress */ |
34 | #define LCD_ENTRY_6 0x06 /*!< Display shift = OFF and increment adress */ |
35 | #define LCD_ENTRY_7 0x07 /*!< Display shift = ON and increment adress */ |
36 | #define LCD_SHIFT_CURS_LEFT 0x10 /*!< Shift cursor left */ |
37 | #define LCD_SHIFT_CURS_RIGHT 0x14 /*!< Shift cursor right */ |
38 | #define LCD_SHIFT_DISP_LEFT 0x18 /*!< Shift lcd left */ |
39 | #define LCD_SHIFT_DISP_RIGHT 0x1C /*!< Shift lcd right */ |
40 | |
41 | //! config lines and matrix for 8 bit mode
|
42 | #define LCD_8_1LINE 0x30
|
43 | #define LCD_8_2LINE 0x38
|
44 | |
45 | //! config lines and matrix for 4 bit mode
|
46 | #define LCD_4_1LINE 0x20
|
47 | #define LCD_4_2LINE 0x28
|
48 | |
49 | |
50 | #define LCD_DDR_PORT DDRA /*!< Lcd data DDR */ |
51 | #define LCD_DATA_PORT PORTA /*!< Lcd data PORT */ |
52 | #define LCD_DATA_PIN PINA /*!< Lcd data PORTIN */ |
53 | |
54 | #define RS_DDR DDRC /*!< Data or command DDR */ |
55 | #define RS_PORT PORTC /*!< Data or command PORT */ |
56 | #define RS PORTC4 /*!< Data or command BIT */ |
57 | |
58 | #define ENA_DDR DDRC /*!< Enable DDR */ |
59 | #define ENA_PORT PORTC /*!< Enable PORT */ |
60 | #define ENA PORTC5 /*!< Enable BIT */ |
61 | |
62 | #define RW_DDR DDRC /*!< Read / write DDR */ |
63 | #define RW_PORT PORTC /*!< Read / write PORT */ |
64 | #define RW PORTC6 /*!< Read / write BIT */ |
65 | |
66 | #define BUSY_PORT PORTC /*!< Busy PORT */ |
67 | #define BUSY_PIN_PORT PINC /*!< Busy PORTIN */ |
68 | #define BUSY PORTC3 /*!< Busy BIT */ |
69 | #define ENA2_DDR DDRC /*!< Enable 2 DDR */ |
70 | #define ENA2_PORT PORTC /*!< Enable 2 PORT */ |
71 | #define ENA2 PORTC3 /*!< Enable 2 BIT */ |
72 | |
73 | |
74 | #define RS_HIGH() (RS_PORT|=(1<<RS))
|
75 | #define RS_LOW() (RS_PORT&=~(1<<RS))
|
76 | |
77 | #define RW_HIGH() (RW_PORT|=(1<<RW))
|
78 | #define RW_LOW() (RW_PORT&=~(1<<RW))
|
79 | |
80 | #define ENA_HIGH() (ENA_PORT|=(1<<ENA))
|
81 | #define ENA_LOW() (ENA_PORT&=~(1<<ENA))
|
82 | |
83 | #define ENA2_HIGH() (ENA2_PORT|=(1<<ENA2))
|
84 | #define ENA2_LOW() (ENA2_PORT&=~(1<<ENA2))
|
85 | |
86 | |
87 | |
88 | /**************************************************************************
|
89 | *
|
90 | * GLOBAL PROTOTYPES
|
91 | *
|
92 | ***************************************************************************/
|
93 | |
94 | //:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
|
95 | /*!\fn extern void lcd_init( void );
|
96 | * \brief Init lcd display */
|
97 | extern void lcd_init( void ); |
98 | |
99 | |
100 | |
101 | //:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
|
102 | /*!\fn extern void lcd_setcur( unsigned char ypos, unsigned char xpos );
|
103 | * \brief Set cursor to special position
|
104 | * \param ypos = ypos on lcd
|
105 | * \param xpos = xpos on lcd */
|
106 | extern void lcd_setcur( unsigned char ypos, unsigned char xpos ); |
107 | |
108 | |
109 | |
110 | //:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
|
111 | /*!\fn extern void lcd_sendcom( unsigned char command, unsigned char cntr );
|
112 | * \brief Send command to display
|
113 | * \param command = Lcd command
|
114 | * \param cntr = Lcd controller 1 or 2 second controller only at 4x40 lcd available */
|
115 | extern void lcd_sendcom( unsigned char command, unsigned char cntr ); |
116 | |
117 | |
118 | |
119 | //:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
|
120 | /*!\fn extern void lcd_putchar( unsigned char data );
|
121 | * \brief Send single character to display
|
122 | * \param data = Singel byte character */
|
123 | extern void lcd_putchar( unsigned char data ); |
124 | |
125 | |
126 | |
127 | //:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
|
128 | /*!\fn extern void lcd_putstr( unsigned char *data );
|
129 | * \brief Sends a string out of SRAM to display
|
130 | * \param *data = Pointer to string into SRAM */
|
131 | extern void lcd_putstr( unsigned char *data ); |
132 | |
133 | |
134 | |
135 | //:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
|
136 | /*!\fn extern void lcdputstr_xy( unsigned char *data, unsigned char ypos, unsigned char xpos );
|
137 | * \brief Sends a string out of SRAM to display with the additinal feature to set the xy pos on lcd.
|
138 | * \param *data = Pointer to string into SRAM */
|
139 | extern void lcd_putstr_xy( unsigned char *data, unsigned char ypos, unsigned char xpos ); |
140 | |
141 | |
142 | |
143 | //:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
|
144 | /*!\fn extern void lcd_putstr_pgm( const char *data );
|
145 | * \brief Send string out of flash memory to display
|
146 | * \param *data = Const pointer into flash memory */
|
147 | extern void lcd_putstr_pgm( const char *data ); |
148 | |
149 | |
150 | |
151 | //:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
|
152 | /*!\fn extern void lcd_clearline( unsigned char line );
|
153 | * \brief Clear a complete line from display
|
154 | * \param line = Line number to clear */
|
155 | extern void lcd_clearline( unsigned char line ); |
156 | |
157 | #endif // LCDDRIVER_H
|
also PC3 wollte ich nur als Platzhalter nehmen, und der PIN ist nicht angeschlossen. Dachte die Leitung sind nur bei bestimmten LCDs vorhanden... UND NOCH EINE ÄNDERUNG! RS -> PC4 RW -> PC6 E -> PC5 D0-D7 -> PA0-PA7
Der Code möchte unbedingt einen Busy Check. Ändere das hier #define BUSY_PORT PORTC /*!< Busy PORT */ #define BUSY_PIN_PORT PINC /*!< Busy PORTIN */ #define BUSY PORTC3 /*!< Busy BIT */ mal so: #define BUSY_PORT PORTA /*!< Busy PORT */ #define BUSY_PIN_PORT PINA /*!< Busy PORTIN */ #define BUSY PORTA7 /*!< Busy BIT */
vielen Dank für die Hilfe!!! das war das Problem! so schnell wär ich daraus nicht gekommen... :-)
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
Mit Google-Account einloggen
Noch kein Account? Hier anmelden.