HI-TECH PICC için Grafik LCD (T6963) Kütüphanesi Buyrun

Başlatan muuzoo, 05 Şubat 2008, 00:18:56

muuzoo

Kendi çalışmamda kullanmak üzere glcd kütüphanesi ararken farklı bir c derleyicisi için yazılmış olan bu kütüphaneyi buldum. T6963 denetleyicili grafik lcd ekranlar için yazılmıştır. Kütüphaneyi HI-TECH e uyarlamak için bir miktar değişiklik yaptım. Ekrana metin yazmak için fonsiyon ekledim (orjinal kod HI-TECH'te sıkıntı veriyordu) bir iki ufak düzenleme daha yaparak ,ISIS üzerinde denedim. Fiziksel olarak deneme fırsatım olmadı ama yakın zamanda olacak.

Deneme yapan arkadaşlar eğer LCD ilk açılışta sıkınıt veriyorsa "t6963.c" dosyasındaki gecikme miktarını (250 ms de. bazı kaynaklarda 1sn'lik gecikmeler gördüm) arttırarak aşabilirler. Kodun yazımında ve örnek kodun denenmesinde "Pic Programlama Teknikleri ve PIC 16f877" kitabından faydalanılmıştır.

Kütüphane dosyasını,örnek c kodunu,ISIS benzeşim dosyasını rapide yükledim. Aşağıda çalışan kodun ekran görüntüsünü verdim. Şimdiden kolay gelsin.

http://rapidshare.com/files/252567509/t6963.rar


Orjinal kodun bulunduğu site:
http://www.sourceboost.com/Products/C2C-plus/ExampleCode.html

#include <htc.h>
#include <delay.c>
#include <t6963.c>
#include <t6963.h>

void
main(void)
{
	unsigned char x,y;
	glcd_init();
	lcd_clear_graphics();
	lcd_clear_text();
	lcd_write_command(LCD_DISPLAY_MODES_GRAPHICS_ON	| LCD_DISPLAY_MODES_TEXT_ON);
	
	lcd_write_text("   T6963 LCD  ",0,1);
	lcd_write_text("  PICPROJE.ORG  ",0,3);
	lcd_write_text("     MuuZoo ",0,5);
	lcd_write_text("  -----------",0,6);
	
	lcd_write_data(LCD_GRAPHICS_HOME);
	lcd_write_data(LCD_GRAPHICS_HOME >> 8);
	lcd_write_command(LCD_ADDRESS_POINTER_SET);
	//iç içe iki kare çiziyor.
	y=0;
	for(x=0;x<128;x++)	lcd_set_pixel(x,y);
	y=63;
	for(x=0;x<128;x++)	lcd_set_pixel(x,y);
	x=0;
	for(y=0;y<64;y++)	lcd_set_pixel(x,y);
	x=127;
	for(y=0;y<128;y++)	lcd_set_pixel(x,y);
	y=2;
	for(x=2;x<126;x++)	lcd_set_pixel(x,y);
	y=61;
	for(x=2;x<126;x++)	lcd_set_pixel(x,y);
	x=2;
	for(y=2;y<62;y++)	lcd_set_pixel(x,y);
	x=125;
	for(y=2;y<62;y++)	lcd_set_pixel(x,y);
	while (1){
		//TODO Auto-generated main function
	}
}


gunluk.muuzoo.gen.tr - Kişisel karalamalarım...

f_machine


ORC

Güzel paylaşım tesekkürler..Linki yenileyebilirmisiniz acaba ölmüşte :)

M_B

İmkanın sınırlarını görmek için imkansızı denemek lazım.                                                             Fatih Sultan Mehmet

ORC


muuzoo

Kütüphaneyi buradan indirebilirsiniz. Benim için de bulması zor oldu. Anlaşılan daha düzgün bir arşivleme yapmalıyım :) . Bu kütüphaneyi daha da geliştirmiştim. Doğrudan resim basabilecek hale getirmiştim ama o sürümünü bulamadım.

http://rapidshare.com/files/252560226/t6963.rar
gunluk.muuzoo.gen.tr - Kişisel karalamalarım...

muuzoo

Sizin mesajınıznı gördüğümden beri bana çok yardımcı olan bir kaynağı arıyordum ancak bulabildim. Aşağıda vereceğim sayfadaki projeyi incelerseniz fazlasıyla yardımcı olacaktır.

http://sjeffroy.free.fr/new/index.php?option=com_content&task=view&id=17&Itemid=48
gunluk.muuzoo.gen.tr - Kişisel karalamalarım...

Analyzer

Selam,

Karaköy piyasasında da bolca satılan T6963C uyumlu olduğu söylenen (halbuki içerisinde SAP1024B var, pinout ve kontrol biraz farklı) 240x128 LCD ler için PIC+HITECH+Proteus dosyası :

http://rapidshare.com/files/252658609/ANS-0003.RAR

Analyzer
Üşeniyorum, öyleyse yarın!

Analyzer

Alıntı yapılan: "Analyzer"Selam,

Karaköy piyasasında da bolca satılan T6963C uyumlu olduğu söylenen (halbuki içerisinde SAP1024B var, pinout ve kontrol biraz farklı) 240x128 LCD ler için PIC+HITECH+Proteus dosyası :

http://rapidshare.com/files/252658609/ANS-0003.RAR

Analyzer

Selam,

Burada kendi yazdığım STM32 ve Keil kontrolü mevcut :
http://rapidshare.com/files/255124290/SAP1024B.rar
Tanımlardan hangi pin hangisine bağlı kolayca bulunabilir.

Analyzer
Üşeniyorum, öyleyse yarın!

krts

merhaba arkadaslar ;

benim grafik lcd ile ilgili bir sorum olacaktı elimde bulunan t6963 glcd'yi devresini kurdum cesitli düzenlemeler yaptım ama bir türlü calıstıramadım sitedende aldıgım örneklerden yaraelanarak bir seylerr yaptım proteusta calısan devre fiziksel olarak calısmıyor

krts

kodu biraz inceledim alt fonksiyonları cagırdktan sonra anaprograma geri dönmöüyor sitede bulunan koddan bahsediyorum sıkıntı bundan mı kaynaklanıyor yok sa baska bir sey mi anlıyamadım daha önceden bu lcd ile ile uygulama yapmıs arkadaslar yardımcı olursa sewinrim simdiden sagolun :)

