基于单片机的温湿度传感器课程设计 联系客服

发布时间 : 星期五 文章基于单片机的温湿度传感器课程设计更新完毕开始阅读44c9aecd70fe910ef12d2af90242a8956becaaa0

页 共 17 页 桂林电子科技大学课程设计(论文)报告用纸 第 17 第14页共23

0x22,0x44,0x00,0xC0,0x5F,0xD5,0x55,0xD5,0x5F,0xC0,0x00,0x00,0x04,0x02,0x

09,0x0F,

0x08,0x0F,0x08,0x0F,0x08,0x0F,0x08,0x00,/*\温\

0x11,0x22,0x80,0x3E,0x2A,0xEA,0x2A,0xEA,0x2A,0x3E,0x80,0x00,0x04,0x02,0x08,0x09,

0x08,0x0F,0x08,0x0F,0x08,0x09,0x08,0x00,/*\湿\

0x00,0xFE,0x0A,0x8A,0xBE,0xAA,0xAB,0xAA,0xBE,0x8A,0x0A,0x00,0x08,0x07,0x00,0x08,

0x09,0x0A,0x04,0x04,0x0A,0x09,0x08,0x00,/*\度\

0x20,0x10,0xFC,0x23,0x24,0xE4,0xBC,0xA7,0xA4,0xA4,0x20,0x00,0x00,0x00,0x0F,0x00,

0x00,0x02,0x02,0x04,0x06,0x09,0x00,0x00,/*\传\

0x00,0xFE,0x02,0xEA,0xAA,0xEA,0x02,0x9F,0x62,0x9B,0xC2,0x00,0x09,0x06,0x00,0x06,

0x08,0x0A,0x0D,0x08,0x0C,0x02,0x0D,0x00,/*\感\

0x20,0x27,0xA5,0xA5,0x67,0x38,0x67,0xA5,0xAD,0x37,0x20,0x00,0x01,0x0F,0x0A,0x0A,

0x0E,0x00,0x0E,0x0A,0x0A,0x0F,0x01,0x00,/*\器\

0x00,0x88,0x48,0xE8,0x98,0xFE,0x88,0x98,0xA8,0x48,0xC8,0x00,0x00,0x08,0x08,0x08,

0xC8,0x7C,0x0A,0x09,0x09,0x08,0x08,0x00,/*\李\

0x00,0xB0,0xAC,0xA6,0xA8,0xB0,0x20,0x7E,0x48,0x48,0x64,0x00,0x00,0xFF,0x12,0x12,

0xD2,0x7F,0x00,0x7F,0x44,0x46,0x62,0x00,/*\能\

0x00,0x60,0x10,0x4C,0x46,0x48,0x10,0x00,0xF8,0x00,0xFE,0x00,0x00,0x43,0x4C,0x63,

0x24,0x3E,0x21,0x00,0x0F,0xC0,0x7F,0x00,/*\剑\

0x00,0x30,0x48,0x30,0xE0,0x10,0x10,0x08,0x10,0x30,0x00,0x00,0x00,0x00,0x00,0x00,

0x1F,0x30,0x20,0x20,0x20,0x10,0x00,0x00,/*\℃\

0x00,0x00,0xF8,0x88,0x78,0x00,0x80,0x60,0x10,0x08,0x00,0x00,0x00,0x00,0x20,0x18,

0x04,0x03,0x00,0x1E,0x22,0x3E,0x00,0x00,/*\%\

0x00,0x70,0x34,0xB8,0xB0,0xBE,0xB0,0xB0,0xBC,0x32,0x70,0x00,0x00,0x08,0x08,0x08,

0xC8,0xC8,0x7E,0x0B,0x09,0x08,0x08,0x00,/*\学\

0x00,0x80,0x80,0xBC,0xA4,0xA4,0xA4,0xA4,0xBC,0x80,0x80,0x00,0x00,0x00,0x00,0x06,

0x05,0x04,0xC4,0x44,0x74,0x0C,0x00,0x00,/*\号\

0x00,0x20,0xFC,0x22,0xE0,0x60,0x1C,0x10,0xFE,0x10,0x10,0x00,0x00,0x43,0x

桂林电子科技大学课程设计(论文)报告用纸

第第 18 15 页页 共共 18 23 页

34,0x1F,

0x30,0x43,0x43,0x43,0x7F,0x43,0x43,0x40,/*\姓\

0x00,0x00,0x20,0x18,0x6E,0xC8,0x88,0x68,0x38,0x08,0x00,0x00,0x00,0x04,0x04,0xFE,

0x22,0x23,0x22,0x22,0x22,0xFE,0x00,0x00,/*\名\ };

unsigned char code zimu[]={

/*-- 宋体9; 此字体下对应的点阵为:宽x高=6x12 --*/ /*-- 高度不是8的倍数,现调整为:宽度x高度=6x16 --*/

