|
楼主 |
发表于 2011-6-21 08:44:29
|
显示全部楼层
(原文件名:T)~1XD3V)$MV(TXO@72O3UP.jpg)
this is the schematic
and this is the source code
/*********************************************
File name : Demo_6_9.c
Chip type : ATmega16
Program type : Application
Clock frequency : 4.000000 MHz
Memory model : Small
External SRAM size : 0
Data Stack size : 256
*********************************************/
#include <mega16.h>
// Alphanumeric LCD Module functions
#asm
.equ __lcd_port=0x15
#endasm
#include <lcd.h>
typedef unsigned char byte;
/* table for the user defined character */
flash byte char0[8]={ // 天的字型
0b0011111,
0b0000100,
0b0000100,
0b0011111,
0b0000100,
0b0000100,
0b0001010,
0b0010001};
flash byte char1[8]={ // 向的字型
0b0000100,
0b0001000,
0b0011111,
0b0010001,
0b0011111,
0b0011011,
0b0011111,
0b0010001};
flash byte char2[8]={ // 上的字型
0b0000100,
0b0000100,
0b0000111,
0b0000100,
0b0000100,
0b0000100,
0b0000100,
0b0011111};
/* function used to define user characters */
void define_char(byte flash *pc,byte char_code)
{
byte i,a;
a=(char_code<<3) | 0x40;
for (i=0; i<8; i++) lcd_write_byte(a++,*pc++);
}
void main(void)
{
lcd_init(16); // initialize the LCD for 2 lines & 16 columns
define_char(char0,0); // define user character 0
define_char(char1,1); // define user character 1
define_char(char2,2); // define user character 2
lcd_clear();
lcd_putsf("Demo_6_9.c"); // 第一行显示内容
lcd_gotoxy(0,1);
lcd_putsf("User define:"); // 第二行显示内容
lcd_putchar(0); // 接在后面显示"天天向上"
lcd_putchar(0);
lcd_putchar(1);
lcd_putchar(2);
while (1);
}
help help!!!! |
|