mesmert

bunu 240X128 uygulamak istersek ne gibi değişiklik yapmak gerekir

/********************************************

 * Filename: t6963.c                        *

 *                                          *

 * Description: Toshiba LCD Driver Functions*

 *                                          *

 * by Richard Taylor                        *

 *                                          *

 * Date: 09/02/2003                         *

 *	Edited by Mehmet Muzaffer KOSTEN    *
  		                   
 *		for HI-TECH PIC C           * 
 			
 * 			Date: 04.02.2008    *
 *******************************************/

/* includes */

//#include <system.h>

#include "t6963.h"


/********************************************

 * Function name: initialise                *

 * Description:   Initialise PIC and LCD    *

 *******************************************/

void glcd_init(void)
{
    unsigned int i;
    /* Set Control Lines to outputs and High */

    LCD_CONTROL = LCD_CONTROL | LCD_WR | LCD_RD | LCD_CE | LCD_CD | LCD_RST | LCD_FS1;
    LCD_CONTROL_TRIS = LCD_CONTROL_TRIS & (~(LCD_WR | LCD_RD | LCD_CE | LCD_CD | LCD_RST | LCD_FS1));
    LCD_CONTROL = LCD_WR | LCD_RD | LCD_CE | LCD_CD | LCD_RST | LCD_FS1;

    /* Set PORTB to inputs */
    LCD_DATA_BUS_TRIS = 0xFF;

    /* Hold Reset Line for 1ms */
    LCD_RST_BIT=0;
    for(i=2;i>0;i--)
    {DelayMs(250);}
    LCD_RST_BIT=1;

    /* Set Char Gen Up */
    lcd_write_command(LCD_CG_ROM_MODE_OR);

    /* Set Graphic Home Address */
    lcd_write_data(LCD_GRAPHICS_HOME);
    lcd_write_data(LCD_GRAPHICS_HOME >> 8);
    lcd_write_command(LCD_GRAPHIC_HOME_ADDRESS_SET);

    /* Set Graphic Area */
    lcd_write_data(LCD_GRAPHICS_AREA); /* Width of 20 Chars */
    lcd_write_data(0x00);
    lcd_write_command(LCD_GRAPHIC_AREA_SET);

    /* Set Text Home Address */
    lcd_write_data(LCD_TEXT_HOME);
    lcd_write_data(LCD_TEXT_HOME >> 8);
    lcd_write_command(LCD_TEXT_HOME_ADDRESS_SET);

    /* Set Text Area */
    lcd_write_data(LCD_TEXT_AREA); /* Width of 20 Chars */
    lcd_write_data(0x0);
    lcd_write_command(LCD_TEXT_AREA_SET);
}

/********************************************

 * Function name: lcd_write_data            *

 * Description:   Write Data to LCD         *

 *******************************************/

void lcd_write_data(unsigned char data)
{
    /* While BUSY1 and BUSY2 are not 1 */
    while ( (lcd_read_status() & (LCD_STATUS_BUSY1 | LCD_STATUS_BUSY2)) != (LCD_STATUS_BUSY1 | LCD_STATUS_BUSY2));

    /* Clear C/D# */
    LCD_CD_BIT=0;

    /* Set Data Lines to Output */
    LCD_DATA_BUS = data;
    LCD_DATA_BUS_TRIS = ALL_OUTPUTS;

    /* Clear CE and WR, set RD */
    LCD_CE_BIT=0;
    LCD_WR_BIT=0;

    #asm 
    nop;
    nop;
    #endasm

    /* Set CE and RD*/
    LCD_CE_BIT=1;
    LCD_WR_BIT=1;
    LCD_CD_BIT=1;

    /* Set Data Lines to Input */
    LCD_DATA_BUS_TRIS = 0xFF;
}

/********************************************

 * Function name: lcd_read_data             *

 * Description:   Read Data From LCD        *

 *******************************************/

unsigned char lcd_read_data(void)
{
    unsigned char data;

    /* While BUSY1 and BUSY2 are not 1 */
    while ( (lcd_read_status() & (LCD_STATUS_BUSY1 | LCD_STATUS_BUSY2)) != (LCD_STATUS_BUSY1 | LCD_STATUS_BUSY2));

    /* Clear C/D# */
    LCD_CD_BIT=0;
    
    /* Set Data Lines to Input */
    LCD_DATA_BUS_TRIS = 0xFF;

    /* Clear CE and RD, set WR */
    LCD_CE_BIT=0;
    LCD_RD_BIT=0;

    #asm 
    nop;
	#endasm
    /* Read Data Bus */
    data = LCD_DATA_BUS;

    /* Set CE and RD*/
    LCD_CE_BIT=1;
    LCD_RD_BIT=1;
    LCD_CD_BIT=1;

    return data;
}



/********************************************

 * Function name: lcd_write_command         *

 * Description:   Write Command to LCD      *

 *******************************************/
 
void lcd_write_command(unsigned char data)
{
    unsigned char status;
    /* While BUSY1 and BUSY2 are not 1 */
    while ( (lcd_read_status() & (LCD_STATUS_BUSY1 | LCD_STATUS_BUSY2)) != (LCD_STATUS_BUSY1 | LCD_STATUS_BUSY2));

    /* Set C/D# */
    LCD_CD_BIT=1;

    /* Set Data Lines to Output */
    LCD_DATA_BUS = data;
    LCD_DATA_BUS_TRIS = 0x00;

    /* Clear CE and WR, set RD */
    LCD_CE_BIT=0;
    LCD_WR_BIT=0;

    #asm
    nop;
    nop;
    #endasm

    /* Set CE and RD*/
    LCD_CE_BIT=1;
    LCD_WR_BIT=1;
    LCD_CD_BIT=1;

    /* Set Data Lines to Input */
    LCD_DATA_BUS_TRIS = 0xFF;
}

/********************************************

 * Function name: lcd_read_status           *

 * Description:   Read Status From LCD      *

 *******************************************/

unsigned char lcd_read_status(void)
{
    unsigned char data;

    /* Set C/D# */
    LCD_CD_BIT=1;

    /* Set Data Lines to Input */
    LCD_DATA_BUS_TRIS = 0xFF;

    /* Clear CE and RD */
    LCD_CE_BIT=0;
    LCD_RD_BIT=0;

    #asm 
    nop;
	#endasm
    /* Read Data Bus */
    data = LCD_DATA_BUS;

    /* Set All Bits */
    LCD_CE_BIT=1;
    LCD_RD_BIT=1;
    LCD_CD_BIT=1;

    return data;
}

