Hi, auch nach langem suchen hab ich nichts gefunden, das mir bei meinem
problem hilft, daher ein weiterer post.
Ich habe die Display implementierung in ein modul gepackt:
Code:
/*
240 x 180 LCD "lcd.c"
*/
#include <avr/io.h>
#include <util/delay.h>
#include "lcd.h"
// P R O T O T Y P E N
void lcd_init(void);
void lcd_putc(char sign);
void lcd_data(void);
void lcd_commando(void);
void lcd_reset(void);
void lcd_status(void);
void lcd_clear_ram(void);
void lcd_clear(void);
// G L O B A L E V A R I A B L E N
uint8_t LCD_DATA;
uint8_t LCD_CMD;
uint8_t LCD_STATUS;
void lcd_init(void)
{
//LCD Reset
lcd_reset();
// Adress Pointer setzen (0x0000)
LCD_DATA = 0x23;
lcd_data();
LCD_DATA = 0x01;
lcd_data();
LCD_CMD = 0x24;
lcd_commando();
//TEXT HOME ADDRESS
LCD_DATA = 0x00;
lcd_data();
LCD_DATA = 0x00;
lcd_data();
LCD_CMD = 0x40;
lcd_commando();
// GRAPHIC HOME ADDRESS
LCD_DATA = 0x02;
lcd_data();
LCD_DATA = 0x00;
lcd_data();
LCD_CMD = 0x42;
lcd_commando();
//TEXT AREA
LCD_DATA = 0x14;
lcd_data();
LCD_DATA = 0x00;
lcd_data();
LCD_CMD = 0x41;
lcd_commando();
//GRAPHIC AREA
LCD_DATA = 0x14;
lcd_data();
LCD_DATA = 0x00;
lcd_data();
LCD_CMD = 0x43;
lcd_commando();
// Offset Pointer setzen
LCD_DATA = 0x02;
lcd_data();
LCD_DATA = 0x00;
lcd_data();
LCD_CMD = 0x22;
lcd_commando();
//DISPLAY MODE
//0x97 is the appropriate commando (text, cursor blink)
LCD_CMD = 0x9C;
lcd_commando();
//MODE SET
LCD_CMD = 0x80;
lcd_commando();
//CURSOR_DEFINIEREN
//2 line cursor:
LCD_CMD = 0xA2;
lcd_commando();
//CURSOR POINTER SETZEN
LCD_DATA = 0x00;
lcd_data();
LCD_DATA = 0x00;
lcd_data();
LCD_CMD = 0x21;
lcd_commando();
}
void lcd_reset(void)
{
ENABLE_RESET;
_delay_us(10);
// pull RST up
DISABLE_RESET;
}
void lcd_commando(void)
{
//wait until proper status is available
do
{
lcd_status();
}
while (LCD_STATUS != MASK_1);
//set config for commando
WRITE_PORTA;
WRITE_PORTB;
ENABLE_COMMANDO;
ENABLE_WRITE;
DISABLE_READ;
// make COMANDO available on DATAPORT
PORTA = LCD_CMD;
CHIP_ENABLE;
_delay_us(DELAY_DATA_COMMAND);
CHIP_DISABLE;
}
void lcd_data(void)
{
//wait until proper status is available
do
{
lcd_status();
}
while (LCD_STATUS != MASK_1);
//set config for data
WRITE_PORTA;
WRITE_PORTB;
ENABLE_DATA;
ENABLE_WRITE;
DISABLE_READ;
// make DATA available on DATAPORT
PORTA = LCD_DATA;
CHIP_ENABLE;
_delay_us(DELAY_DATA_COMMAND);
CHIP_DISABLE;
}
void lcd_status(void)
{
//make porta input to read
READ_PORTA;
WRITE_PORTB;
// prepare controllines according to POWERTIP Datasheet
ENABLE_READ;
DISABLE_WRITE;
//chip enable
CHIP_ENABLE;
//portb sends commando
ENABLE_COMMANDO;
_delay_us(1);
//save status from port to var
LCD_STATUS = PINA;
CHIP_DISABLE;
DISABLE_READ;
LCD_STATUS &= (0x03);
}
void lcd_putc(char sign)
{
LCD_DATA = sign - 0x20;
lcd_data();
LCD_CMD = 0xC0;
lcd_commando();
}
nur leider bekomme ich auf dem Display nichts außer
hyroglyphen, regelmäßige streifen oder einfach garnichts zu sehen.
Das Display ist ein Powertip 240 x 128 Pixel Display.
Kann mir da jemand helfen ? Was mach ich falsch ?
Lesezeichen