
Piyasada kolaylıkla bulunabilen bu lcd verilen sürücü programı ile normal lcdler gibi kullanabilir,kendi tasarımlarınızı gerçekleştirebilirsiniz.
Ekranın pin diyagramı:
pin1: V+ (3,3V)
pin2: SCLK
pin3: SDIN
pin4: D/C
pin5: SCE
pin6: GND
pin7: Vout (0.47uf ile ÅŸaseye)
pin8: RESET
Sürücü Programı:
/*
Graphic LCD Nokia 3310 (LPH7779) routines v3
CCS compiler
by Michel Bavin 2004 --- bavin@skynet.be
http://users.skynet.be/bk317494
August 29, 2004
*/
// Örnek kullanım
//
// Ekranı başlatmak için:
// nokia_init();
// ...
//Yazı yazılacak koordinatı belirlemek için:
// nokia_gotoxy(0,0);
//Ekrana yazdırma
// printf(nokia_printchar,"test???");
#define nok_sclk PIN_B0
#define nok_sda PIN_B1
#define nok_dc PIN_B2
#define nok_cs PIN_B3
#define nok_res PIN_B4
char char_row,charsel,charpos,chardata;// for nokia_3310 lcd
int16 ddram;
char plot_value;
int32 plot_value32;
int32 plot_umsb,plot_lmsb,plot_ulsb,plot_llsb;
//ASCII karakter tablosu NOKIA LCD: 96 rows * 5 bytes= 480 bytes
BYTE const TABLE5[240]=
{0x00,0x00,0x00,0x00,0x00, // 20 space
0x00,0x00,0x5f,0x00,0x00, // 21 !
0x00,0x07,0x00,0x07,0x00, // 22 "
0x14,0x7f,0x14,0x7f,0x14, // 23 #
0x24,0x2a,0x7f,0x2a,0x12, // 24 $
0x23,0x13,0x08,0x64,0x62, // 25 %
0x36,0x49,0x55,0x22,0x50, // 26 &
0x00,0x05,0x03,0x00,0x00, // 27 '
0x00,0x1c,0x22,0x41,0x00, // 28 (
0x00,0x41,0x22,0x1c,0x00, // 29 )
0x14,0x08,0x3e,0x08,0x14, // 2a *
0x08,0x08,0x3e,0x08,0x08, // 2b +
0x00,0x50,0x30,0x00,0x00, // 2c ,
0x08,0x08,0x08,0x08,0x08, // 2d -
0x00,0x60,0x60,0x00,0x00, // 2e .
0x20,0x10,0x08,0x04,0x02, // 2f /
0x3e,0x51,0x49,0x45,0x3e, // 30 0
0x00,0x42,0x7f,0x40,0x00, // 31 1
0x42,0x61,0x51,0x49,0x46, // 32 2
0x21,0x41,0x45,0x4b,0x31, // 33 3
0x18,0x14,0x12,0x7f,0x10, // 34 4
0x27,0x45,0x45,0x45,0x39, // 35 5
0x3c,0x4a,0x49,0x49,0x30, // 36 6
0x01,0x71,0x09,0x05,0x03, // 37 7
0x36,0x49,0x49,0x49,0x36, // 38 8
0x06,0x49,0x49,0x29,0x1e, // 39 9
0x00,0x36,0x36,0x00,0x00, // 3a :
0x00,0x56,0x36,0x00,0x00, // 3b ;
0x08,0x14,0x22,0x41,0x00, // 3c <
0x14,0x14,0x14,0x14,0x14, // 3d =
0x00,0x41,0x22,0x14,0x08, // 3e >
0×02,0×01,0×51,0×09,0×06, // 3f ?
0×32,0×49,0×79,0×41,0×3e, // 40 @
0×7e,0×11,0×11,0×11,0×7e, // 41 A
0×7f,0×49,0×49,0×49,0×36, // 42 B
0×3e,0×41,0×41,0×41,0×22, // 43 C
0×7f,0×41,0×41,0×22,0×1c, // 44 D
0×7f,0×49,0×49,0×49,0×41, // 45 E
0×7f,0×09,0×09,0×09,0×01, // 46 F
0×3e,0×41,0×49,0×49,0×7a, // 47 G
0×7f,0×08,0×08,0×08,0×7f, // 48 H
0×00,0×41,0×7f,0×41,0×00, // 49 I
0×20,0×40,0×41,0×3f,0×01, // 4a J
0×7f,0×08,0×14,0×22,0×41, // 4b K
0×7f,0×40,0×40,0×40,0×40, // 4c L
0×7f,0×02,0×0c,0×02,0×7f, // 4d M
0×7f,0×04,0×08,0×10,0×7f, // 4e N
0×3e,0×41,0×41,0×41,0×3e // 4f O
};
//Devamı
BYTE const TABLE6[240]=
{0×7f,0×09,0×09,0×09,0×06, // 50 P
0×3e,0×41,0×51,0×21,0×5e, // 51 Q
0×7f,0×09,0×19,0×29,0×46, // 52 R
0×46,0×49,0×49,0×49,0×31, // 53 S
0×01,0×01,0×7f,0×01,0×01, // 54 T
0×3f,0×40,0×40,0×40,0×3f, // 55 U
0×1f,0×20,0×40,0×20,0×1f, // 56 V
0×3f,0×40,0×38,0×40,0×3f, // 57 W
0×63,0×14,0×08,0×14,0×63, // 58 X
0×07,0×08,0×70,0×08,0×07, // 59 Y
0×61,0×51,0×49,0×45,0×43, // 5a Z
0×00,0×7f,0×41,0×41,0×00, // 5b [
0×02,0×04,0×08,0×10,0×20, // 5c
0×00,0×41,0×41,0×7f,0×00, // 5d
0×04,0×02,0×01,0×02,0×04, // 5e
0×40,0×40,0×40,0×40,0×40, // 5f
0×00,0×01,0×02,0×04,0×00, // 60
0×20,0×54,0×54,0×54,0×78, // 61 a
0×7f,0×48,0×44,0×44,0×38, // 62 b
0×38,0×44,0×44,0×44,0×20, // 63 c
0×38,0×44,0×44,0×48,0×7f, // 64 d
0×38,0×54,0×54,0×54,0×18, // 65 e
0×08,0×7e,0×09,0×01,0×02, // 66 f
0×0c,0×52,0×52,0×52,0×3e, // 67 g
0×7f,0×08,0×04,0×04,0×78, // 68 h
0×00,0×44,0×7d,0×40,0×00, // 69 i
0×20,0×40,0×44,0×3d,0×00, // 6a j
0×7f,0×10,0×28,0×44,0×00, // 6b k
0×00,0×41,0×7f,0×40,0×00, // 6c l
0×7c,0×04,0×18,0×04,0×78, // 6d m
0×7c,0×08,0×04,0×04,0×78, // 6e n
0×38,0×44,0×44,0×44,0×38, // 6f o
0×7c,0×14,0×14,0×14,0×08, // 70 p
0×08,0×14,0×14,0×18,0×7c, // 71 q
0×7c,0×08,0×04,0×04,0×08, // 72 r
0×48,0×54,0×54,0×54,0×20, // 73 s
0×04,0×3f,0×44,0×40,0×20, // 74 t
0×3c,0×40,0×40,0×20,0×7c, // 75 u
0×1c,0×20,0×40,0×20,0×1c, // 76 v
0×3c,0×40,0×30,0×40,0×3c, // 77 w
0×44,0×28,0×10,0×28,0×44, // 78 x
0×0c,0×50,0×50,0×50,0×3c, // 79 y
0×44,0×64,0×54,0×4c,0×44, // 7a z
0×00,0×08,0×36,0×41,0×00, // 7b
0×00,0×00,0×7f,0×00,0×00, // 7c
0×00,0×41,0×36,0×08,0×00, // 7d
0×10,0×08,0×08,0×10,0×08, // 7e
0×78,0×46,0×41,0×46,0×78 // 7f
};
void nokia_init(void);
void nokia_write_command(char bytefornokia_command);
void nokia_write_data(char bytefornokia_data);
void nokia_write_dorc(char bytefornokia);
void nokia_gotoxy(int8 xnokia, int8 ynokia);
void nokia_erase_y(int8 ynokia);
void nokia_erase_x(int8 xnokia);
void nokia_printchar(int8 cvar);
void nokia_clean_ddram(void);
void table_to_nokialcd(void);
void nokia_plot(int8 xnokia,int8 plot_value8);
void nokia_write_data_inv(char bytefornokia_data_inv);
void nokia_clear_screen(void);
void nokia_clear_xy(int8 xnokia, int8 ynokia);
void nokia_print_uparrow(void);
void nokia_print_downarrow(void);
void nokia_print_leftarrow(void);
void nokia_print_rightarrow(void);
void nokia_print_degree(void);
void nokia_print_lowbatdegree(void);
void nokia_init(void)
{
output_high(nok_dc);
output_high(nok_cs);
output_low(nok_res);
delay_ms(10);
output_high(nok_res);
nokia_write_command(0×21);
nokia_write_command(0xc2);
nokia_write_command(0×13);
nokia_write_command(0×20);
nokia_write_command(0×09);
nokia_clean_ddram(); //DDRAM resetlenerek ekran temizlenir
nokia_write_command(0×08);
nokia_write_command(0×0c);
}
void nokia_clean_ddram(void)
{
nokia_gotoxy(0,0); // 84*6=504 clear LCD
for (ddram=504;ddram>0;ddram–){nokia_write_data(0×00);}
}
void nokia_write_command(char bytefornokia_command)
{
output_low(nok_dc);
output_low(nok_cs);
nokia_write_dorc(bytefornokia_command);
output_high(nok_cs);
}
void nokia_write_data(char bytefornokia_data)
{
output_high(nok_dc);
output_low(nok_cs);
nokia_write_dorc(bytefornokia_data);
output_high(nok_cs);
}
void nokia_write_dorc(char bytefornokia)
{
char caa;
for (caa=8;caa>0;caa–) {
output_low(nok_sclk);
// delay_us(2);
if ((bytefornokia&0×80)==0){output_low(nok_sda);}
else {output_high(nok_sda);}
output_high(nok_sclk);
bytefornokia=bytefornokia<<1;
}
}
void nokia_gotoxy(int8 xnokia, int8 ynokia)
{
nokia_write_command(0x40|(ynokia&0x07));
nokia_write_command(0x80|(xnokia&0x7f));
}
void nokia_erase_y(int8 ynokia)
{
nokia_gotoxy(0,ynokia);
printf(nokia_printchar," ");
}
void nokia_erase_x(int8 xnokia)
{
char column;
for (column=0;column!=6;column++){
nokia_gotoxy(xnokia,column);
nokia_write_data(0x00);
nokia_write_data(0x00);
nokia_write_data(0x00);
nokia_write_data(0x00);
nokia_write_data(0x00);
nokia_write_data(0x00);
}
}
void nokia_printchar(int8 cvar) // Ekrana bir karakter yazılır
{
charsel=cvar;
table_to_nokialcd();
}
// Ekrana yazı yazmak için tablodan karakter çekilir
void table_to_nokialcd(void)
{
if (charsel<0x20)return;
if (charsel>0×7f)return;
for (char_row=0;char_row<5;char_row++) { // 5 bytes
//TABLO5'de karakter ara
if (charsel<0x50){charpos=(((charsel&0xff)-0x20)*5);
chardata=TABLE5[(charpos+char_row)];}
//Yoksa TABLO6'ya bak
else if (charsel>0×4f){charpos=(((charsel&0xff)-0×50)*5);
chardata=TABLE6[(charpos+char_row)];}
//ekrana bilgiyi gönder nokia_write_data(chardata);
}
nokia_write_data(0×00); // BoÅŸluk koy
}
void nokia_plot(int8 xnokia,int8 plot_value8)
{
char i;
plot_value32=0;
// plot_value32|=1; //çubuk yerine nokta nokta kullanmak için
for (i=0;i!=plot_value8;i++){
plot_value32|=1;
plot_value32<<=1;
}
plot_value32|=2; // alt satır her zaman doldurulur
plot_llsb=(plot_value32&0xff);
plot_ulsb=((plot_value32>>8)&0xff);
plot_lmsb=((plot_value32>>16)&0xff);
plot_umsb=((plot_value32>>24)&0xff);
nokia_gotoxy(xnokia,1);
nokia_write_data_inv(plot_umsb);
nokia_gotoxy(xnokia,2);
nokia_write_data_inv(plot_lmsb);
nokia_gotoxy(xnokia,3);
nokia_write_data_inv(plot_ulsb);
nokia_gotoxy(xnokia,4);
nokia_write_data_inv(plot_llsb);
}
void nokia_write_data_inv(char bytefornokia_data_inv)
{
char caa;
output_high(nok_dc);
output_low(nok_cs); //chip aktif
for (caa=8;caa>0;caa–) {
output_low(nok_sclk);
delay_us(2);
if ((bytefornokia_data_inv&0×01)==0){output_low(nok_sda);}
else {output_high(nok_sda);}
output_high(nok_sclk);
bytefornokia_data_inv=bytefornokia_data_inv>>1;
}
output_high(nok_cs); //chip devre dışı
}
void nokia_clear_screen(void)
{
nokia_erase_y(0);
nokia_erase_y(1);
nokia_erase_y(2);
nokia_erase_y(3);
nokia_erase_y(4);
nokia_erase_y(5);
}
void nokia_clear_xy(int8 xnokia, int8 ynokia)
{
nokia_gotoxy(xnokia,ynokia);
nokia_printchar(” “);
}
void nokia_print_uparrow(void)
{
nokia_write_data(0×04);
nokia_write_data(0×02);
nokia_write_data(0×7f);
nokia_write_data(0×02);
nokia_write_data(0×04);
nokia_write_data(0×00);
}
void nokia_print_downarrow(void)
{
nokia_write_data(0×10);
nokia_write_data(0×20);
nokia_write_data(0×7f);
nokia_write_data(0×20);
nokia_write_data(0×10);
nokia_write_data(0×00);
}
void nokia_print_leftarrow(void)
{
nokia_write_data(0×08);
nokia_write_data(0×1c);
nokia_write_data(0×2a);
nokia_write_data(0×08);
nokia_write_data(0×08);
nokia_write_data(0xf8);
}
void nokia_print_rightarrow(void)
{
nokia_write_data(0×08);
nokia_write_data(0×08);
nokia_write_data(0×2a);
nokia_write_data(0×1c);
nokia_write_data(0×08);
nokia_write_data(0×00);
}
void nokia_print_degree(void)
{
nokia_write_data(0×00);
nokia_write_data(0×06);
nokia_write_data(0×09);
nokia_write_data(0×09);
nokia_write_data(0×06);
nokia_write_data(0×00);
// nokia_printchar(” “);
}
void nokia_print_lowbatdegree(void)
{
nokia_write_data(0×00);
nokia_write_data(0×06);
nokia_write_data(0×0f);
nokia_write_data(0×0f);
nokia_write_data(0×06);
nokia_write_data(0×00);
// nokia_printchar(” “);
}

cengiz Nis 25, 2009
öncelikle merhaba
benim bir sorum olucak ASCI karakter font büyüklüğü aynı program içine ekleyerek
istediğimiğzde daha büyük font yada küçük fontla nasıl bir kod gerekli yardımlarınız
için şimdiden teşekkür ederim
admin Nis 25, 2009
baştan karakter tablosu oluşturup bu tabloya göre de fonksiyonlar hazırlamanız gerekir