/********************************************

 * Function name: lcd_clear_graphics        *

 * Description:   Wipe Graphics RAM         *

 *******************************************/

void lcd_clear_graphics(void)
{
    unsigned char address_l, address_h;
    unsigned int address, address_limit;

    /* Set Address Pointer */
    address = LCD_GRAPHICS_HOME;
    address_l = address & 0xff;
    address_h = address >> 8;
    lcd_write_data(address_l);
    lcd_write_data(address_h);
    lcd_write_command(LCD_ADDRESS_POINTER_SET);
    address_limit = (LCD_GRAPHICS_HOME + LCD_GRAPHICS_SIZE);

    while (address < address_limit)
    {
        lcd_write_data(0x00);
        lcd_write_command(LCD_DATA_WRITE_AUTO_INCREMENT);
        address = address + 1;
    }

    if (LCD_NUMBER_OF_SCREENS == 0x02)
    {
        /* Set Address Pointer */
        address = LCD_GRAPHICS_HOME + 0x8000;
        address_l = address & 0xff;
        address_h = address >> 8;
        lcd_write_data(address_l);
        lcd_write_data(address_h);
        lcd_write_command(LCD_ADDRESS_POINTER_SET);
        address_limit = (LCD_GRAPHICS_HOME + LCD_GRAPHICS_SIZE +0x8000);

        while (address < address_limit)
        {
            lcd_write_data(0x00);
            lcd_write_command(LCD_DATA_WRITE_AUTO_INCREMENT);
            address = address + 1;
        }

    }

}

/********************************************

 * Function name: lcd_clear_text            *

 * Description:   Wipe Text RAM             *

 *******************************************/

void lcd_clear_text(void)
{
    unsigned char address_l, address_h;
    unsigned int address, address_limit;
    
    /* Set Address Pointer */
    address = LCD_TEXT_HOME;
    address_l = address & 0xff;
    address_h = address >> 8;
    lcd_write_data(address_l);
    lcd_write_data(address_h);
    lcd_write_command(LCD_ADDRESS_POINTER_SET);

        address_limit =  (LCD_TEXT_HOME + LCD_TEXT_SIZE);
        
        while (address < address_limit)
    {
        lcd_write_data(0x00);
        lcd_write_command(LCD_DATA_WRITE_AUTO_INCREMENT);
        address = address + 1;
    }

    if (LCD_NUMBER_OF_SCREENS == 0x02)
    {
        /* Set Address Pointer */
        address = LCD_TEXT_HOME + 0x8000;
        address_l = address & 0xff;
        address_h = address >> 8;
        lcd_write_data(address_l);
        lcd_write_data(address_h);
        lcd_write_command(LCD_ADDRESS_POINTER_SET);

        address_limit =  (LCD_TEXT_HOME + LCD_TEXT_SIZE + 0x8000);

        while (address < address_limit)
        {
            lcd_write_data(0x00);
            lcd_write_command(LCD_DATA_WRITE_AUTO_INCREMENT);
            address = address + 1;
        }

    }

}

/********************************************

 * Function name: lcd_write_text            *

 * Description:   Write Character to X, Y   *

 *                0 <= X <= LCD Text Width  *

 *                0 <= Y <= LCD Text Height *

 *******************************************/

void lcd_write_char(unsigned char character, unsigned char x, unsigned char y)
{
    unsigned int address;

    address = (y * LCD_TEXT_AREA) + x + LCD_TEXT_HOME;

    if (y > 63 && LCD_NUMBER_OF_SCREENS == 2) /* If we are on the second screen and it exists */
    {
        address = address + 0x8000;
    }
    character = character - 0x20;   /* Adjust standard ASCII to T6963 ASCII */

    lcd_write_data(address & 0xff);
    lcd_write_data(address >> 0x08);
    lcd_write_command(LCD_ADDRESS_POINTER_SET);
    lcd_write_data(character);
    lcd_write_command(LCD_DATA_WRITE_AUTO_INCREMENT);
}

void lcd_write_text(unsigned const char * str,unsigned char x,unsigned char y)
{
	//char i=0;
	while(*str)
	{
		lcd_write_char(*str++,x++,y);
	}
}

/********************************************

 * Function name: lcd_set_pixel             *

 * Description:   Set a single Pixel on     *

 *                0 <= X <= LCD Width       *

 *                0 <= Y <= LCD Height      *

 *******************************************/

void lcd_set_pixel(unsigned char x, unsigned char y)
{
    unsigned char data;
    unsigned int address, shift;

    address = (y * LCD_GRAPHICS_AREA) + (x / 8) + LCD_GRAPHICS_HOME;

    if (y > 63 && LCD_NUMBER_OF_SCREENS == 2) /* If we are on the second screen and it exists */
    {
        y = y - 64;
        address = (y * LCD_GRAPHICS_AREA) + (x / 8) + LCD_GRAPHICS_HOME;
        address = address + 0x8000;
    }

    data = lcd_bit_to_byte(7 - (x % 8));
    lcd_write_data(address & 0xff);
    lcd_write_data(address >> 0x08);
    lcd_write_command(LCD_ADDRESS_POINTER_SET);
    
    /* Read existing display */

    lcd_write_command(LCD_DATA_READ_NO_INCREMENT);
    data = data | lcd_read_data();

    /* Write modified data */
    lcd_write_data(data);
    lcd_write_command(LCD_DATA_WRITE_AUTO_INCREMENT);
}

/********************************************

 * Function name: lcd_clear_pixel           *

 * Description:   Clear a single Pixel      *

 *                0 <= X <= LCD Width       *

 *                0 <= Y <= LCD Height      *

 *******************************************/

void lcd_clear_pixel(unsigned char x, unsigned char y)

