Hallo,
verwende den Beispielcode aus folgendem Link:
http://basteln-mit-avr.de/Download/atmega644_DOGS102.zip
Folgende Parameter habe ich schon angepaßt:
- Makefile
1 | LCD = 0
|
2 |
|
3 | # MCU name
|
4 | MCU = atmega32
|
5 |
|
6 |
|
7 | # Processor frequency.
|
8 | # This will define a symbol, F_CPU, in all source code files equal to the
|
9 | # processor frequency. You can then use this symbol in your source code to
|
10 | # calculate timings. Do NOT tack on a 'UL' at the end, this will be done
|
11 | # automatically to create a 32-bit value in your source code.
|
12 | # Typical values are:
|
13 | # F_CPU = 1000000
|
14 | # F_CPU = 1843200
|
15 | # F_CPU = 2000000
|
16 | # F_CPU = 3686400
|
17 | # F_CPU = 2000000
|
18 | # F_CPU = 7372800
|
19 | F_CPU = 8000000
|
- spi.c
1 | #include "tools.h"
|
2 |
|
3 |
|
4 | //*----------------------------------------------------------------------------
|
5 | // SPI-Bus initialisieren
|
6 | //*----------------------------------------------------------------------------
|
7 | #define LCD_A0 0 // PB0 (PIN1) = Display A0 -> PIN 38
|
8 | #define LCD_RST 3 // PB1 (PIN2) = Display Reset -> PIN 39
|
9 | #define LCD_CS 1 // PB4 (PIN5) = Select -> PIN 40
|
10 | #define SPI_MOSI 5 // PB5 (PIN6) = SPI MOSI -> PIN 36
|
11 | #define SPI_MISO 6 // PB6 (PIN7) = SPI MISO ->
|
12 | #define SPI_SCK 7 // PB7 (PIN8) = SPI SCK -> PIN 37
|
13 |
|
14 | void SPI_PORT_Init(void)
|
15 | {
|
16 | // === PORT-B CONFIG ===
|
17 |
|
18 | DDRB = (1 << LCD_RST) | (1 << LCD_A0) | (1 << SPI_MOSI) | (1 << SPI_SCK) | (1 << LCD_CS);
|
19 |
|
20 |
|
21 | PORTB &=~(1<<SPI_MISO);
|
22 |
|
23 | PORTB = (1<<SPI_MISO);
|
- dogm-graphic.h
1 | //*----------------------------------------------------------------------------
|
2 | // PORT - DEFINITIONEN
|
3 | //*----------------------------------------------------------------------------
|
4 | // == PORT C ==
|
5 | #define LCD_A0 0 // PC1 (Pin 16) = Display A0 -> PIN 38
|
6 | #define LCD_RST 3 // PC2 (Pin 17) = Display Reset -> PIN 39
|
7 | #define LCD_CS 1 // PC4 (Pin 19) = Display Chip-Select -> PIN 40
|
8 | #define SPI_MOSI 5 // PC5 (Pin 20) = SPI MOSI -> PIN 36
|
9 | #define SPI_MISO 6 // PC6 (Pin 21) = SPI MISO -> leer
|
10 | #define SPI_SCK 7 // PC7 (Pin 22) = SPI SCK -> PIN 37
|
11 |
|
12 |
|
13 |
|
14 | //*----------------------------------------------------------------------------
|
15 | #define MEM_FLASH 0
|
16 | #define MEM_RAM 1
|
17 | #define MEM_EEPROM 2
|
18 | //*----------------------------------------------------------------------------
|
19 |
|
20 |
|
21 |
|
22 |
|
23 |
|
24 | /*****************************************************************************
|
25 | * BEGIN CONFIG BLOCK
|
26 | *****************************************************************************/
|
27 | //Select the display type: DOGS102: 102, DOGM128/DOGL128: 128, DOGM132: 132
|
28 | #define DISPLAY_TYPE 102
|
29 |
|
30 | //Should chip select (CS) be used?
|
31 | #define LCD_USE_CHIPSELECT 1
|
32 | //Use Backlight? (0: no backlight, 1: backlight (on when pin is high), 2: backlight (on when pin is low))
|
33 | #define LCD_USE_BACKLIGHT 0
|
34 |
|
35 | #define PORT_A0 PORTB
|
36 | #define DDR_A0 DDRB
|
37 | #define PIN_A0 0
|
38 |
|
39 | //Reset Port
|
40 | #define PORT_RST PORTB
|
41 | #define DDR_RST DDRB
|
42 | #define PIN_RST 3
|
43 |
|
44 | //Backlight Port
|
45 | #if LCD_USE_BACKLIGHT != 0
|
46 | #define PORT_LED PORB
|
47 | #define DDR_LED DDRB
|
48 | #define PIN_LED 0
|
49 | #endif
|
50 |
|
51 | //Chip select
|
52 | #if LCD_USE_CHIPSELECT == 1
|
53 | #define PORT_CS PORTB
|
54 | #define DDR_CS DDRB
|
55 | #define PIN_CS 1
|
56 | #endif
|
Das DOGS102 ist wie folgt an dem Atmega angeschlossen:
Display: Atmega32
SDA/SI ----->PB5 MOSI
SCK/SCL ---->PB7 SCK
CD/A0 ---->PB0
CSO/CS ----->PB1
Reset/RST -->PB3
Was könnte die Ursache sein, dass auf dem Display nichts angezeigt wird?
Gru0
Rik