微波EDA网,见证研发工程师的成长!
首页 > 硬件设计 > 嵌入式设计 > ATmega16 nokia7110 LCD 屏幕实验

ATmega16 nokia7110 LCD 屏幕实验

时间:11-13 来源:互联网 点击:

char col_addr;
nokia_write_command(0xB0 + lcd_row); // page address set. pg 8-48 in the datasheet.
col_addr = 0x12+(lcd_col*6); // each FONT has five columns + 1 blank column. xaddr: 0 - 95 on noki
//a 7110. no offset.
//lcd_1st_col=0x12: the first column of display starts here. Weird! the datasheet didnt mention it.
nokia_write_command(0x10 | (col_addr>>4)); // column address 4 most bit set
nokia_write_command(0x0f & col_addr); // column address 4 least bit set
}

/**********************************************************
Convert bitmap to charractor Function
**********************************************************/
void lcd_chr(uchar charsel)
{
if (charsel < 0x20) return;
if (charsel > 0x7f) return;

for (char_row = 0; char_row < 5; char_row++) // 5 bytes
{
if (charsel<0x50)
{
charpos=(((charsel&0xff)-0x20)*5);
chardata=TABLE5[(charpos+char_row)];
}
if (charsel>0x4f)
{
charpos=(((charsel&0xff)-0x50)*5);
chardata=TABLE6[(charpos+char_row)];
}
nokia_write_data(chardata); // send FONT data to lcd
}
nokia_write_data(0x00); // blank underline pixels for each FONT
}

/**********************************************************
Write a string at current screen position
**********************************************************/
void lcd_str(uchar *str)
{
while (*str)
lcd_chr(*str++);
}
void main()
{
DDRD=0XFF;
SPI_init();

nokia_init();

nokia_gotoxy(0,0);
lcd_str("12345678abcdefg");

nokia_gotoxy(1,0);

lcd_str("abcdefg12345678");

//while(1);
}

Copyright © 2017-2020 微波EDA网 版权所有

网站地图

Top