{
    unsigned char data;
    unsigned int address;

    address = (y * LCD_GRAPHICS_AREA) + (x / 8) + LCD_GRAPHICS_HOME;

    if (y > 63 && LCD_NUMBER_OF_SCREENS == 2) /* If we are on the second screen and it exists */
    {
        y = y - 64;
        address = (y * LCD_GRAPHICS_AREA) + (x / 8) + LCD_GRAPHICS_HOME;
        address = address + 0x8000;
    }

    data = lcd_bit_to_byte(7 - (x % 8));

    lcd_write_data(address & 0xff);
    lcd_write_data(address >> 0x08);
    lcd_write_command(LCD_ADDRESS_POINTER_SET);

    /* Read existing display */
    lcd_write_command(LCD_DATA_READ_NO_INCREMENT);
    data = (~data) & lcd_read_data();

    /* Write modified data */
    lcd_write_data(data);
    lcd_write_command(LCD_DATA_WRITE_AUTO_INCREMENT);
}

unsigned char lcd_bit_to_byte (unsigned char bitter)
{
   if(bitter==0)return 1;
   else if(bitter==1)return 2;
   else if(bitter==2)return 4;
   else if(bitter==3)return 8;
   else if(bitter==4)return 16;
   else if(bitter==5)return 32;
   else if(bitter==6)return 64;
   else if(bitter==7)return 128;
   else return 0;
}


/********************************************
 * Filename: t6963.h                        *
 *                                          *
 * Description: Header file for t6963.c     *
 *     by Richard Taylor                    *
 *                                          *
 * Date: 06/02/2003                         *
 * 		                            *
 * Edited by Mehmet Muzaffer KOSTEN         *                   
 *		for HI-TECH PIC C           * 
 *                                          *	
 * 			Date: 04.02.2008    *
 *******************************************/
/* Pragmas */
//#pragma CLOCK_FREQ      4000000

/* LCD Parameters */
#define LCD_TEXT_WIDTH          0x14    /* Text Width = Graphics Width / Character Width */
#define LCD_TEXT_HEIGHT         0x08    /* Text Height = Graphics Height / Character Height */
#define LCD_GRAPHICS_WIDTH      0x80    /* Width of display (0xA0 = 160 pixels) */
#define LCD_GRAPHICS_HEIGHT     0x40    /* Height of display (0x80 = 128 pixels) */
#define LCD_NUMBER_OF_SCREENS   0x02    /* for > 68 pixels height, is probably split into 2 screens */
                                        /* into 2 screens */
#define LCD_CHARACTER_WIDTH     0x06    /* Is character 8x8 or 6x8 (0x08 / 0x06) */

/* Define the Memory Map */
#define LCD_GRAPHICS_HOME   0x0000  /* This will usually be at the start of RAM */
#define LCD_GRAPHICS_AREA   0x10    /* A graphic character is 8 bits wide (same as 8x8 char) */
#define LCD_GRAPHICS_SIZE   0x0800  /* Size of graphics RAM */
#define LCD_TEXT_HOME       0x0A00  /* Graphics Area + Text Attribute Size (same size as text size) */
#define LCD_TEXT_AREA       0x10    /* Text line is 20 chars wide */
#define LCD_TEXT_SIZE       0x0200  /* Size of text RAM */

/*  Memory Map for 160x128 pixel display */
/*  This display is made up of two screens */
/*  Both 160x64 pixels */

/*  Screen 1 */

/*  0x0000  ----------------------------- */
/*          | Graphic RAM Area          | */
/*          | 0x0000 to 0x07FF          | */
/*          | (256x64 pixels)           | */
/*  0x0800  ----------------------------- */
/*          | Text Attribute Area       | */
/*  0x0A00  ----------------------------- */
/*          | Text RAM Area             | */
/*          | 512 Bytes                 | */
/*          | (256x64 pixels)           | */
/*  0x0C00  ----------------------------- */

/*  Screen 2 (Automatically derived from Screen 1) */

/*  0x8000  ----------------------------- */
/*          | Graphic RAM Area          | */
/*          | 0x0000 to 0x07FF          | */
/*          | (256x64 pixels)           | */
/*  0x8800  ----------------------------- */
/*          | Text Attribute Area       | */
/*  0x8A00  ----------------------------- */
/*          | Text RAM Area             | */
/*          | 512 Bytes                 | */
/*          | (256x64 pixels)           | */
/*  0x8C00  ----------------------------- */

//efekt için

/* LCD Data Bus Pins */
#define LCD_DATA_BUS        PORTB
#define LCD_DATA_BUS_TRIS   TRISB

/* LCD Control Pins */
#define LCD_CONTROL         PORTD
#define LCD_CONTROL_TRIS    TRISD
#define LCD_FS1_BIT			RD2
#define LCD_WR_BIT          RD3
#define LCD_RD_BIT          RD4
#define LCD_CE_BIT          RD5
#define LCD_CD_BIT          RD6
#define LCD_RST_BIT         RD7


#define LCD_FS1				0x00
#define LCD_WR              0x08
#define LCD_RD              0x10
#define LCD_CE              0x20
#define LCD_CD              0x40
#define LCD_RST             0x80

/* Control Word Definitions */
#define LCD_CURSOR_POINTER_SET          0b00100001
#define LCD_OFFSET_REGISTER_SET         0b00100010
#define LCD_ADDRESS_POINTER_SET         0b00100100

#define LCD_TEXT_HOME_ADDRESS_SET       0b01000000
#define LCD_TEXT_AREA_SET               0b01000001
#define LCD_GRAPHIC_HOME_ADDRESS_SET    0b01000010
#define LCD_GRAPHIC_AREA_SET            0b01000011

#define LCD_TXT_NORMAL        			0x00
#define LCD_TXT_REVERSE       			0x05
#define LCD_TXT_OFF           			0x03
#define LCD_TXT_BLINK         			0x08
#define LCD_TXT_BLINK_REVERSE 			0x0D
#define LCD_TXT_BLINK_OFF     			0x0B
#define LCD_TXT_DONOTHING     			0x80

#define LCD_CG_ROM_MODE_OR              0b10000000
#define LCD_CG_ROM_MODE_EXOR            0b10000001
#define LCD_CG_ROM_MODE_AND             0b10000011
#define LCD_CG_ROM_MODE_TEXT            0b10000100
#define LCD_CG_RAM_MODE_OR              0b10001000
#define LCD_CG_RAM_MODE_EXOR            0b10001001
#define LCD_CG_RAM_MODE_AND             0b10001011
#define LCD_CG_RAM_MODE_TEXT            0b10001100