0x00,0xF0,0x18,0x08,0x18,0xF0,0x01,0x1F,0x30,0x20,0x30,0x1F,/*\0x00,0x20,0x20,0xF8,0x00,0x00,0x00,0x00,0x00,0x3F,0x00,0x00,/*\0x00,0x70,0x18,0x08,0x98,0xF0,0x00,0x38,0x2C,0x26,0x23,0x20,/*\0x00,0x30,0x18,0x08,0x98,0xF0,0x0C,0x1C,0x30,0x21,0x31,0x1E,/*\0x00,0x00,0xC0,0x30,0xF8,0x00,0x04,0x07,0x04,0x04,0x3F,0x04,/*\0x00,0xF8,0x88,0xC8,0x88,0x88,0x00,0x19,0x30,0x20,0x30,0x1F,/*\0x00,0xE0,0x98,0x88,0x98,0x30,0x00,0x1F,0x31,0x20,0x30,0x1F,/*\0x00,0x08,0x08,0x08,0xC8,0x78,0x00,0x00,0x20,0x3E,0x03,0x00,/*\0x00,0xF0,0x98,0x08,0x98,0xF0,0x00,0x1E,0x31,0x21,0x31,0x1E,/*\0x00,0xF0,0x18,0x08,0x18,0xF0,0x00,0x19,0x33,0x22,0x31,0x0F,/*\0x00,0x00,0x80,0x00,0x00,0x00,0x00,0x00,0x31,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,/*\

0x08,0xF8,0x08,0x08,0xF0,0x00,0x00,0x3F,0x01,0x0F,0x30,0x00,/*\0x08,0xF8,0x00,0x00,0xF8,0x08,0x00,0x3F,0x01,0x01,0x3F,0x00,/*\ };

void delay_ms(unsigned char t) {

unsigned char i,j; for(i=0;i

void delay_us(unsigned char t) {

unsigned char j; for(j=0;j

页 共 19 页 桂林电子科技大学课程设计(论文)报告用纸 第 19 第16页共23

/*

LCD_write_byte: 使用SPI接口写数据到LCD 输入参数:dt:写入的数据; command :写数据/命令选择; */

void LCD_write_byte(unsigned char dt, unsigned char command) { unsigned char i; sce=0; if(command==1) {dc=1; } else

{ dc=0; } for(i=0;i<8;i++) { if(dt&0x80) {sdin=1;} else

{sdin=0;} dt=dt<<1; sclk=0; sclk=1; }

delay_ms(1); dc=1; sce=1; //sdin=1; }

//LCD_init: 3310LCD初始化

void LCD_init(void) { res=0;

delay_ms(1); res=1; LCD_write_byte(0x21,0);//初始化Lcd,功能设定使用扩充指令 LCD_write_byte(0xd0,0);//设定液晶偏置电压 LCD_write_byte(0x20,0);//使用基本指令 LCD_write_byte(0x0C,0);//设定显示模式,正常显示 }

桂林电子科技大学课程设计(论文)报告用纸

第第 20 17页 共 20 23 页

//LCD_set_XY: 设置LCD坐标函数

//输入参数:X:0-83 Y:0-5

void LCD_set_XY(unsigned char X, unsigned char Y) { LCD_write_byte(0x40 | Y, 0);// column LCD_write_byte(0x80 | X, 0);// row }

//LCD_clear: LCD清屏函数

void LCD_clear(void) { unsigned char t; unsigned char k; LCD_set_XY(0,0); for(t=0;t<6;t++) { for(k=0;k<84;k++) { LCD_write_byte(0x00,1); } } } /*

LCD_write_shu: 显示8(宽)*16(高)点阵列数字字母符号等半角类 输入参数:c:显示的字符; */

void Display_zimu(unsigned char row, unsigned char page,unsigned char c) //row:列 page:页 dd:字符 { unsigned char i; LCD_set_XY(row*6, page);// 列,页 for(i=0; i<6;i++) { LCD_write_byte(zimu[c*12+i],1); }

LCD_set_XY(row*6, page+1);// 列,页 for(i=6; i<12;i++) { LCD_write_byte(zimu[c*12+i],1); }