#include <iom128v.h>
#include <macros.h>
#define uchar unsigned char
#define uint unsigned int
#define nop() NOP()
#define xtal 8
#define CS PB5
#define SID PB6
#define SCLK PB7
#define Set_CS() DDRB |= (1<<CS);PORTB |= (1<<CS)
#define Set_SID() DDRB |= (1<<SID);PORTB |= (1<<SID)
#define Set_SCLK() DDRB |= (1<<SCLK);PORTB |= (1<<SCLK)
#define Clr_CS() DDRB |= (1<<CS);PORTB &=~(1<<CS)
#define Clr_SID() DDRB |= (1<<SID);PORTB &=~(1<<SID)
#define Clr_SCLK() DDRB |= (1<<SCLK);PORTB &=~(1<<SCLK)
//====================================================================
//函数声明
void Delay(uint ms); //延时子程序
void W_1byte(uchar RW, uchar RS, uchar W_data);
void Write_8bits(uint W_bits);
void LCD_Init(void);
void Char_Set_XY(uchar x, uchar y, uchar *p);
void Set_Draw(void);
//设定哪一行,从那一个位置开始到那一个位置结束使用反白
//x=液晶屏上汉字的位置(1~8);end_x=汉字结束的地址(1~8);y=1~4行
//clear=1:清除反白;clear=0:设置反白;
void Set_White(uchar x,uchar y,uchar end_x,uchar clear);
void Draw_Pic(uchar x, uchar y, const uchar *Draw);
/*
/********************************************************************
********************************************************************/
const uchar PIC1[64][16]={
/*-- 调入了一幅图像:C:\Documents and Settings\Administrator\桌面\atmel.bmp --*/
/*-- 宽度x高度=128x64 --*/
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00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00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00
};
//==================================================================
const uchar PIC2[64][16]={
/*-- 调入了一幅图像:C:\Documents and Settings\Administrator\桌面\AVR.BMP --*/
/*-- 宽度x高度=128x64 --*/
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x3C,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x43,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xBD,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x27,
0x00,0x00,0x1F,0xFF,0x83,0xFF,0xE0,0x00,0x00,0xFF,0xF8,0x3F,0xFF,0xFF,0x01,0x3C,
0x00,0x00,0x3F,0xFF,0x81,0xFF,0xF0,0x00,0x01,0xFF,0xF0,0x7F,0xFF,0xFF,0xC1,0x3E,
0x00,0x00,0x3F,0xFF,0xC1,0xFF,0xF0,0x00,0x01,0xFF,0xF0,0x7F,0xFF,0xFF,0xE0,0xA7,
0x00,0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00,0x03,0xFF,0xE0,0xFF,0xC0,0xFF,0xF8,0x00,0x3F,0xFE,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7F,0xC0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7F,0xC0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7F,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x3F,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x3F,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x1F,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x1E,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0E,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0C,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0C,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00
};
/********************************************************************/
void main()
{
uchar i = 0;
PORTB = 0XFF; //
DDRB = 0XFF; //PB口全部设为输出模式
Clr_CS();
Clr_SID();
Clr_SCLK();
LCD_Init();
Delay(50);
LCD_Init(); //初始化两边是关键,否则液晶上电重起将不能显示
while(1)
{
nop();
nop();
Delay(500);
Char_Set_XY(0,0,"ST7920_3_wires");
Char_Set_XY(2,1,"反白练习");
Char_Set_XY(0,2,"可以单字反白或不");
Char_Set_XY(3,3,"反白");
Delay(2000);
Delay(2000);
Set_Draw();
Delay(100);
Set_White(1,1,7,0); //第1行,第1个汉字位置到第8汉字位置反白
Set_White(3,2,6,0); //第2行,第3个汉字位置到第6汉字位置反白
Set_White(1,3,8,0); //第3行,第1个汉字位置到第8汉字位置反白
Set_White(4,4,5,0); //第4行,第4个汉字位置到第5汉字位置反白
Delay(2000);
Delay(2000);
Set_White(4,1,4,1); //第1行,第4个汉字位置等取消反白
Set_White(5,2,5,1); //第2行,第5个汉字位置等取消反白
Set_White(6,3,6,1); //第3行,第6个汉字位置等取消反白
Set_White(4,4,4,1); //第4行,第4个汉字位置等取消反白
Delay(2000);
Delay(2000);
Set_White(1,1,1,1); //
Set_White(3,2,3,1); //
Set_White(2,3,2,1); //
Set_White(5,4,5,1); //
Delay(2000);
Delay(2000);
Set_White(1,1,8,1); //第1行,第1个汉字位置到第8汉字位置取消反白
Set_White(1,2,8,1); //第2行,第1个汉字位置到第8汉字位置取消反白
Set_White(1,3,8,1); //第3行,第1个汉字位置到第8汉字位置取消反白
Set_White(1,4,8,1); //第4行,第1个汉字位置到第8汉字位置取消反白
Delay(2000);
Delay(2000);
W_1byte(0,0,0x30); //基本指令集,,绘图显示OFF
W_1byte(0,0,0x01); //清除显示
W_1byte(0,0,0x01); //清除显示
W_1byte(0,0,0x01); //清除显示
Set_Draw();
Delay(100);
Draw_Pic(0,0,*PIC1); //先替换液晶内部RAM中的数据,再开显示
W_1byte(0,0,0x36); //8BIT控制界面,扩充指令集,,绘图显示ON
Delay(5000);
W_1byte(0,0,0x34); //绘图显示OFF,主要解决画图时拖尾的现象,即先
//替换好液晶内部RAM中的数据在开显示。
Draw_Pic(0,0,*PIC2);
W_1byte(0,0,0x36); //8BIT控制界面,扩充指令集,绘图显示ON
Delay(5000);
//画完图后要显示文字要重新设置成普通模式
W_1byte(0,0,0x30); //基本指令集,,绘图显示OFF
W_1byte(0,0,0x01); //清除显示
}
}
|