/* 1001 0000 is all off, OR together for ON modes */
#define LCD_DISPLAY_MODES_ALL_OFF       0b10010000
#define LCD_DISPLAY_MODES_GRAPHICS_ON   0b10011000
#define LCD_DISPLAY_MODES_TEXT_ON       0b10010100
#define LCD_DISPLAY_MODES_CURSOR_ON     0b10010010
#define LCD_DISPLAY_MODES_CURSOR_BLINK  0b10010001

/* Cursor Pattern Select */
#define LCD_CURSOR_PATTERN_UNDERLINE    0b10100000
#define LCD_CURSOR_PATTERN_BLOCK        0b10100111

/* Send Auto_XX Command, then block of data, then Auto_reset */
#define LCD_DATA_AUTO_WRITE_SET         0b10110000
#define LCD_DATA_AUTO_READ_SET          0b10110001
#define LCD_DATA_AUTO_RESET             0b10110010

/* Send R/W Then one byte Data */
#define LCD_DATA_WRITE_AUTO_INCREMENT   0b11000000
#define LCD_DATA_READ_AUTO_INCREMENT    0b11000001
#define LCD_DATA_WRITE_NO_INCREMENT     0b11000100
#define LCD_DATA_READ_NO_INCREMENT      0b11000101


/* Status Register Bits */
#define LCD_STATUS_BUSY1    0x01
#define LCD_STATUS_BUSY2    0x02
#define LCD_STATUS_DARRDY   0x04
#define LCD_STATUS_DAWRDY   0x08

#define LCD_STATUS_CLR      0x20
#define LCD_STATUS_ERR      0x40
#define LCD_STATUS_BLINK    0x80

/* Definitions */
#define ALL_INPUTS  0xFF
#define ALL_OUTPUTS 0x00

/* Function Declarations */
//void interrupt(void);
void glcd_init(void);
void lcd_write_data(unsigned char data);
unsigned char lcd_read_data(void);
void lcd_write_command(unsigned char data);
unsigned char lcd_read_status(void);
void lcd_clear_graphics(void);
void lcd_clear_text(void);
void lcd_write_char(unsigned char character, unsigned char x, unsigned char y);
void lcd_write_text(unsigned const char * str,unsigned char x,unsigned char y);
void lcd_set_pixel(unsigned char x, unsigned char y);
void lcd_clear_pixel(unsigned char x, unsigned char y);
unsigned char lcd_bit_to_byte(unsigned char bitter);

muuzoo

Biraz geç oldu ama.  t6963.h dosyası içinde bulunan tanımlamalardan :

#define LCD_GRAPHICS_WIDTH      0x80    /* Width of display (0xA0 = 160 pixels) */
#define LCD_GRAPHICS_HEIGHT     0x40    /* Height of display (0x80 = 128 pixels) */

tanımlamalarına uygun değeri yazmanız gerekiyor. Verdiğim değerle 128x64 lük ekran için geçerli.  Sizin durumunuzda

#define LCD_GRAPHICS_WIDTH      0xF0    /* Width of display (0xF0 = 240 pixels) */
#define LCD_GRAPHICS_HEIGHT     0x80    /* Height of display (0x80 = 128 pixels) */

yapmanız lazım.
gunluk.muuzoo.gen.tr - Kişisel karalamalarım...

tazmania

Alıntı yapılan: mesmert - 25 Ağustos 2010, 03:05:58
bunu 240X128 uygulamak istersek ne gibi değişiklik yapmak gerekir

/********************************************

 * Filename: t6963.c                        *

 *                                          *

 * Description: Toshiba LCD Driver Functions*

 *                                          *

 * by Richard Taylor                        *

 *                                          *

 * Date: 09/02/2003                         *

 *	Edited by Mehmet Muzaffer KOSTEN    *
  		                   
 *		for HI-TECH PIC C           * 
 			
 * 			Date: 04.02.2008    *
 *******************************************/

/* includes */

//#include <system.h>

#include "t6963.h"


/********************************************

 * Function name: initialise                *

 * Description:   Initialise PIC and LCD    *

 *******************************************/

void glcd_init(void)
{
    unsigned int i;
    /* Set Control Lines to outputs and High */

    LCD_CONTROL = LCD_CONTROL | LCD_WR | LCD_RD | LCD_CE | LCD_CD | LCD_RST | LCD_FS1;
    LCD_CONTROL_TRIS = LCD_CONTROL_TRIS & (~(LCD_WR | LCD_RD | LCD_CE | LCD_CD | LCD_RST | LCD_FS1));
    LCD_CONTROL = LCD_WR | LCD_RD | LCD_CE | LCD_CD | LCD_RST | LCD_FS1;

    /* Set PORTB to inputs */
    LCD_DATA_BUS_TRIS = 0xFF;

    /* Hold Reset Line for 1ms */
    LCD_RST_BIT=0;
    for(i=2;i>0;i--)
    {DelayMs(250);}
    LCD_RST_BIT=1;

    /* Set Char Gen Up */
    lcd_write_command(LCD_CG_ROM_MODE_OR);

    /* Set Graphic Home Address */
    lcd_write_data(LCD_GRAPHICS_HOME);
    lcd_write_data(LCD_GRAPHICS_HOME >> 8);
    lcd_write_command(LCD_GRAPHIC_HOME_ADDRESS_SET);

    /* Set Graphic Area */
    lcd_write_data(LCD_GRAPHICS_AREA); /* Width of 20 Chars */
    lcd_write_data(0x00);
    lcd_write_command(LCD_GRAPHIC_AREA_SET);

    /* Set Text Home Address */
    lcd_write_data(LCD_TEXT_HOME);
    lcd_write_data(LCD_TEXT_HOME >> 8);
    lcd_write_command(LCD_TEXT_HOME_ADDRESS_SET);

    /* Set Text Area */
    lcd_write_data(LCD_TEXT_AREA); /* Width of 20 Chars */
    lcd_write_data(0x0);
    lcd_write_command(LCD_TEXT_AREA_SET);
}

/********************************************

 * Function name: lcd_write_data            *

 * Description:   Write Data to LCD         *

 *******************************************/

