12864液晶显示器显示正弦曲线的设计流程图 10
1个回答
展开全部
#define uchar unsigned char
#define uint unsigned int
#define MAX_LINE 64
#define MAX_LINE_RAM_LENGTH 30
#define GRAPHIC_MODE 1
#define TXT_MODE 2
#define graphic_add 0x00
#define point 1
#include
#include
#include
#include
#include
#include
#include
#include
void main(void)
{
uint i,j;
P3=0xff; //P3控制口置位
RESET=0; //LCD上电复位
delay(2);
RESET=1;
delay(2);
lcd_init();
/*清全屏幕,注意文字、图形参数不同,文字图形都有时以图形为准,参数可取大些*/
lcd_clr();
lcd_config_two_par(0x00,0x00,0x24);
/*lcd_disp_word(dan,0x07,0x02,1);
lcd_disp_word(shu,0x09,0x02,ch);
lcd_disp_word(zi,0x0b,0x02,ch);
lcd_disp_word(cun,0x0d,0x02,ch);
lcd_disp_word(cu,0x0f,0x02,ch);
lcd_disp_word(shi,0x11+0x0c,0x02,ch);
lcd_disp_word(bo,0x13+0x0e,0x02,ch);
lcd_disp_word(qi,0x15,0x02,ch);
//delay(); */
// fun_system_init_pagtwo();
{
fun_system_init_pagone();
fun_system_init_pagtwo();
for (j=0;j<5;j++)
for(i=0;i<32;i++)
{
lcd_draw_point(0x1f*j,0x2f-i);
}
for(i=0;i<32;i++)
{
lcd_draw_point(0x00+0x1f*j+i,0x2f-i);
}
}
fun_system_init_pagtwo();
while(1);
}
sbit CD=P3^2;
sbit W=P3^0;
sbit R=P3^1; //定义各控制口
sbit RESET=P3^3; //定义各控制口
uchar code word[20]={0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff};
uchar code dis[1]={0x01};
uchar code wordtable[32] = {0x09,0x00,0x09,0x80,0x11,0x04,0x13,0xFE,0x22,0x04,0x34,0x48,0x68,0x40,0xA2,0x50,
0x23,0x48,0x22,0x48,0x24,0x44,0x24,0x46,0x28,0x44,0x21,0x40,0x20,0x80,0x00,0x00};
uchar code line1[14] = {0x20,0x40,0x08,0x20,0x08,0x20,0x02,0x00,0x03,0x00,0x20,0x40,0x3E,0x7C};
uchar code line2[14] = {0x3F,0x7E,0x06,0x30,0x49,0x30,0x49,0x30,0x02,0x00,0x10,0x40,0x22,0x44};
//--------------------------------
// word*简*
//--------------------------------
uchar code jian[32] = {0x20,0x40,0x3F,0x7E,0x28,0x90,0x45,0x08,0x90,0x00,0x09,0xFC,0x20,0x04,0x27,0xE4,
0x24,0x24,0x27,0xE4,0x24,0x24,0x24,0x24,0x27,0xE4,0x20,0x04,0x20,0x14,0x20,0x08};
//--------------------------------
// word*单*
//--------------------------------
uchar code dan[32] = {0x08,0x20,0x06,0x30,0x04,0x40,0x3F,0xF8,0x21,0x08,0x3F,0xF8,0x21,0x08,0x21,0x08,
0x3F,0xF8,0x21,0x08,0x01,0x00,0xFF,0xFE,0x01,0x00,0x01,0x00,0x01,0x00,0x01,0x00,};
//--------------------------------
// word*数*
//--------------------------------
uchar code shu[32] = {0x08,0x20,0x49,0x30,0x2A,0x20,0x1C,0x20,0xFF,0x7E,0x1C,0x44,0x2B,0x44,0x48,0xC4,
0x08,0x28,0xFF,0x28,0x12,0x10,0x34,0x10,0x0C,0x28,0x32,0x4E,0xC0,0x84,0x00,0x00};
//--------------------------------
// word*字*
//--------------------------------
uchar code zi[32] = {0x02,0x00,0x01,0x00,0x3F,0xFC,0x20,0x04,0x40,0x08,0x1F,0xE0,0x00,0x40,0x00,0x80,
0x01,0x00,0x7F,0xFE,0x01,0x00,0x01,0x00,0x01,0x00,0x01,0x00,0x05,0x00,0x02,0x00};
//
//--------------------------------
// word*存*
//--------------------------------
uchar code cun[32] = {0x03,0x00,0x02,0x00,0x7F,0xFC,0x04,0x00,0x04,0x00,0x0B,0xF8,0x18,0x10,0x10,0x20,
0x30,0x20,0x57,0xFE,0x90,0x20,0x10,0x20,0x10,0x20,0x10,0x20,0x10,0xA0,0x10,0x40};
//--------------------------------
// word*储*
//--------------------------------
uchar code cu[32] = {0x10,0x20,0x18,0x24,0x15,0xFE,0x24,0x24,0x20,0x28,0x5D,0xFE,0xA4,0x20,0x24,0x40,
0x25,0xFC,0x26,0x84,0x24,0xFC,0x24,0x84,0x25,0x84,0x2E,0xFC,0x24,0x84,0x00,0x00};
//--------------------------------
// word*示*
//--------------------------------
uchar code shi[32] = {0x00,0x00,0x1F,0xF8,0x00,0x00,0x00,0x00,0x00,0x00,0x7F,0xFE,0x01,0x00,0x01,0x00,
0x11,0x20,0x11,0x10,0x21,0x08,0x41,0x0C,0x81,0x04,0x01,0x00,0x05,0x00,0x02,0x00};
//--------------------------------
// word*波*
//--------------------------------
uchar code bo[32] = {0x20,0x40,0x10,0x40,0x10,0x40,0x07,0xFE,0x84,0x44,0x54,0x40,0x54,0x40,0x17,0xF8,
0x25,0x08,0x24,0x90,0xE4,0x90,0x24,0x60,0x28,0x60,0x28,0x98,0x31,0x0E,0x26,0x04};
//--------------------------------
// word*器*
//--------------------------------
uchar code qi[32] = {0x3E,0x7C,0x22,0x44,0x22,0x44,0x3E,0x7C,0x01,0x10,0x01,0x08,0xFF,0xFC,0x06,0xC0,
0x18,0x30,0xE0,0x0E,0x3E,0xFC,0x22,0x88,0x22,0x88,0x22,0x88,0x3E,0xF8,0x00,0x00};
//--------------------------------
// word*Bigmice*
//--------------------------------
uchar code b[16] = {0x00,0x00,0x00,0xF8,0x44,0x44,0x44,0x78,0x44,0x42,0x42,0x42,0x44,0xF8,0x00,0x00} ;
//--------------------------------
// word*i*
//--------------------------------
uchar code i[16] = {0x00,0x00,0x00,0x30,0x30,0x00,0x00,0x70,0x10,0x10,0x10,0x10,0x10,0x7C,0x00,0x00};
//--------------------------------
// word*g*
//--------------------------------
uchar code g[16] = {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x3E,0x44,0x44,0x38,0x40,0x3C,0x42,0x42,0x3C};
//--------------------------------
// word*m*
//--------------------------------
uchar code m[16] = {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFE,0x49,0x49,0x49,0x49,0x49,0xED,0x00,0x00};
//--------------------------------
// word*c*
//--------------------------------
uchar code c[16] = {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x1C,0x22,0x40,0x40,0x40,0x22,0x1C,0x00,0x00};
//--------------------------------
// word*e*
//--------------------------------
uchar code e[16] = {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x3C,0x42,0x7E,0x40,0x40,0x42,0x3C,0x00,0x00};
//fun_services.c
//****************************************//
//**** 服功能务函数 ********//
//****************************************//
void delay(uint num)
{
uint data i,j,n;
for(n=0;n
for(i=0;i<300;i++)
for(j=0;j<100;j++)
{};
}
//------------------------------------------
//**** 函数:状态检测 ********//
//------------------------------------------
void lcd_wait_state(status)
{
uint i;
P1=0xff;
do
{
R=0;
i=P1;
R=1;
}
while((i&status)!=status);
}
//------------------------------------------
//**** 函数: 参数数据写入函数 ********//
//------------------------------------------
void lcd_wrdata_par(uchar dat)
{
CD=0;
P1=dat;
W=0;
W=1;
CD=1;
}
//------------------------------------------
//**** 函数: 单命令写入函数 ********//
//------------------------------------------
void wrcmd(uchar cmd)
{
lcd_wait_state(0x03);
CD=1;
P1=cmd;
W=0;
W=1;
}
//------------------------------------------
//**** 函数: 单数据写入函数 ********//
//------------------------------------------
void wrdata(uchar dat)
{
lcd_wait_state(0x03);
CD=0;
P1=dat;
W=0;
W=1;
CD=1;
}
//------------------------------------------
//****函数: 2参个数指令写入函数 ********//
//------------------------------------------
void lcd_config_two_par(uchar d1, uchar d2, uchar cmd)
{
lcd_wait_state(0x03);
lcd_wrdata_par(d1);
lcd_wait_state(0x03);
lcd_wrdata_par(d2);
wrcmd(cmd);
}
//------------------------------------------
//****函数: 1个参数指令写入函数********//
//------------------------------------------
void lcd_config_one_par(uchar d, uchar cmd)
{
lcd_wait_state(0x03);
lcd_wrdata_par(d);
wrcmd(cmd);
}
//------------------------------------------
//****函数: 0个参数指令写入函数********//
//------------------------------------------
void lcd_config_no_par(uchar cmd)
{
wrcmd(cmd);
}
//fun_interface.c
//****************************************//
//**** 接口函数 ********//
//****************************************//
//------------------------------------------
/************** lcd 初始化 *********/
//------------------------------------------
void lcd_init(void)
{
lcd_config_two_par(0x00,0x00,0x24); //地址指针
lcd_config_two_par(0x00,0x00,0x40); //文字首地址
lcd_config_two_par(0x1e,0x00,0x41); //文字区宽度 注意进制换算 C中0x1e=汇编中30
lcd_config_two_par(0x00,0x00,0x42);
lcd_config_two_par(0x1e,0x00,0x43); //图象首地址
//lcd_config_no_par(0xa0);
lcd_config_no_par(0x98); //文字开/关 图象开/关
//lcd_config_no_par(0x80); //启用内部文字 (逻辑选择)
}
//------------------------------------------
/************** lcd 清屏 ***********/
//------------------------------------------
void lcd_clr(void)
{
uint data i,j;
lcd_config_two_par(0x00,0x00,0x24); //地址指针
lcd_config_no_par(0xb0); //数据自动写开
for(i=0;i<70;i++) //数据自动写段,文字属性
{
for(j=0;j<40;j++)
{
lcd_wait_state(0x08);
wrdata(0x00);
}
}
lcd_config_no_par(0xb2); //数据自动写关
}
void lcd_wrdat_auto(uint low,uint hight,uchar *date)
{
uchar i;
lcd_config_two_par(low,hight,0x24);
lcd_config_no_par(0xb0); //数据自动写开
i = 0;
while(date[i]!='
#define uint unsigned int
#define MAX_LINE 64
#define MAX_LINE_RAM_LENGTH 30
#define GRAPHIC_MODE 1
#define TXT_MODE 2
#define graphic_add 0x00
#define point 1
#include
#include
#include
#include
#include
#include
#include
#include
void main(void)
{
uint i,j;
P3=0xff; //P3控制口置位
RESET=0; //LCD上电复位
delay(2);
RESET=1;
delay(2);
lcd_init();
/*清全屏幕,注意文字、图形参数不同,文字图形都有时以图形为准,参数可取大些*/
lcd_clr();
lcd_config_two_par(0x00,0x00,0x24);
/*lcd_disp_word(dan,0x07,0x02,1);
lcd_disp_word(shu,0x09,0x02,ch);
lcd_disp_word(zi,0x0b,0x02,ch);
lcd_disp_word(cun,0x0d,0x02,ch);
lcd_disp_word(cu,0x0f,0x02,ch);
lcd_disp_word(shi,0x11+0x0c,0x02,ch);
lcd_disp_word(bo,0x13+0x0e,0x02,ch);
lcd_disp_word(qi,0x15,0x02,ch);
//delay(); */
// fun_system_init_pagtwo();
{
fun_system_init_pagone();
fun_system_init_pagtwo();
for (j=0;j<5;j++)
for(i=0;i<32;i++)
{
lcd_draw_point(0x1f*j,0x2f-i);
}
for(i=0;i<32;i++)
{
lcd_draw_point(0x00+0x1f*j+i,0x2f-i);
}
}
fun_system_init_pagtwo();
while(1);
}
sbit CD=P3^2;
sbit W=P3^0;
sbit R=P3^1; //定义各控制口
sbit RESET=P3^3; //定义各控制口
uchar code word[20]={0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff};
uchar code dis[1]={0x01};
uchar code wordtable[32] = {0x09,0x00,0x09,0x80,0x11,0x04,0x13,0xFE,0x22,0x04,0x34,0x48,0x68,0x40,0xA2,0x50,
0x23,0x48,0x22,0x48,0x24,0x44,0x24,0x46,0x28,0x44,0x21,0x40,0x20,0x80,0x00,0x00};
uchar code line1[14] = {0x20,0x40,0x08,0x20,0x08,0x20,0x02,0x00,0x03,0x00,0x20,0x40,0x3E,0x7C};
uchar code line2[14] = {0x3F,0x7E,0x06,0x30,0x49,0x30,0x49,0x30,0x02,0x00,0x10,0x40,0x22,0x44};
//--------------------------------
// word*简*
//--------------------------------
uchar code jian[32] = {0x20,0x40,0x3F,0x7E,0x28,0x90,0x45,0x08,0x90,0x00,0x09,0xFC,0x20,0x04,0x27,0xE4,
0x24,0x24,0x27,0xE4,0x24,0x24,0x24,0x24,0x27,0xE4,0x20,0x04,0x20,0x14,0x20,0x08};
//--------------------------------
// word*单*
//--------------------------------
uchar code dan[32] = {0x08,0x20,0x06,0x30,0x04,0x40,0x3F,0xF8,0x21,0x08,0x3F,0xF8,0x21,0x08,0x21,0x08,
0x3F,0xF8,0x21,0x08,0x01,0x00,0xFF,0xFE,0x01,0x00,0x01,0x00,0x01,0x00,0x01,0x00,};
//--------------------------------
// word*数*
//--------------------------------
uchar code shu[32] = {0x08,0x20,0x49,0x30,0x2A,0x20,0x1C,0x20,0xFF,0x7E,0x1C,0x44,0x2B,0x44,0x48,0xC4,
0x08,0x28,0xFF,0x28,0x12,0x10,0x34,0x10,0x0C,0x28,0x32,0x4E,0xC0,0x84,0x00,0x00};
//--------------------------------
// word*字*
//--------------------------------
uchar code zi[32] = {0x02,0x00,0x01,0x00,0x3F,0xFC,0x20,0x04,0x40,0x08,0x1F,0xE0,0x00,0x40,0x00,0x80,
0x01,0x00,0x7F,0xFE,0x01,0x00,0x01,0x00,0x01,0x00,0x01,0x00,0x05,0x00,0x02,0x00};
//
//--------------------------------
// word*存*
//--------------------------------
uchar code cun[32] = {0x03,0x00,0x02,0x00,0x7F,0xFC,0x04,0x00,0x04,0x00,0x0B,0xF8,0x18,0x10,0x10,0x20,
0x30,0x20,0x57,0xFE,0x90,0x20,0x10,0x20,0x10,0x20,0x10,0x20,0x10,0xA0,0x10,0x40};
//--------------------------------
// word*储*
//--------------------------------
uchar code cu[32] = {0x10,0x20,0x18,0x24,0x15,0xFE,0x24,0x24,0x20,0x28,0x5D,0xFE,0xA4,0x20,0x24,0x40,
0x25,0xFC,0x26,0x84,0x24,0xFC,0x24,0x84,0x25,0x84,0x2E,0xFC,0x24,0x84,0x00,0x00};
//--------------------------------
// word*示*
//--------------------------------
uchar code shi[32] = {0x00,0x00,0x1F,0xF8,0x00,0x00,0x00,0x00,0x00,0x00,0x7F,0xFE,0x01,0x00,0x01,0x00,
0x11,0x20,0x11,0x10,0x21,0x08,0x41,0x0C,0x81,0x04,0x01,0x00,0x05,0x00,0x02,0x00};
//--------------------------------
// word*波*
//--------------------------------
uchar code bo[32] = {0x20,0x40,0x10,0x40,0x10,0x40,0x07,0xFE,0x84,0x44,0x54,0x40,0x54,0x40,0x17,0xF8,
0x25,0x08,0x24,0x90,0xE4,0x90,0x24,0x60,0x28,0x60,0x28,0x98,0x31,0x0E,0x26,0x04};
//--------------------------------
// word*器*
//--------------------------------
uchar code qi[32] = {0x3E,0x7C,0x22,0x44,0x22,0x44,0x3E,0x7C,0x01,0x10,0x01,0x08,0xFF,0xFC,0x06,0xC0,
0x18,0x30,0xE0,0x0E,0x3E,0xFC,0x22,0x88,0x22,0x88,0x22,0x88,0x3E,0xF8,0x00,0x00};
//--------------------------------
// word*Bigmice*
//--------------------------------
uchar code b[16] = {0x00,0x00,0x00,0xF8,0x44,0x44,0x44,0x78,0x44,0x42,0x42,0x42,0x44,0xF8,0x00,0x00} ;
//--------------------------------
// word*i*
//--------------------------------
uchar code i[16] = {0x00,0x00,0x00,0x30,0x30,0x00,0x00,0x70,0x10,0x10,0x10,0x10,0x10,0x7C,0x00,0x00};
//--------------------------------
// word*g*
//--------------------------------
uchar code g[16] = {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x3E,0x44,0x44,0x38,0x40,0x3C,0x42,0x42,0x3C};
//--------------------------------
// word*m*
//--------------------------------
uchar code m[16] = {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFE,0x49,0x49,0x49,0x49,0x49,0xED,0x00,0x00};
//--------------------------------
// word*c*
//--------------------------------
uchar code c[16] = {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x1C,0x22,0x40,0x40,0x40,0x22,0x1C,0x00,0x00};
//--------------------------------
// word*e*
//--------------------------------
uchar code e[16] = {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x3C,0x42,0x7E,0x40,0x40,0x42,0x3C,0x00,0x00};
//fun_services.c
//****************************************//
//**** 服功能务函数 ********//
//****************************************//
void delay(uint num)
{
uint data i,j,n;
for(n=0;n
for(i=0;i<300;i++)
for(j=0;j<100;j++)
{};
}
//------------------------------------------
//**** 函数:状态检测 ********//
//------------------------------------------
void lcd_wait_state(status)
{
uint i;
P1=0xff;
do
{
R=0;
i=P1;
R=1;
}
while((i&status)!=status);
}
//------------------------------------------
//**** 函数: 参数数据写入函数 ********//
//------------------------------------------
void lcd_wrdata_par(uchar dat)
{
CD=0;
P1=dat;
W=0;
W=1;
CD=1;
}
//------------------------------------------
//**** 函数: 单命令写入函数 ********//
//------------------------------------------
void wrcmd(uchar cmd)
{
lcd_wait_state(0x03);
CD=1;
P1=cmd;
W=0;
W=1;
}
//------------------------------------------
//**** 函数: 单数据写入函数 ********//
//------------------------------------------
void wrdata(uchar dat)
{
lcd_wait_state(0x03);
CD=0;
P1=dat;
W=0;
W=1;
CD=1;
}
//------------------------------------------
//****函数: 2参个数指令写入函数 ********//
//------------------------------------------
void lcd_config_two_par(uchar d1, uchar d2, uchar cmd)
{
lcd_wait_state(0x03);
lcd_wrdata_par(d1);
lcd_wait_state(0x03);
lcd_wrdata_par(d2);
wrcmd(cmd);
}
//------------------------------------------
//****函数: 1个参数指令写入函数********//
//------------------------------------------
void lcd_config_one_par(uchar d, uchar cmd)
{
lcd_wait_state(0x03);
lcd_wrdata_par(d);
wrcmd(cmd);
}
//------------------------------------------
//****函数: 0个参数指令写入函数********//
//------------------------------------------
void lcd_config_no_par(uchar cmd)
{
wrcmd(cmd);
}
//fun_interface.c
//****************************************//
//**** 接口函数 ********//
//****************************************//
//------------------------------------------
/************** lcd 初始化 *********/
//------------------------------------------
void lcd_init(void)
{
lcd_config_two_par(0x00,0x00,0x24); //地址指针
lcd_config_two_par(0x00,0x00,0x40); //文字首地址
lcd_config_two_par(0x1e,0x00,0x41); //文字区宽度 注意进制换算 C中0x1e=汇编中30
lcd_config_two_par(0x00,0x00,0x42);
lcd_config_two_par(0x1e,0x00,0x43); //图象首地址
//lcd_config_no_par(0xa0);
lcd_config_no_par(0x98); //文字开/关 图象开/关
//lcd_config_no_par(0x80); //启用内部文字 (逻辑选择)
}
//------------------------------------------
/************** lcd 清屏 ***********/
//------------------------------------------
void lcd_clr(void)
{
uint data i,j;
lcd_config_two_par(0x00,0x00,0x24); //地址指针
lcd_config_no_par(0xb0); //数据自动写开
for(i=0;i<70;i++) //数据自动写段,文字属性
{
for(j=0;j<40;j++)
{
lcd_wait_state(0x08);
wrdata(0x00);
}
}
lcd_config_no_par(0xb2); //数据自动写关
}
void lcd_wrdat_auto(uint low,uint hight,uchar *date)
{
uchar i;
lcd_config_two_par(low,hight,0x24);
lcd_config_no_par(0xb0); //数据自动写开
i = 0;
while(date[i]!='
深圳市兴威帆电子技术有限公司
2023-08-24 广告
2023-08-24 广告
实时时钟模块可以选择许多不同的制造商和型号,具体选择取决于您的应用需求和预算。一些流行的实时时钟模块品牌包括DS1302、MA电商平台6925和MCP7941。这些模块都具有精度高、稳定性好、功耗低等优点,并具有不同的功能和特性,可以满足各...
点击进入详情页
本回答由深圳市兴威帆电子技术有限公司提供
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询