12864-15与ATmega32串行通信

合集下载

12864串行通信程序

12864串行通信程序
delayms(20);
}
void lcd_display()
{
Lcd_WriteCmd(0x80);
while(table[num]!='\0')
{
Lcd_WriteData(table[num]);
num++;
delayms(100);
}
Lcd_WriteCmd(0x90);
{
Lcd_WriteData(table2[num]);
num++;
delayms(100);
}
Lcd_WriteCmd(0x98);
num=0;
while(table3[num]!='\0')
{
Lcd_WriteData(table3[num]);
SCLK = 0;
}
}
/*****串行接收一个字节*****/
uchar ReceiveByte(void)
{
uchar i,temp1,temp2;
temp1 = 0;
temp2 = 0;
for(i=0;i<8;i++)
for(i=0;i<8;i++)
{
temp2=temp2<<1;
SCLK = 0;
SCLK = 1;
SCLK = 0;
if(SID)
temp2++;
uchar ReceiveByte(void);
void Lcd_WriteCmd(uchar Cbyte );

液晶12864串口通信(很好的实例,验证通过)

液晶12864串口通信(很好的实例,验证通过)
clk = 0;
if(sid) temp1++;
}
for(i=0;i<8;i++)
{
temp2=temp2<<1;
clk = 0;
}
}
void send_dat(U8 dat)
{
U8 i;
for(i=0;i<8;i++)
{
clk=0;
dat<<=1;
sid=CY;
clk=1;
}
}
U8 get_byte()
}
{
U8 i,temp1=0,temp2=0;
for(i=0;i<8;i++)
{
temp1=temp1<<1;
clk = 0;
clk = 1;
send_dat((cmd&0x0f)<<4); //
}
void write_char(U8 dat)
{
check_busy();
send_dat(0xfa);//rw=0;rs=1
send_dat(dat&0xf0);
send_dat((dat&0x0f)<<4);
/* 液晶12864并口通信要8根数据线,en,rw,rs和电源正负线,要连一大堆线,用起来很不爽,学会用串口通信成了必然。下面是12864的串口通信传输数据,连电源线一起总共才需要4根线,多爽!(记住:一定要把PSB接低电平,把RS接高电平) */
#include<reg52.h>

LCD液晶显示模块12864应用笔记(串行方式)

LCD液晶显示模块12864应用笔记(串行方式)

data++;
}
}
2
DisplayC_LCD ( 0x93, “
”, 4 );
-3-
2. void DisplayD_LCD ( unsigned char addr,
unsigned char data1, unsigned char data2 ) { SendCMD_LCD( addr ); SendDAT_LCD( data1 ); SendDAT_LCD( data2 ); } 2 DisplayD_LCD ( 0x93, 0xB9, 0xE3 );
case 0: SendDAT_LCD( ‘0’ );
case 1: SendDAT_LCD( ‘0’ );
……
case 14: SendDAT_LCD( ‘E’ );
case 15: SendDAT_LCD( ‘F’ );
default: SendDAT_LCD( ‘R’ );
}
}
2
5
SendCMD_LCD( 0x93 );
//
unsigned char *data,
//
unsigned char num )
//
{
unsigned char n;
SendCMD_LCD( addr );
for ( n=0; n<num; n++){
SendDAT_LCD( data );
//
data++;
SendDAT_LCD( data );
-2-
1.
SendCMD_LCD
void SendCMD_LCD(unsigned char dat){
SendByte_LCD( 0xf8 );

12864液晶和RS232串口输出传感器信号程序(ATmega128 TS9600-M128)

12864液晶和RS232串口输出传感器信号程序(ATmega128 TS9600-M128)
//RXENn TXENn设置接收/发送使能
}
void Getchar(unsigned char chr)
{
while(!(UCSR0A&(1<<UDRE0)));
UDR0=chr;//将数据输入至UDRnI/O数据寄存器(即为,USART接收/发送数据缓冲寄存器)
//当UDRn为空时,即UDREn为1时可以接受数据,在主从机接收数据时使用;
DDRA=0xff;
PORTA=0xff;
DDRC=0xff;
PORTC=0xff;
DDRD=0xff;
PORTD=0x00;
_delay_ms(1);
_delay_ms(1);
LCMInit(); //LCM初始化 //液晶初始化
DisplayList(0x80,text_1); //显示第一行
char text_4[]={"电压为:"};
//读状态:检测忙
void ReadStatusLCM()
{
uchar temp;
uchar flag = 1;
while(flag==1)
{
DDRA=0x00; //端口A改为输入
PORTA=0xff;
_delay_ms(1);
//UBRR的大小取决于晶振频率和所需的波特率以及UCSR0A中U2Xn位的设置有关
//本例中晶振频率为16M,设置波特率为9600,U2Xn设为0,所以可通过查表知为103(见P180)
UCSR0B|=(1<<RXCIE0)|(1<<RXEN0)|(1<<TXEN0);//设置接收结束中断使能;发送结束中断与USART数据寄存器空中断不使能;

12864串行程序例程

12864串行程序例程

此文档,是本人根据12864资料编写而成,在51单片机上面调试通过成功,,由于51的内存有限,后续两幅图占用内存太大,所以注释。

#include<reg52.h>#define uchar unsigned char#define uint unsigned intsbit SID=P1^1; //RWsbit SCLK=P1^0;//Eint i,j,k,len;unsigned char code pic[];unsigned char code pic1[];unsigned char code IDA T[]={"陕西理工电子科技""单片机小液晶系列""中文字库测试程序""恭喜发财工作顺利"};void DisPhoto(unsigned char code *adder) ;void lcd_chine(unsigned char code *adder1);void Draw_Point(int x,int y,int z,int type); //画点坐标点,修正位,及是否为画点,还是消除void Draw_Line(int x,int y,int len,int typ);void delay_ms(uint x){uint i,j;for(j=0;j<x;j++)for(i=0;i<110;i++);}void write_lcd(uchar date,uint type) //type 0为命令,1为数据{switch(type){case 0:{uchar i;uchar i_data;i_data=0xf8;// CS=1;SCLK=0;for(i=0;i<8;i++){SID=(bit)(i_data&0x80);SCLK=0;SCLK=1;i_data<<=1;}i_data=date;i_data&=0xf0;//先传送高四位,屏弊低四位for(i=0;i<8;i++){SID=(bit)(i_data&0x80);SCLK=0;SCLK=1;i_data<<=1;}i_data=date;i_data<<=4; //将低四位移向高四位并传送for(i=0;i<8;i++){SID=(bit)(i_data&0x80);SCLK=0;SCLK=1;i_data<<=1;}// CS=0;}break;case 1:{uchar i;uchar i_data;i_data=0xfa;// CS=1;SCLK=0;for(i=0;i<8;i++){SID=(bit)(i_data&0x80);SCLK=0;SCLK=1;i_data<<=1;}i_data=date;i_data&=0xf0;//先传送高四位,屏弊低四位for(i=0;i<8;i++){SID=(bit)(i_data&0x80);SCLK=0; //给一个脉冲SCLK=1;i_data<<=1;}i_data=date;i_data<<=4; //将低四位移向高四位并传送for(i=0;i<8;i++){SID=(bit)(i_data&0x80);SCLK=0;SCLK=1;i_data<<=1;}// CS=0;}break;}}/***********************************************************************/ /* 图形显示清屏*/ /*************************************************************************/ void clear_lcd(){for(k=0;k<2;k++){for(i=0;i<32;i++) //{write_lcd((0x80 + i),0); //SET 垂直地址VERTICAL ADD 高度if(!k)write_lcd(0x80,0);elsewrite_lcd(0x88,0); //SET 水平地址HORIZONTAL ADD 宽首地址for(j=0;j<16;j++) // 共左向右共十条竖线write_lcd(0x00,1); //线宽四位二进制表示}}}/******************************************************************//* 液晶初始化-字库*//******************************************************************/void lcd_init1(){write_lcd(0x30,0);write_lcd(0x30,0); //基本指令集write_lcd(0x06,0); //显示右移一位write_lcd(0x0c,0); //显示开,游标关,反白关write_lcd(0x01,0); //清屏}/******************************************************************//* 液晶初始化-图形*//******************************************************************/void lcd_init2(void) //LCD显示图片(扩展)初始化程序{ write_lcd(0x34,0);write_lcd(0x36,0); //扩充指令集write_lcd(0x3E,0); //(DL=8BITS,RE=1,G=1)write_lcd(0x02,0); //清DDRAM}/***************************************************************************/ /* 主函数**/ /***************************************************************************/void main(){lcd_init2(); //初使化图片指令集clear_lcd();// 清屏while(1){Draw_Point(0,40,7,1); //画点delay_ms(3000);Draw_Point(0,40,7,0); //取消点的绘制//DisPhoto(pic);Draw_Line(0,42,10,1) ; //画线delay_ms(3000);Draw_Line(0,42,10,0) ; //消线/* lcd_init1();lcd_chine(IDAT);delay_ms(2000);write_lcd(0x01,0); //清屏*/}}void lcd_chine(unsigned char code *adder1){uchar i;write_lcd(0x80,0); //Set Graphic Display RAM Addressdelay_ms(1);for(i=0;i<32;i++){write_lcd(*adder1,1);adder1++;}write_lcd(0x90,0); //Set Graphic Display RAM Addressfor(i=32;i<64;i++){write_lcd(*adder1,1);adder1++;}}/************************************************************************/ /* 显示图形点阵*/ /************************************** *********************************/void DisPhoto(unsigned char code *adder){//*******显示上半屏内容设置for(i=0;i<32;i++) //{write_lcd((0x80 + i),0); //SET 垂直地址VERTICAL ADD 高度write_lcd(0x80,0); //SET 水平地址HORIZONTAL ADD 宽for(j=0;j<16;j++){write_lcd(*adder,1);adder++;}}//*******显示下半屏内容设置for(i=0;i<32;i++) // 竖直高度是两个32点2X32{write_lcd((0x80 + i),0); //SET 垂直地址VERTICAL ADDwrite_lcd(0x88,0); //SET 水平地址HORIZONTAL ADDfor(j=0;j<16;j++){write_lcd(*adder,1);adder++;}}}/*************************************************************************/ /* 画图*/ /***********************************************************************/ void Draw_Point(int x,int y,int z,int type) //z为修正量,向右移动的位数{switch (z){case 0:z=1; break;case 1:z=2; break;case 2:z=4;break;case 3:z=8;break;case 4:z=0x10; break;case 5:z=0x20; break;case 6:z=0x40;break;case 7:z=0x80;break;}if (y>32){y-=32;x=x+8;}write_lcd(0x80+y,0); //Y坐标write_lcd(0x80+x,0); //X坐标switch(type){ case 1:write_lcd(0x00+z,1);break;case 0:write_lcd(0x00,1);break;}}/******************************************************************** **//* 画直线*//*********************************************************************/ void Draw_Line(int x,int y,int len,int type){ if (y>32){y-=32;x=x+8;}write_lcd(0x80+y,0);write_lcd(0x80+x,0);switch(type){ case 1:for(i=0;i<len;i++){write_lcd(0xff,1);}break;case 0:for(i=0;i<len;i++){write_lcd(0x00,1);}break;}}/*unsigned char code pic[]={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,0x6E,0xFC,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x80,0x03,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x01,0x00,0x00,0x20,0x08,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x81,0x00,0x00,0x27,0xF8,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x83,0x00,0x00,0xC2,0xE0,0x00,0x00,0x00,0x00,0x00,0x10,0x00,0x00,0x00, 0x00,0x00,0x8E,0x00,0x00,0x83,0x80,0xF8,0x00,0x00,0x00,0x00,0x10,0x00,0x00,0x00, 0x00,0x00,0xF0,0x00,0x00,0x7E,0x06,0x0C,0x00,0x00,0xFE,0x00,0x10,0x00,0x00,0x00, 0x00,0x3B,0x80,0x00,0x00,0x3F,0xE3,0x84,0x00,0x20,0x06,0x00,0x10,0x00,0x00,0x00, 0x00,0x00,0x80,0x00,0x00,0x05,0x00,0x7C,0x00,0x18,0x1C,0x00,0x10,0x00,0x00,0x00, 0x00,0x00,0x80,0x00,0x00,0x0D,0x80,0x00,0x00,0x0C,0x70,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x08,0xC0,0x00,0x00,0x00,0x00,0x80,0x20,0x00,0x00,0x00, 0x00,0x00,0x80,0x00,0x00,0x00,0x60,0x00,0x00,0x41,0x80,0x80,0x20,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7F,0xC0,0x00,0x20,0x00,0x00,0x00, 0x00,0x00,0x80,0x00,0x00,0x00,0x3F,0xE0,0x00,0x06,0x40,0x00,0x20,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x04,0x00,0x20,0x00,0x04,0x40,0x00,0x20,0x00,0x00,0x00, 0x00,0x00,0x80,0x00,0x00,0x04,0x00,0x20,0x00,0x18,0x40,0x00,0x20,0x00,0x00,0x00, 0x0F,0x76,0xEF,0xFF,0x00,0x02,0x7E,0x20,0x00,0x70,0x40,0x80,0x20,0x00,0x00,0x00, 0x00,0x00,0x80,0x00,0x00,0x01,0x00,0x20,0x00,0x41,0x40,0x20,0x20,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x01,0x80,0x40,0x00,0x00,0xC0,0x00,0x20,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0xFF,0xC0,0x00,0x00,0x00,0x0A,0x40,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0xC0,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x60,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x01,0xC0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x06,0x00,0x00,0x00,0x02,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x02,0x00,0x00,0x03,0x80,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x02,0x02,0xE8,0x00,0x3C,0x80,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x18,0x80,0x00,0x02,0x3F,0x08,0x00,0xF8,0x80,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x07,0xFF,0x00,0x02,0x00,0x08,0x00,0x0C,0x81,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x80,0x00,0x02,0x02,0x08,0x00,0x00,0x81,0x00,0x07,0x80,0x00, 0x00,0x00,0x00,0x00,0x80,0x00,0x01,0x1E,0x10,0x03,0x39,0x81,0x10,0x00,0xC0,0x00, 0x00,0x00,0x00,0x0F,0xB0,0x00,0x01,0x04,0x20,0x01,0x88,0x00,0x10,0x00,0x40,0x00, 0x00,0x00,0x00,0x01,0x0C,0x00,0x00,0x44,0x60,0x00,0x08,0x00,0x10,0x00,0xC0,0x00, 0x00,0x00,0x00,0x03,0x00,0x00,0x00,0x3D,0xF8,0x00,0x3B,0xD0,0x20,0x00,0x80,0x00, 0x00,0x00,0x00,0x06,0x00,0x00,0x00,0x04,0x00,0x00,0x00,0x00,0x10,0x01,0x00,0x00, 0x00,0x00,0x00,0x0D,0xE0,0x00,0x00,0x04,0x00,0x00,0x17,0x00,0x10,0x01,0x00,0x00, 0x00,0x00,0x00,0x3C,0x20,0x00,0x00,0x04,0x00,0x08,0x11,0x00,0x30,0x01,0x00,0x00, 0x00,0x00,0x00,0x05,0xA0,0x00,0x00,0x04,0x00,0x08,0x1F,0x00,0x20,0x01,0x80,0x00, 0x00,0x00,0x00,0x02,0xA0,0x00,0x00,0x03,0x80,0x08,0x86,0x01,0xC0,0x20,0x80,0x00, 0x00,0x00,0x00,0x03,0xA0,0x00,0x00,0x00,0x6D,0xB8,0x02,0x20,0x00,0x0B,0x80,0x00, 0x00,0x00,0x00,0x02,0xA0,0x00,0x00,0x00,0x00,0x00,0x3E,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0xE0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x1C,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,0x20,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x20,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x1F,0x87,0x80,0x00, 0x00,0x00,0x00,0x00,0x20,0x00,0x00,0x00,0x00,0x02,0x00,0x00,0x10,0xC4,0xC0,0x00, 0x00,0x00,0x00,0x20,0x20,0x7F,0xF0,0x0F,0x00,0x06,0x00,0x00,0x10,0x4D,0x20,0x00, 0x00,0x00,0x03,0xFF,0xFF,0xFE,0x00,0x11,0xC0,0xE4,0x00,0x00,0x10,0x4D,0x20,0x00, 0x00,0x00,0x00,0x00,0x20,0x04,0x00,0x10,0x40,0x1F,0xE0,0x00,0x00,0xCF,0x20,0x00, 0x00,0x00,0x00,0x00,0x20,0x04,0x00,0x10,0x40,0x0C,0x20,0x00,0x0F,0x88,0x20,0x80, 0x00,0x00,0x00,0x00,0x20,0x08,0x00,0x10,0x4E,0x1C,0x0C,0x00,0x00,0x08,0x00,0x80, 0x00,0x00,0x00,0x3D,0xFE,0x08,0x00,0x10,0x5A,0x2F,0x1A,0x00,0x00,0x08,0x01,0x00, 0x00,0x00,0x00,0x00,0x40,0xF8,0x00,0x10,0xDE,0x43,0x9F,0x00,0x00,0x08,0x01,0x00, 0x00,0x00,0x00,0x00,0x40,0x00,0x00,0x1F,0x9D,0x80,0x04,0x00,0x00,0x0E,0x01,0x00, 0x00,0x00,0x00,0x1F,0xC0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x03,0xFF,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,};unsigned char code pic[]={0xFF,0xFF,0xFF,0xFF,0xFF,0xF0,0x00,0x00,0x00,0x00,0x00,0x3F,0x80,0x02,0xFF,0xFF, 0xBF,0xFF,0xFF,0xFF,0xFF,0xFC,0x00,0x00,0x00,0x00,0x07,0xFF,0xE0,0x00,0xFF,0xFF, 0xFF,0xFF,0xFF,0xFF,0xFF,0xFC,0x00,0x00,0x00,0x00,0x07,0xFF,0xE0,0x00,0xFF,0xFF, 0xFF,0xFF,0xFF,0xFF,0xFF,0xFE,0x00,0x00,0x00,0x00,0x07,0xFF,0xE0,0x07,0xFF,0xFF, 0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0x00,0x00,0x00,0x00,0x00,0x7F,0xE0,0x1F,0xFF,0xFF, 0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xC0,0x00,0x00,0x00,0x00,0x7F,0xE0,0x7F,0xFF,0xFF, 0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xE0,0x00,0x00,0x00,0x00,0x3F,0xC0,0xFF,0xFF,0xFF, 0x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xFF,0xFB,0x00,0x00, 0x38,0x3F,0xFF,0xF0,0x0C,0x00,0x00,0x00,0x0F,0xFF,0xFF,0xFF,0xFF,0xF8,0x00,0x00, 0xFF,0xFF,0xFF,0xFF,0xFC,0x00,0x00,0x00,0x1F,0xFF,0xFF,0xFF,0xFF,0xFE,0x00,0x00, 0xFF,0xFF,0xFC,0x00,0x00,0x70,0x00,0x00,0x7F,0xFF,0xFF,0xF3,0xFF,0xFC,0x00,0x00, 0xFF,0xFF,0x98,0x00,0x00,0x30,0x00,0x00,0xFF,0xFF,0xFF,0x93,0xFF,0xF0,0x00,0x00, 0xFF,0xFF,0xE4,0x00,0x00,0x70,0x00,0x30,0xFF,0xFF,0xFF,0xF3,0x2A,0x58,0x00,0x00, 0xFF,0xFF,0xF8,0x00,0x00,0xE0,0x00,0x00,0x03,0xFF,0xFE,0x3D,0xFF,0xF8,0x00,0x00, 0xFF,0xFF,0xFE,0x00,0x00,0xE0,0x00,0x00,0x00,0x7F,0xFF,0xFB,0xFF,0xF0,0x00,0x00, 0xFF,0x80,0x7F,0x00,0x01,0xE0,0x00,0x00,0x00,0x00,0xFF,0xFF,0xFF,0x7F,0x80,0x03, 0xFE,0xFF,0x9F,0x80,0x01,0xE0,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x3F,0xC0,0x3F, 0xFE,0x7F,0xFF,0xF8,0x03,0xE0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x3F,0xF8,0x70, 0xF8,0x3F,0xFF,0xFF,0x07,0xC0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0F,0x00, 0xC0,0x0F,0xF0,0xC0,0x03,0xC0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0xFF,0xFF,0xFF,0xFF,0xFF,0xFC,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF, 0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF, 0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF, 0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,}; */。

12864液晶显示 串行口方式

12864液晶显示 串行口方式
* 功能 : 显示子函数
* 输入 : 无
* 输出 : 无
***********************************************************************/
void Test()
{
write_com(0x03);
delay(50);
write_com(0x81);
hzkdis(" HOT-51");
write_com(0x91);
hzkdis("单片机开发板");
write_com(0x89);
hzkdis(" ");
write_com(0x98);
hzkdis(" 东流电子");
{
CS = 1;
sendbyte(0xfa);
sendbyte(Dispdata & 0xf0);
sendbyte((Dispdata << 4) & 0xf0);
delay(2);
}
/********************************************************************
***********************************************************************/
#include <reg52.h>
#include <intrins.h>
#define uchar unsigned char
#define uint unsigned int

12864液晶显示串行程序(英飞凌xc824)

12864液晶显示串行程序(英飞凌xc824)

12864液晶显示串行程序(英飞凌xc824)
先说说我的调试初衷前一阵看实验室的兄弟姐妹们都闲的无聊,就有人DIY 了,有人个BF 做电子时钟,一个液晶30 多,一个12C887 20 多,板子加器件还有单片机算下来少说也有70 大洋。

感觉实在不划算,但是对液晶还是
蛮感兴趣的,一方面熟悉一下串行设备,一方面为以后做准备,毕竟液晶显示
操作起来要比LED 简单,而且能实时显示,到什么时候都能用上。

所以,这
次液晶屏的调试,我就想搜集一些常用的程序,适当的修改,让液晶屏达到拿
来就能用上的目的。

先说说我这次调试的液晶屏,12864,带子库的,蓝色屏幕。

就是这张图了
单片机我选的是英飞凌xc824,新出的哦。

不是有啥特殊偏好,手头就有这个,就先用这个吧,主要是我对这个最小系统板上的触摸按键比较感兴趣。


然了,它也有缺点,内存太小,连一个12864 的图片都装不下。

:Q 闲话少说,先从最基本的数据手册开始吧
中显液晶12864.pdf
这是中文资料,因为这种东西已经被使用的多的不能再多了,而且厂家众多,但是有细微差别,比如串行和并行,有的是焊点切换的,有的是软件切换的。

我这个是后者。

刚接线的时候还出了个笑话,太相信实物和datasheet 和对应的了,结果屏幕的背光接反了,幸好没烧。

硬件方面,我选串行是因为它用线少,我很懒的。

:) P1.0 口对应CS,P1.1 口对应SID,P1.2 口对应CLK.
参考时序在datasheet 上写的很清楚有这个当指导思想,照着写程序吧.动手之。

12864串行使用说明

12864串行使用说明

LCM128645ZK使用说明
1.综述
LCM128645ZK为带中文字库图形点阵液晶显示模块。

其液晶屏幕为128*64,可显示四行,每行可显示8个汉字。

其背光为蓝色,字符为白色中文液晶显示模块LCM128645ZK的字型ROM内含8192个16*16点中文字型和128个16*8半宽的字母符号字型;另外绘图显示画面提供一个64*256点的绘图区域GDRAM;而且内含CGRAM提供4组软件可编程的16*16点阵造字功能。

通过
2.电气特性
3.引脚定义:
4.硬件电路的连接
3.1串并行工作方式的选择
串并行工作方式的选择通过改接模块背面短路电阻来完成。

当PSB脚接低电位(模块背面S/P的短路电阻在“S”侧),模块将进入串行模式;在串行模式下将使用二条传输线作串行资料的传送,主控制系统将配合传输同步时钟(SCLK)与接收串行数据线(SID),来完成串行传输的动作。

不可在不改接短路电阻的情况下将此引脚直接引线改接低电平。

短路电阻位置如图所示:
3.2外部硬件电路(串行工作方式)
串行工作电路如下图所示:并行传输的RS信号作为片选CS信号直接接高电平,读写选择R/W作为串行数据输入SID,读写使能信号作为串行输入时钟信号。

VO与VOUT引脚跨接10K电位器以调节液晶对比度。

RST复位信号可悬空。

背光电源阳极A需接+5V。

数据输入端3.3V高电平可正常驱动。

12864并行通信演示实例

12864并行通信演示实例

论坛推广任务第一期(有奖哦)[单片机资源] 12864资料及ST7920驱动器说明(附带原创演示程序—有详细的讲解)相关搜索: 演示, 驱动器, 程序, 资料, 讲解12864作为最常用的单片机输出设备,其内置强大的图形显示功能。

下面是本人收集12864的说明和12864最常用的驱动器ST7920(兼容ST7921)的说明,以及本人编写的最简单的12864两种数据传输模式的演示程序,供大家分享(见附件)。

并行通信模式的演示程序:/*****************************************************************程序:12864并行通信演示实例制作:风沙星辰日期:2009年07月30日功能:12864并行通信各项功能演示备注:A T89S52 11.0592M ST7920液晶驱动****************************************************************/#include <reg52.h> // 包含头文件#include <intrins.h>#define uchar unsigned char //简化整型,字符型变量书写#define uint unsigned intchar code hang1[] = {"锄禾日当午"}; // 显示字符定义char code hang2[] = {"汗滴禾下土"};char code hang3[] = {"谁知盘中餐"};char code hang4[] = {"粒粒皆辛苦"};#define LCD_data P0 // 引脚定义sbit LCD_RS = P1^0;sbit LCD_RW = P1^1;sbit LCD_EN = P1^2;sbit LCD_PSB = P1^3;//图片代码圣诞快乐128*32uchar code Photo1[][16] ={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,0x3F,0xF0,0x70,0x0F,0xF8,0x00,0x00,0x0F,0x01,0xE0,0x00,0x00,0xFC,0x00,0x00,0x00,0xFF,0xFC,0xFC,0x0F,0xFC,0x81,0xF0,0x0F,0x81,0xF0,0x00,0xE0,0xFC,0x1C,0x00, 0x03,0xFF,0xFF,0xFE,0x07,0xEF,0xC1,0xF8,0x07,0x81,0xF0,0x01,0xF3,0xFF,0x1F,0x00, 0x03,0xE3,0xDF,0xCE,0x03,0xCF,0xE3,0xF0,0x03,0xC0,0xFF,0x01,0xF3,0xFF,0xFF,0x00, 0x01,0xDF,0xDF,0xCE,0x07,0x9F,0x67,0xE0,0x03,0xC0,0xFF,0x80,0xFB,0xFF,0xFF,0x00, 0x00,0xFF,0xDF,0x9F,0x0F,0x9F,0x7F,0xC0,0x03,0xC0,0xFF,0xC0,0xFB,0xFF,0xFF,0x00,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x0F,0xBD,0xFC,0x00,0x07,0x87,0xDF,0x80,0x7C,0xFC,0x7C,0x00, 0x00,0x71,0xFF,0xE0,0x0F,0x3F,0xFF,0x80,0x07,0x8F,0xCF,0xC0,0xFC,0xFC,0x7E,0x00, 0x00,0xC1,0xFF,0xFC,0x0E,0x3F,0xFF,0xF8,0x07,0x8F,0x87,0xC0,0xFF,0xFC,0x3E,0x00, 0x00,0xDF,0xFF,0xFE,0x0F,0xFF,0xDF,0xF8,0x07,0x9F,0x83,0xC0,0xFF,0xFC,0x3E,0x00, 0x01,0xFF,0xFF,0xFF,0x07,0xFF,0xCF,0xF8,0x07,0x9F,0x03,0xC0,0xFB,0xFC,0x3E,0x00, 0x00,0xFF,0xC0,0x1E,0x03,0xF1,0x01,0xF0,0x03,0x8E,0x01,0x80,0x00,0x7C,0x1C,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};//图片代码新年进步128*32uchar code Photo2[][16] ={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,0xFF,0xC3,0xF0,0x01,0xFC,0x00,0x00,0x3C,0x00,0xF8,0x00,0x01,0xF8,0x3C,0x00, 0x00,0xFF,0xE3,0xF8,0x01,0xFE,0x00,0x00,0x3E,0x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0x3E,0x00, 0x00,0xFF,0xFE,0x7C,0x03,0xFD,0xFF,0xE0,0x3F,0xFF,0xFF,0x00,0x3E,0x7E,0x3E,0x00, 0x03,0xFF,0xFE,0x7C,0x0F,0xFF,0xFF,0xF8,0x1F,0xFC,0xFF,0xC0,0xFE,0xFE,0xFE,0x00, 0x03,0xFE,0xDE,0x7C,0x0F,0x3F,0xFF,0xF8,0x0F,0xBF,0xFF,0xC0,0xFF,0xFF,0xFC,0x00, 0x01,0xDE,0xDE,0x7C,0x0F,0xFF,0xFF,0xF8,0x1F,0x3F,0xFF,0xC0,0xFF,0xFF,0xF8,0x00,0x01,0xDE,0xFF,0x7C,0x0F,0xFF,0xFF,0xF8,0x1E,0x7F,0xF0,0x00,0x78,0xFF,0xF0,0x00, 0x01,0xFE,0xFF,0xFC,0x03,0xFF,0xFC,0x00,0x3C,0xFF,0xFF,0xC0,0x83,0xFF,0xE0,0x00, 0x01,0xFE,0xFF,0xFC,0x00,0xF0,0xFC,0x00,0x3C,0xFF,0xFF,0xE0,0xFF,0xFF,0xC0,0x00, 0x03,0xFE,0xFF,0xFC,0x00,0x00,0xFC,0x00,0x1F,0xFF,0xFF,0xE0,0x7F,0xFE,0x00,0x00, 0x01,0xFF,0x7F,0xFC,0x00,0x00,0xFC,0x00,0x1F,0xFF,0xFF,0xC0,0x3F,0xFC,0x00,0x00, 0x00,0x0E,0x0C,0x7C,0x00,0x00,0x78,0x00,0x07,0x80,0xFF,0x80,0x0F,0xC0,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};void delay_ms(uint ms) // 延时函数1ms{uint i,j;for(j=0;j<=ms;j++){for(i=0;i<=120;i++){}}}void delay4us() // 延时函数4Us{_nop_();_nop_();_nop_();_nop_();}void lcd_checkBusy(void) //检测忙标志{uchar busy;do{LCD_EN = 0;LCD_RS = 0;LCD_RW = 1;delay4us();LCD_EN = 1; //在使能端的一个上升沿读取LCD数据busy = P0;delay4us();LCD_EN = 0;}while(busy&0x80); //判断最高位是否为0,为0则处于空闲状态}void lcd_wcmd(uchar cmd) //写指令{lcd_checkBusy(); //检测忙碌状态LCD_RS = 0; //RS至低,指令操作LCD_RW = 0; //RW至低,写操作LCD_EN = 0;delay4us();P0 = cmd; //指令数据delay4us();LCD_EN = 1; //给使能端一个上升沿保存数据delay4us();LCD_EN = 0;}void lcd_wdat(uchar dat) //写数据{lcd_checkBusy(); //检测忙碌状态LCD_RS = 1; //RS至高,数据操作LCD_RW = 0;LCD_EN = 0;P0 = dat; //给LCD要显示的数据delay4us();LCD_EN = 1; //给使能端一个上升沿保存数据delay4us();LCD_EN = 0;}void lcd_init() //初始化LCD{LCD_PSB = 1; //选择并行模式lcd_wcmd(0x30); //初级指令集delay_ms(5);lcd_wcmd(0x0C); //开显示delay_ms(5);lcd_wcmd(0x01); //清屏delay_ms(5);}void drawphoto(uchar bmp[][16]) //绘图{uchar i,j,k;lcd_wcmd(0x34); //打开高级指令集,关绘图for(i=0;i<16;i++) //显示上半部分图片{lcd_wcmd(0x90+i); //输入Y轴坐标lcd_wcmd(0x80); //输入下轴坐标for(j=0;j<16;j++)lcd_wdat(bmp[j]); //写入数据delay_ms(1);}for(i=0,k=16;i<16,k<32;i++,k++) //显示下半部分图片{lcd_wcmd(0x80+i); //输入Y轴坐标lcd_wcmd(0x88); //输入X轴坐标for(j=0;j<16;j++)lcd_wdat(bmp[k][j]); //向LCD写入数据delay_ms(1);}lcd_wcmd(0x36); //打开绘图功能,显示所绘图片}void Clear_GDRAM(void) // 清屏,清除GDRAM中的数据,及向GDRAM中全写0 {uchar i,j,k;lcd_wcmd(0x34); //打开扩展指令集i = 0x80;for(j = 0;j < 32;j++){lcd_wcmd(i++);lcd_wcmd(0x80);for(k = 0;k < 16;k++){lcd_wdat(0x00);}}i = 0x80;for(j = 0;j < 32;j++){lcd_wcmd(i++);for(k = 0;k < 16;k++){lcd_wdat(0x00);}}lcd_wcmd(0x30); //回到基本指令集}void main() // 主函数{uchar i;LCD_PSB=1; // 选择显示模式为串行通信模式lcd_init(); //初始化液晶,清屏DDRAMlcd_wcmd(0x81); //写入要显示字符的地址for(i=0;i<10;i++){lcd_wdat(hang1); //写入显示字符delay_ms(300);}lcd_wdat(0x2c); //显示“,”。

12864液晶使用说明书

12864液晶使用说明书
5) 光标或显示移位控制:
功能:S/C:光标左/右移动,AC减/加1。 R/L:整体显示左/右移动,光标跟随移动,AC值不变。
6) 功能设定:
功能:DL=1: 8-BIT 控制接口; DL=0: 4-BIT 控制接口。 RE=1: 扩充指令集动作; RE=0: 基本指令集动作。
7) 设定CGRAM地址:
● RS=0: 当 MPU 进行读模块操作,指向地址计数器。 当 MPU 进行写模块操作,指向指令寄存器。
● RS=1: 无论 MPU 读/写操作,均指向数据寄存器。
串口方式: CS:串行片选信号,高电平有效。
并口方式: ● R/W=0 写操作。 ● R/W=1 读操作。
串口方式: 串行数据输入端 并口方式:使能信号,高电平有效。 串口方式:串行时钟信号。 MPU 与模块之间并口的数据传送通道, 4 位总线模式下 D0 ~ D3 脚断开 串/并口控制选择端: ● H:并口控制; ● L:串口控制。
字节的LSB部分,至于相关的另四位则都为0。串行传输讯号请参考下图说明
4、串行接口时序图:
(1) MPU写数5℃,VDD=4.5V)
五、用户指令集说明:
1、指令表一:(RE=0:基本指令集)
指令表二:(RE=1:扩充指令集)
备注说明: ● 当模块在接受指令前,微处理顺必须先确认模块内部处于非忙碌状态,即读取 BF 标志时BF需为0,方可接受新的指令;如果在送出一个指令前并不检查BF标 志,那么在前一个指令和这个指令中间必须延迟一段较长的时间,即是等待前一 个指令确实执行完成,指令执行的时间请参考指令表中的个别指令说明。 ● “RE”为基本指令集与扩充指令集的选择控制位,当变更“RE”位后,往后 的指令集将维持在最后的状态,除非再次变更“RE”位,否则使用相同指令集 时,不需每次重设“RE”位。

12864最基本最简单并行串行C程序

12864最基本最简单并行串行C程序

write(0,0x01); //清屏
write(0,0x06); //进入点设定
}
void delay_lcd(int ms) {
uchar t; while(ms--) {
for(t=0; t<20; t++) ; } }//延时 Nhomakorabea200uS
void send(uchar bbyte)
{
uchar i;
void init() {
//初始化
lcden=0; write_com(0x30); write_com(0x0c); write_com(0x01); write_com(0x06); write_com(0x81);
//功能设定,基本指令集 //开显示 //清屏 //进入点设定 //设置启示位置,不写也行,因为默认的就是从第一行开始的
lcdrs=0; P1=com; delay(5); lcden=1; delay(5); lcden=0; }
写指令
void write_data(uchar date) // 写数据 {
lcdrs=1; P1=date; delay(5); lcden=1; delay(5); lcden=0; }
}
void main() {
init(); for(num=0;num<6;num++)
{ write_data(table[num]); delay(200);
}
write_com(0x81+0x10); // 换行
for(num=0;num<11;num++) {
write_data(table1[num]); delay(200); }

LED12864液晶中文资料HS12864-15 系列中文图形液晶模块说明书

LED12864液晶中文资料HS12864-15 系列中文图形液晶模块说明书
AFC自动频率控制信号
HAGAR射频信号处理器
HARAG-RESET-X射频IC复位
HLGA射频信号处理器
RXC接收增益控制
RX-I/Q接收基带信号
RXIP接收基带I信号正
RXQP接收基带Q信号正
四、发射电路名称注解
TX-I/Q发射基带信号
TXIP发射基带I信号正
TXIN发射基带I信号负
TXQP发射基带Q信号正
TXQN发射基带Q信号负
VR2稳压器2输出(发射供电)
VTX发射供电
VMOD(=VTX)发射调制器供电
TXP(=TXPWR)发射启动信号
TXC发射增益控制
VAPC-G GSM自动功率控制
VAPC-D DCS自动功率控制
TXBUFF发射缓冲(预放)供电
TXVGSM GSM发射控制信号
TXVDCS DCS发射控制信号
CCUT低电保护充电控制信号
三、接收电路名称注解
VSYN-1频率合成器供电-1
VSYN-2频率合成器供电-1
VRX接收供电
VCP鉴相器供电
VSRM 5V升压
VSYNPWR频率合成器电源启动
VXOPWR主时钟供电控制
RXREF接收解调器参考电压
VREFRF01射频模块参考电压
VREFRF02接收解调器参考电压
ANT天线
VANT-1天线开关控制信号-1
DUPLEX双工器
LNA低噪声放大器
BAL平衡变换(拜仑)
VHFVCO V频段压控振荡器
UHFVCO U频段压控振荡器
SHFVCO S频段压控振荡器
OUT-CP锁相控制信号
LO-OUT本振信号输出
SCLK频率合成器时钟

简易12684液晶和Atmega32的电子万年历

简易12684液晶和Atmega32的电子万年历

简易12684液晶和Atmega32的电子万年历
闲来无事,又逢刮风下雨,把以前买来驱动一下就扔一边的12864液晶做
个小万年历。

哈哈……房间真差个钟~所用的原件不多:1.Atmega32单片机一
个(其实At89s51足够,手头Atmega32最多,所以高成本一下吧)2.晶振,电
容22pF3.7805,电容470uF,104若干,DC2.1电源插头。

4.DS1302,32768Hz 晶振,2012电池(座)(其他的电源都行,用作备用电源)5.12864液晶,带背光。

6.万用板一块。

先上图吧:
液晶背面就是主板了,这样结构容易站立。

也挺美观。

再来一张,关灯的效果,看上去很幽暗恐怖……:
以下是程序(包括了DS1302驱动和12864液晶驱动)tips:感谢大家的阅读,
本文由我司收集整编。

仅供参阅!。

12864液晶硬件连接指南

12864液晶硬件连接指南

LCD12864的引脚图:硬件连接:这里重点说一下,LCD12864的电源问题,关于控制线与数据线我想英爱不需要说的吧。

VCC和GND是最基本的电源,一般接5V即可,还有就是关于VEE以及VL(很多种屏称作V0,不过都一样了),一般接法如上图所示即可,这里强调一下:当LCD 与单片机接线以及电源供给完毕以后,需要调节可变电阻的阻值,可以说这个决定了你的液晶屏是否显示。

只有阻值在特定的位置区域以内才会显示。

最后就是关于BL+和BL-了,这个是液晶屏的背光,不建议直接接在VCC和GND上,加小电阻限流同时可以使用DA或者普通的IO口来控制(当然DA可以控制得更加犀利——改变亮度,IO口只能控制亮与灭)。

最后在总结一下,调试中遇到的各种问题如何应付:一、无任何显示A:硬件问题1:这种情况是新手最常碰到的问题,碰到这种情况首先对应硬件pdf文档,确定你的接线没有任何问题,如果是51单片机,用P0口一定要加10K的上拉电阻,不然程序正常了也显示不出来。

2:另外要注意第三脚VO的连接方式,这个是对比度电位引脚,实际中常采用10k的可变电阻滑动端连接vo脚,固定端的一段接vcc,另外一端应根据实际硬件连接。

如果用的是1602,另一端直接接到gnd就可以了,但是对于12864就应该看18脚的标记了,如果写的是NC ,那么另一端直接接地,如果是VEE,那么就应该接到18脚,因为这时的18脚是负压输出端。

根据这点确定你的对比对调节电路接法正确无误。

3:关于串并行选择的问题。

串并行选择对于有字库的12864适用(1602的四线驱动也可以叫做串行驱动),如果有PSB引脚,那么你的屏应该可以支持串并行了。

串并行的选择决定于PSB引脚的电位,一般是低电平为串行模式,高电平为并行模式。

有些同志在使用的时候对PSB进行了电位定义但是没有任何显示,这是你应该注意一下LCM板上焊点,尤其是和PSB引脚相连的那些起跳线作用的焊点。

因为大多厂家在出厂的时候就预先设置为并行模式,也就是接到高电位上(VCC)。

12864串行方式使用体会

12864串行方式使用体会

12864使用心得论文一、硬件连接1.1 12864引脚示意图1.2 本次实验中12864与MCU的连接示意图/****************晶振为11.0592**********************/sbit PSB = P1^0; //并1/串0选择//串行接法sbit CS = P1^3; //串片选sbit DS = P1^2; //串数据口sbit SCK = P1^1; //串时钟信号/*//并行接法sbit RS = P1^3; //数据/命令选择端sbit RW = P1^2; //读写选择端sbit E = P1^1; //使能信号端#define DataIO P0 //并行数据口*/二、底层基本程序(串行方式)2.1 基本写字节程序//写一个字节(以SCK上升沿接收一个位)void sendbyte(uint8 zdata){uint16 i;for(i=0; i<8; i++){if((zdata << i) & 0x80){DS = 1;}else {DS = 0;}SCK = 0;SCK = 1;}}2.2 写命令程序(若晶振频率>11.0592,则需加延时处理)//写命令void writeCmd(uint8 cmdcode){CS = 1;sendbyte(0xf8);sendbyte(cmdcode & 0xf0);sendbyte((cmdcode << 4) & 0xf0);// delayMs(1); //若晶振频率>11.0592,则需延时}2.3 写数据程序(若晶振频率>11.0592,则需加延时处理)//写数据void writeData(uint8 dispdata){CS = 1;sendbyte(0xfa);sendbyte(dispdata & 0xf0);sendbyte((dispdata << 4) & 0xf0);// delayMs(1); //若晶振频率>11.0592,则需延时}2.4 通用软件毫秒延时程序//延时程序void delayMs(uint16 xms){uint16 i,j;for (i=0;i<=xms;i++)for (j=0;j<=123;j++);}三、文本显示3.1 LCD12864初始化//LCD12864初始化void LCD12864Init(){PSB = 0; //串行writeCmd(0x30); //基本指令模式writeCmd(0x04); //游标右移一位writeCmd(0x0c); //显示开,关光标writeCmd(0x01); //清除LCD的内容(仅字符模式) }模块控制芯片提供两套控制命令,基本指令和扩充指令如下:指令表1:(RE=0:基本指令)指令表2:(RE=1:扩充指令)3.2 LCD12864字符串的显示//写字符串函数,参数line第1/2行beSpace字符前面的空格数pString指针uint8 write12864String(uint8 line,uint8 beSpace,char *pString){uint8 i=0;uint8 sLength = strlen(pString); //字符串长度if (pString == NULL) //空字符串return -1;writeCmd(0x30); //基本指令模式//设置写在的位置if (line == 1){writeCmd(0x80 + beSpace); //写在第一行的位置}else if (line == 2){writeCmd(0x90 + beSpace); //写在第二行的位置}else if (line == 3){writeCmd(0x88 + beSpace); //写在第三行的位置}else if (line == 4){writeCmd(0x98 + beSpace); //写在第四行的位置}else{return -1;}//写数据for (i=0;i< sLength;i++){writeData ( *pString );pString ++;}return 0;}12864每屏可显示4行8列共32个16×16点阵的汉字,每个显示RAM可显示1个中文字符或2个16×8点阵全高ASCII码字符,即每屏最多可实现32个中文字符或64个ASCII码字符的显示。

  1. 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
  2. 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
  3. 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。

12864-15与ATmega32串行通信#include <avr/io.h>#include <ctype.h>#include <stdint.h>#include <stdio.h>#include <util/delay.h>#include <avr/pgmspace.h> #include <avr/interrupt.h> #include <avr/eeprom.h>#define x1 0x80#define x2 0x88#define y 0x80#define comm 0#define dat 1const prog_uchar tab1[]={ "葡萄美酒夜光杯,""羌笛何须怨杨柳,""欲饮琵琶马上催。

""春风不度玉门关。

"};const prog_uchar tab32[]={/*-- 调入了一幅图像:F:\梁\画图\HOCO12832.bmp --*//*-- 宽度x高度=128x32 --*/0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0 0,0x00,0x1E,0x00,0x00,0x00,0x00,0x00,0x07,0xF0,0x00,0x00,0x00,0x00,0x00,0x00,0x0 0,0x00,0x7F,0x80,0x00,0x00,0x00,0x00,0x18,0x0C,0x00,0x00,0x01,0x00,0x00,0x00,0x0 0,0x01,0xFF,0x80,0x00,0x00,0x00,0x00,0x20,0x00,0x00,0x00,0x13,0x10,0x03,0xFE,0x0 0,0x03,0xFF,0xC0,0x00,0x00,0x00,0x00,0x58,0x00,0x00,0x00,0x3F,0x30,0x1F,0xFF,0xC 0,0x03,0xFF,0xE0,0x00,0x00,0x00,0x00,0x8C,0x03,0xF0,0x00,0x7F,0xE0,0x7C,0x01,0xE 0,0x03,0xFF,0xF0,0x00,0x00,0x00,0x01,0x36,0x06,0xC0,0x00,0x5F,0xC0,0xFF,0xFC,0x6 0,0x01,0xFF,0xF0,0x00,0x00,0x00,0x02,0x1B,0x0F,0x80,0x00,0xFF,0x01,0xFE,0x0F,0x3 0,0x00,0xFF,0xFF,0xFF,0xF8,0x00,0x02,0x03,0xF0,0x20,0x07,0xFF,0xFF,0xFF,0xBA,0x0 0,0x00,0xFD,0xFF,0xFF,0xFC,0x00,0x02,0x03,0xF0,0x20,0x03,0xFF,0xFF,0xDF,0xB8,0x0 0,0x00,0xC1,0xC0,0x3F,0xFC,0x00,0x01,0x01,0xE0,0x40,0x00,0xFF,0xFF,0xDF,0xB0,0x0 0,0x00,0x81,0xC0,0x3F,0xCE,0x00,0x00,0x81,0xE0,0x80,0x00,0x7F,0xFF,0xDF,0xA0,0x0 0,0x00,0x81,0x80,0x1D,0xCF,0x00,0x00,0x41,0xE1,0x00,0x00,0x3F,0xFF,0x9B,0x00,0x0 0,0x01,0x83,0x80,0x1F,0xC7,0x80,0x00,0x21,0xE2,0x00,0x00,0x1F,0xFD,0xB6,0x00,0x0 0,0x01,0xC3,0x00,0x0E,0xE6,0x80,0x00,0x19,0xEC,0x00,0x00,0x07,0xFE,0x20,0x00,0x0 0,0x00,0xC3,0x00,0x07,0x67,0x40,0x00,0x07,0xF0,0x00,0x00,0x03,0x3E,0x00,0x00,0x0 0,0x00,0xEF,0xF0,0x00,0x00,0x00,0x02,0x6D,0x9F,0x00,0x00,0x3E,0x03,0xFF,0xF1,0x9 0,0x00,0xFF,0xF8,0x00,0x00,0x00,0x04,0x36,0xFE,0x00,0x01,0xFF,0x07,0xFF,0xFC,0x9 0,0x00,0xEF,0xFF,0xFF,0x80,0x00,0x04,0xDB,0x7E,0x00,0x03,0xFF,0x87,0xFF,0xFC,0xD 0,0x00,0x0F,0xFF,0xFF,0xC0,0x00,0x04,0x6D,0xFC,0x00,0x07,0xFF,0x8F,0xFF,0xFE,0x5 0,0x00,0x0F,0xFF,0xFF,0xE0,0x00,0x04,0x36,0xFC,0x10,0x07,0xFF,0x8F,0xFF,0xFE,0x9 0,0x00,0x0F,0xFF,0xFF,0xE0,0x00,0x04,0x1B,0xF8,0x10,0x07,0xFF,0xCF,0xFF,0xFE,0x8 0,0x00,0x0F,0xFF,0xFF,0xF0,0x00,0x04,0x0F,0xF8,0x10,0x07,0xFF,0xFF,0xFF,0xFA,0x0 0,0x00,0x07,0xFF,0xFF,0xF0,0x00,0x04,0x07,0xF0,0x10,0x07,0xFF,0xFF,0xFF,0xFA,0x0 0,0x00,0x02,0x00,0x03,0xE7,0xA0,0x00,0x00,0x00,0x00,0x00,0x02,0x8E,0x00,0x00,0x0 0,0x00,0x06,0x00,0x03,0x83,0x00,0x00,0x00,0x00,0x00,0x00,0x02,0x03,0x00,0x00,0x0 0,0x00,0x06,0x00,0x07,0x03,0x00,0x77,0x46,0x74,0x24,0x80,0x06,0x04,0x00,0x00,0x0 0,0x00,0x1C,0x00,0x06,0x00,0x00,0x55,0x45,0x54,0x57,0x80,0x00,0x00,0x00,0x00,0x0 0,0x00,0x1C,0x00,0x0E,0x00,0x00,0x45,0x45,0x74,0x57,0x80,0x08,0x00,0x00,0x00,0x0 0,0x00,0x00,0x00,0x1C,0x00,0x00,0x55,0x45,0x44,0x74,0x80,0xF0,0x00,0x00,0x00,0x0 0,0x00,0x00,0x00,0x38,0x00,0x00,0x77,0x76,0x47,0x54,0x80,0x00,0x00,0x00,0x00,0x0 0,0x00,0x00,0x00,0x00,0x00,0x00,0x10,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0 0};const prog_uchar tab5[]={/*-- 调入了一幅图像:F:\梁\画图\COCK.bmp --*//*-- 宽度x高度=128x64 --*/0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0 0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0 0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0 0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0 0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0 0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0 0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0 0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0 0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0 0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0 0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0 0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0 0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0 0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0xF 0,0x00,0x0F,0xE0,0x07,0xFF,0xCF,0xFF,0xFC,0x00,0xF8,0x03,0xE1,0xFF,0xE0,0x0F,0xF C,0x00,0x0F,0xE0,0x07,0xFF,0xCF,0xFF,0xFC,0x00,0xF8,0x03,0xE1,0xFF,0xF0,0x1F,0xF C,0x00,0x0F,0xF0,0x07,0xFF,0xCF,0xFF,0xFC,0x00,0xF8,0x03,0xE1,0xFF,0xF8,0x1F,0xF C,0x00,0x1F,0xF0,0x07,0xFF,0xCF,0xFF,0xFC,0x00,0xF8,0x03,0xE1,0xFF,0xFC,0x3F,0xF C,0x00,0x1F,0xF0,0x07,0xFF,0xCF,0xFF,0xFC,0x00,0xF0,0x03,0xE1,0xFF,0xFC,0x3F,0xB C,0x00,0x3F,0xF0,0x0F,0x80,0x00,0x3E,0x00,0x00,0xF0,0x07,0xC3,0xF0,0xFC,0x7E,0x0 4,0x00,0x3F,0xF0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0x03,0xF 8,0x07,0xC0,0xF8,0x3E,0x00,0x00,0xF8,0x00,0x07,0xC0,0x1F,0x87,0xFF,0x80,0x01,0xF C,0x07,0xFF,0xF8,0x3C,0x00,0x00,0xF8,0x00,0x07,0xC0,0x1F,0x87,0xFE,0x00,0x00,0xF0x0F,0xFF,0xF8,0x3C,0x00,0x00,0xF8,0x00,0x07,0xC0,0x1F,0x07,0xC0,0x00,0x00,0xF C,0x0F,0xFF,0xF8,0x3C,0x00,0x01,0xF0,0x00,0x07,0xC0,0x1F,0x07,0xC0,0x00,0x00,0xF C,0x1F,0xFF,0xF8,0x3C,0x00,0x01,0xF0,0x00,0x07,0xC0,0x1F,0x07,0xC0,0x00,0x00,0xF C,0x1F,0xFF,0xF8,0x3C,0x00,0x01,0xF0,0x00,0x07,0xC0,0x3F,0x07,0xC0,0x00,0x00,0xF C,0x1F,0x80,0x7C,0x7C,0x00,0x01,0xF0,0x00,0x07,0xC0,0x3E,0x0F,0x80,0x03,0x00,0xF 8,0x1F,0x00,0x7C,0x7C,0x00,0x01,0xF0,0x00,0x07,0xE0,0x7E,0x0F,0x80,0x03,0x01,0xF 8,0x1E,0x00,0x7C,0x7C,0x00,0x01,0xF0,0x00,0x07,0xF0,0xFC,0x0F,0x80,0x03,0x81,0xF 8,0x3E,0x00,0x7C,0xFF,0xFE,0x01,0xF0,0x00,0x07,0xFF,0xFC,0x0F,0x00,0x07,0xFF,0xF 0,0x3E,0x00,0x7C,0xFF,0xFC,0x03,0xF0,0x00,0x03,0xFF,0xF8,0x0F,0x00,0x07,0xFF,0xF 0,0x3C,0x00,0x7C,0xFF,0xFC,0x03,0xF0,0x00,0x03,0xFF,0xF8,0x0F,0x00,0x07,0xFF,0xE 0,0x7C,0x00,0x7C,0xFF,0xFC,0x03,0xF0,0x00,0x00,0xFF,0xF0,0x1F,0x00,0x03,0xFF,0x8 0,0x7C,0x00,0x7C,0xFF,0xFC,0x03,0xE0,0x00,0x00,0xFF,0xE0,0x1F,0x00,0x01,0xFF,0x8 0,0x78,0x00,0x7C,0x7F,0xFC,0x03,0xE0,0x00,0x00,0x7F,0x80,0x0E,0x00,0x00,0xFF,0x0 0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0 0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0 0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0 0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0 0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0 0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0 0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0 0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0 0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0 0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0 0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0 0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0 0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0 0,};void wr_lcd(uint8_t dat_comm,uint8_t content);/*------------------初始化-----------------*/void init_lcd(void){DDRB = _BV(PB4)|_BV(PB5)|_BV(PB7);DDRC = _BV(PC7);PORTC = _BV(PC7); //backlight enablewr_lcd(comm,0x30); /*0x30---基本指令动作*/wr_lcd(comm,0x06); /*光标的移动方向*/wr_lcd(comm,0x0c); /*开显示,关游标*/wr_lcd(comm,0x01); /*清屏,地址指针指向00H*/_delay_us(1600);}/*--------------清DDRAM------------------*/void clrram(void){wr_lcd(comm,0x30);wr_lcd(comm,0x01); //清除显示指令。

相关文档
最新文档