void lcd_write_data(unsigned char data)
{
    /* While BUSY1 and BUSY2 are not 1 */
    while ( (lcd_read_status() & (LCD_STATUS_BUSY1 | LCD_STATUS_BUSY2)) != (LCD_STATUS_BUSY1 | LCD_STATUS_BUSY2));

    /* Clear C/D# */
    LCD_CD_BIT=0;

    /* Set Data Lines to Output */
    LCD_DATA_BUS = data;
    LCD_DATA_BUS_TRIS = ALL_OUTPUTS;

    /* Clear CE and WR, set RD */
    LCD_CE_BIT=0;
    LCD_WR_BIT=0;

    #asm 
    nop;
    nop;
    #endasm

    /* Set CE and RD*/
    LCD_CE_BIT=1;
    LCD_WR_BIT=1;
    LCD_CD_BIT=1;

    /* Set Data Lines to Input */
    LCD_DATA_BUS_TRIS = 0xFF;
}

/********************************************

 * Function name: lcd_read_data             *

 * Description:   Read Data From LCD        *

 *******************************************/

unsigned char lcd_read_data(void)
{
    unsigned char data;

    /* While BUSY1 and BUSY2 are not 1 */
    while ( (lcd_read_status() & (LCD_STATUS_BUSY1 | LCD_STATUS_BUSY2)) != (LCD_STATUS_BUSY1 | LCD_STATUS_BUSY2));

    /* Clear C/D# */
    LCD_CD_BIT=0;
    
    /* Set Data Lines to Input */
    LCD_DATA_BUS_TRIS = 0xFF;

    /* Clear CE and RD, set WR */
    LCD_CE_BIT=0;
    LCD_RD_BIT=0;

    #asm 
    nop;
	#endasm
    /* Read Data Bus */
    data = LCD_DATA_BUS;

    /* Set CE and RD*/
    LCD_CE_BIT=1;
    LCD_RD_BIT=1;
    LCD_CD_BIT=1;

    return data;
}



/********************************************

 * Function name: lcd_write_command         *

 * Description:   Write Command to LCD      *

 *******************************************/
 
void lcd_write_command(unsigned char data)
{
    unsigned char status;
    /* While BUSY1 and BUSY2 are not 1 */
    while ( (lcd_read_status() & (LCD_STATUS_BUSY1 | LCD_STATUS_BUSY2)) != (LCD_STATUS_BUSY1 | LCD_STATUS_BUSY2));

    /* Set C/D# */
    LCD_CD_BIT=1;

    /* Set Data Lines to Output */
    LCD_DATA_BUS = data;
    LCD_DATA_BUS_TRIS = 0x00;

    /* Clear CE and WR, set RD */
    LCD_CE_BIT=0;
    LCD_WR_BIT=0;

    #asm
    nop;
    nop;
    #endasm

    /* Set CE and RD*/
    LCD_CE_BIT=1;
    LCD_WR_BIT=1;
    LCD_CD_BIT=1;

    /* Set Data Lines to Input */
    LCD_DATA_BUS_TRIS = 0xFF;
}

/********************************************

 * Function name: lcd_read_status           *

 * Description:   Read Status From LCD      *

 *******************************************/

unsigned char lcd_read_status(void)
{
    unsigned char data;

    /* Set C/D# */
    LCD_CD_BIT=1;

    /* Set Data Lines to Input */
    LCD_DATA_BUS_TRIS = 0xFF;

    /* Clear CE and RD */
    LCD_CE_BIT=0;
    LCD_RD_BIT=0;

    #asm 
    nop;
	#endasm
    /* Read Data Bus */
    data = LCD_DATA_BUS;

    /* Set All Bits */
    LCD_CE_BIT=1;
    LCD_RD_BIT=1;
    LCD_CD_BIT=1;

    return data;
}

/********************************************

 * Function name: lcd_clear_graphics        *

 * Description:   Wipe Graphics RAM         *

 *******************************************/

void lcd_clear_graphics(void)
{
    unsigned char address_l, address_h;
    unsigned int address, address_limit;

    /* Set Address Pointer */
    address = LCD_GRAPHICS_HOME;
    address_l = address & 0xff;
    address_h = address >> 8;
    lcd_write_data(address_l);
    lcd_write_data(address_h);
    lcd_write_command(LCD_ADDRESS_POINTER_SET);
    address_limit = (LCD_GRAPHICS_HOME + LCD_GRAPHICS_SIZE);

    while (address < address_limit)
    {
        lcd_write_data(0x00);
        lcd_write_command(LCD_DATA_WRITE_AUTO_INCREMENT);
        address = address + 1;
    }

    if (LCD_NUMBER_OF_SCREENS == 0x02)
    {
        /* Set Address Pointer */
        address = LCD_GRAPHICS_HOME + 0x8000;
        address_l = address & 0xff;
        address_h = address >> 8;
        lcd_write_data(address_l);
        lcd_write_data(address_h);
        lcd_write_command(LCD_ADDRESS_POINTER_SET);
        address_limit = (LCD_GRAPHICS_HOME + LCD_GRAPHICS_SIZE +0x8000);

        while (address < address_limit)
        {
            lcd_write_data(0x00);
            lcd_write_command(LCD_DATA_WRITE_AUTO_INCREMENT);
            address = address + 1;
        }

    }

}

/********************************************

 * Function name: lcd_clear_text            *

 * Description:   Wipe Text RAM             *

 *******************************************/

void lcd_clear_text(void)
{
    unsigned char address_l, address_h;
    unsigned int address, address_limit;
    
    /* Set Address Pointer */
    address = LCD_TEXT_HOME;
    address_l = address & 0xff;
    address_h = address >> 8;
    lcd_write_data(address_l);
    lcd_write_data(address_h);
    lcd_write_command(LCD_ADDRESS_POINTER_SET);

        address_limit =  (LCD_TEXT_HOME + LCD_TEXT_SIZE);
        
        while (address < address_limit)
    {
        lcd_write_data(0x00);
        lcd_write_command(LCD_DATA_WRITE_AUTO_INCREMENT);
        address = address + 1;
    }

    if (LCD_NUMBER_OF_SCREENS == 0x02)
    {
        /* Set Address Pointer */
        address = LCD_TEXT_HOME + 0x8000;
        address_l = address & 0xff;
        address_h = address >> 8;
        lcd_write_data(address_l);
        lcd_write_data(address_h);
        lcd_write_command(LCD_ADDRESS_POINTER_SET);

        address_limit =  (LCD_TEXT_HOME + LCD_TEXT_SIZE + 0x8000);

        while (address < address_limit)
        {
            lcd_write_data(0x00);
            lcd_write_command(LCD_DATA_WRITE_AUTO_INCREMENT);
            address = address + 1;
        }

    }

}

/********************************************

 * Function name: lcd_write_text            *

 * Description:   Write Character to X, Y   *

 *                0 <= X <= LCD Text Width  *

 *                0 <= Y <= LCD Text Height *

 *******************************************/

void lcd_write_char(unsigned char character, unsigned char x, unsigned char y)
{
    unsigned int address;

    address = (y * LCD_TEXT_AREA) + x + LCD_TEXT_HOME;

    if (y > 63 && LCD_NUMBER_OF_SCREENS == 2) /* If we are on the second screen and it exists */
    {
        address = address + 0x8000;
    }
    character = character - 0x20;   /* Adjust standard ASCII to T6963 ASCII */

    lcd_write_data(address & 0xff);
    lcd_write_data(address >> 0x08);
    lcd_write_command(LCD_ADDRESS_POINTER_SET);
    lcd_write_data(character);
    lcd_write_command(LCD_DATA_WRITE_AUTO_INCREMENT);
}

void lcd_write_text(unsigned const char * str,unsigned char x,unsigned char y)
{
	//char i=0;
	while(*str)
	{
		lcd_write_char(*str++,x++,y);
	}
}

/********************************************

 * Function name: lcd_set_pixel             *

 * Description:   Set a single Pixel on     *

 *                0 <= X <= LCD Width       *

 *                0 <= Y <= LCD Height      *

 *******************************************/

void lcd_set_pixel(unsigned char x, unsigned char y)
{
    unsigned char data;
    unsigned int address, shift;

    address = (y * LCD_GRAPHICS_AREA) + (x / 8) + LCD_GRAPHICS_HOME;

    if (y > 63 && LCD_NUMBER_OF_SCREENS == 2) /* If we are on the second screen and it exists */
    {
        y = y - 64;
        address = (y * LCD_GRAPHICS_AREA) + (x / 8) + LCD_GRAPHICS_HOME;
        address = address + 0x8000;
    }

    data = lcd_bit_to_byte(7 - (x % 8));
    lcd_write_data(address & 0xff);
    lcd_write_data(address >> 0x08);
    lcd_write_command(LCD_ADDRESS_POINTER_SET);
    
    /* Read existing display */

    lcd_write_command(LCD_DATA_READ_NO_INCREMENT);
    data = data | lcd_read_data();

    /* Write modified data */
    lcd_write_data(data);
    lcd_write_command(LCD_DATA_WRITE_AUTO_INCREMENT);
}

/********************************************

 * Function name: lcd_clear_pixel           *

 * Description:   Clear a single Pixel      *

 *                0 <= X <= LCD Width       *

 *                0 <= Y <= LCD Height      *

 *******************************************/

void lcd_clear_pixel(unsigned char x, unsigned char y)

{
    unsigned char data;
    unsigned int address;

    address = (y * LCD_GRAPHICS_AREA) + (x / 8) + LCD_GRAPHICS_HOME;

    if (y > 63 && LCD_NUMBER_OF_SCREENS == 2) /* If we are on the second screen and it exists */
    {
        y = y - 64;
        address = (y * LCD_GRAPHICS_AREA) + (x / 8) + LCD_GRAPHICS_HOME;
        address = address + 0x8000;
    }

    data = lcd_bit_to_byte(7 - (x % 8));

    lcd_write_data(address & 0xff);
    lcd_write_data(address >> 0x08);
    lcd_write_command(LCD_ADDRESS_POINTER_SET);

    /* Read existing display */
    lcd_write_command(LCD_DATA_READ_NO_INCREMENT);
    data = (~data) & lcd_read_data();

    /* Write modified data */
    lcd_write_data(data);
    lcd_write_command(LCD_DATA_WRITE_AUTO_INCREMENT);
}

unsigned char lcd_bit_to_byte (unsigned char bitter)
{
   if(bitter==0)return 1;
   else if(bitter==1)return 2;
   else if(bitter==2)return 4;
   else if(bitter==3)return 8;
   else if(bitter==4)return 16;
   else if(bitter==5)return 32;
   else if(bitter==6)return 64;
   else if(bitter==7)return 128;
   else return 0;
}


/********************************************
 * Filename: t6963.h                        *
 *                                          *
 * Description: Header file for t6963.c     *
 *     by Richard Taylor                    *
 *                                          *
 * Date: 06/02/2003                         *
 * 		                            *
 * Edited by Mehmet Muzaffer KOSTEN         *                   
 *		for HI-TECH PIC C           * 
 *                                          *	
 * 			Date: 04.02.2008    *
 *******************************************/
/* Pragmas */
//#pragma CLOCK_FREQ      4000000

/* LCD Parameters */
#define LCD_TEXT_WIDTH          0x14    /* Text Width = Graphics Width / Character Width */
#define LCD_TEXT_HEIGHT         0x08    /* Text Height = Graphics Height / Character Height */
#define LCD_GRAPHICS_WIDTH      0x80    /* Width of display (0xA0 = 160 pixels) */
#define LCD_GRAPHICS_HEIGHT     0x40    /* Height of display (0x80 = 128 pixels) */
#define LCD_NUMBER_OF_SCREENS   0x02    /* for > 68 pixels height, is probably split into 2 screens */
                                        /* into 2 screens */
#define LCD_CHARACTER_WIDTH     0x06    /* Is character 8x8 or 6x8 (0x08 / 0x06) */

/* Define the Memory Map */
#define LCD_GRAPHICS_HOME   0x0000  /* This will usually be at the start of RAM */
#define LCD_GRAPHICS_AREA   0x10    /* A graphic character is 8 bits wide (same as 8x8 char) */
#define LCD_GRAPHICS_SIZE   0x0800  /* Size of graphics RAM */
#define LCD_TEXT_HOME       0x0A00  /* Graphics Area + Text Attribute Size (same size as text size) */
#define LCD_TEXT_AREA       0x10    /* Text line is 20 chars wide */
#define LCD_TEXT_SIZE       0x0200  /* Size of text RAM */

/*  Memory Map for 160x128 pixel display */
/*  This display is made up of two screens */
/*  Both 160x64 pixels */

/*  Screen 1 */

/*  0x0000  ----------------------------- */
/*          | Graphic RAM Area          | */
/*          | 0x0000 to 0x07FF          | */
/*          | (256x64 pixels)           | */
/*  0x0800  ----------------------------- */
/*          | Text Attribute Area       | */
/*  0x0A00  ----------------------------- */
/*          | Text RAM Area             | */
/*          | 512 Bytes                 | */
/*          | (256x64 pixels)           | */
/*  0x0C00  ----------------------------- */

/*  Screen 2 (Automatically derived from Screen 1) */

/*  0x8000  ----------------------------- */
/*          | Graphic RAM Area          | */
/*          | 0x0000 to 0x07FF          | */
/*          | (256x64 pixels)           | */
/*  0x8800  ----------------------------- */
/*          | Text Attribute Area       | */
/*  0x8A00  ----------------------------- */
/*          | Text RAM Area             | */
/*          | 512 Bytes                 | */
/*          | (256x64 pixels)           | */
/*  0x8C00  ----------------------------- */

//efekt için

/* LCD Data Bus Pins */
#define LCD_DATA_BUS        PORTB
#define LCD_DATA_BUS_TRIS   TRISB

/* LCD Control Pins */
#define LCD_CONTROL         PORTD
#define LCD_CONTROL_TRIS    TRISD
#define LCD_FS1_BIT			RD2
#define LCD_WR_BIT          RD3
#define LCD_RD_BIT          RD4
#define LCD_CE_BIT          RD5
#define LCD_CD_BIT          RD6
#define LCD_RST_BIT         RD7


#define LCD_FS1				0x00
#define LCD_WR              0x08
#define LCD_RD              0x10
#define LCD_CE              0x20
#define LCD_CD              0x40
#define LCD_RST             0x80

/* Control Word Definitions */
#define LCD_CURSOR_POINTER_SET          0b00100001
#define LCD_OFFSET_REGISTER_SET         0b00100010
#define LCD_ADDRESS_POINTER_SET         0b00100100

#define LCD_TEXT_HOME_ADDRESS_SET       0b01000000
#define LCD_TEXT_AREA_SET               0b01000001
#define LCD_GRAPHIC_HOME_ADDRESS_SET    0b01000010
#define LCD_GRAPHIC_AREA_SET            0b01000011

#define LCD_TXT_NORMAL        			0x00
#define LCD_TXT_REVERSE       			0x05
#define LCD_TXT_OFF           			0x03
#define LCD_TXT_BLINK         			0x08
#define LCD_TXT_BLINK_REVERSE 			0x0D
#define LCD_TXT_BLINK_OFF     			0x0B
#define LCD_TXT_DONOTHING     			0x80

#define LCD_CG_ROM_MODE_OR              0b10000000
#define LCD_CG_ROM_MODE_EXOR            0b10000001
#define LCD_CG_ROM_MODE_AND             0b10000011
#define LCD_CG_ROM_MODE_TEXT            0b10000100
#define LCD_CG_RAM_MODE_OR              0b10001000
#define LCD_CG_RAM_MODE_EXOR            0b10001001
#define LCD_CG_RAM_MODE_AND             0b10001011
#define LCD_CG_RAM_MODE_TEXT            0b10001100

/* 1001 0000 is all off, OR together for ON modes */
#define LCD_DISPLAY_MODES_ALL_OFF       0b10010000
#define LCD_DISPLAY_MODES_GRAPHICS_ON   0b10011000
#define LCD_DISPLAY_MODES_TEXT_ON       0b10010100
#define LCD_DISPLAY_MODES_CURSOR_ON     0b10010010
#define LCD_DISPLAY_MODES_CURSOR_BLINK  0b10010001

/* Cursor Pattern Select */
#define LCD_CURSOR_PATTERN_UNDERLINE    0b10100000
#define LCD_CURSOR_PATTERN_BLOCK        0b10100111

/* Send Auto_XX Command, then block of data, then Auto_reset */
#define LCD_DATA_AUTO_WRITE_SET         0b10110000
#define LCD_DATA_AUTO_READ_SET          0b10110001
#define LCD_DATA_AUTO_RESET             0b10110010

/* Send R/W Then one byte Data */
#define LCD_DATA_WRITE_AUTO_INCREMENT   0b11000000
#define LCD_DATA_READ_AUTO_INCREMENT    0b11000001
#define LCD_DATA_WRITE_NO_INCREMENT     0b11000100
#define LCD_DATA_READ_NO_INCREMENT      0b11000101


/* Status Register Bits */
#define LCD_STATUS_BUSY1    0x01
#define LCD_STATUS_BUSY2    0x02
#define LCD_STATUS_DARRDY   0x04
#define LCD_STATUS_DAWRDY   0x08

#define LCD_STATUS_CLR      0x20
#define LCD_STATUS_ERR      0x40
#define LCD_STATUS_BLINK    0x80

/* Definitions */
#define ALL_INPUTS  0xFF
#define ALL_OUTPUTS 0x00

/* Function Declarations */
//void interrupt(void);
void glcd_init(void);
void lcd_write_data(unsigned char data);
unsigned char lcd_read_data(void);
void lcd_write_command(unsigned char data);
unsigned char lcd_read_status(void);
void lcd_clear_graphics(void);
void lcd_clear_text(void);
void lcd_write_char(unsigned char character, unsigned char x, unsigned char y);
void lcd_write_text(unsigned const char * str,unsigned char x,unsigned char y);
void lcd_set_pixel(unsigned char x, unsigned char y);
void lcd_clear_pixel(unsigned char x, unsigned char y);
unsigned char lcd_bit_to_byte(unsigned char bitter);


Mesmert arkadaşımızın vermiş olduğu kütüphane ile SAP1024 işlemcili 240x128 grafik LcD sürmeye çalışıyorum. programı build ederken sürekli bir hata veriyor. tanımlayan sembol uyarısı veriyor. ancak kütüphaneden programı başında void  yazarak çağırınca derlemeyi yapıyor. bu normal bir durummudur

tazmania

Alıntı yapılan: Analyzer - 06 Temmuz 2009, 19:00:01
Selam,

Karaköy piyasasında da bolca satılan T6963C uyumlu olduğu söylenen (halbuki içerisinde SAP1024B var, pinout ve kontrol biraz farklı) 240x128 LCD ler için PIC+HITECH+Proteus dosyası :

http://rapidshare.com/files/252658609/ANS-0003.RAR

Analyzer
linki yenileyebilirmisin