51单片机控制液晶12864源代码

发布者:legend9最新更新时间:2016-10-23 来源: eefocus关键字:51单片机  控制液晶 手机看文章 扫描二维码
随时随地手机看文章
/********************************************/

/* AM12864系列测试程序 1.0 */
/* Designed by Andorin LCM R&D Group */
/* 2003.04.23 */
/********************************************/

#include
#include
#include
#include
#include
#include
/********************************************/
/* AM12864系列测试程序 1.0 */
/* Designed by Andorin LCM R&D Group */
/* 2003.04.23 */
/********************************************/


/* Define the register command code */
#define Disp_On 0x3f
#define Disp_Off 0x3e
#define Col_Add 0x40
#define Page_Add 0xb8
#define Start_Line 0xc0

#define Lcd_Bus P1 //MCU P1<------> LCM

sbit Mcs=P3^3; //Master chip enable
sbit Scs=P3^4; //Slave chip enable
sbit Enable=P3^0; //6800 mode Enable single
sbit Di=P3^5; //Data or Instrument Select
sbit RW=P3^6; //Write or Read
sbit Lcd_Rst=P3^2; //Lcm reset
sbit Test_Key=P3^1;


char code ce[]={
/*-- 文字: 测 --*/
/*-- 宋体12; 此字体下对应的点阵为:宽x高=16x16 --*/
0x08,0x31,0x86,0x60,0x00,0xFE,0x02,0xF2,0x02,0xFE,0x00,0xF8,0x00,0x00,0xFF,0x00,
0x04,0xFC,0x03,0x00,0x80,0x47,0x30,0x0F,0x10,0x67,0x00,0x07,0x40,0x80,0x7F,0x00
};
char code shi[]={
/*-- 文字: 试 --*/
/*-- 宋体12; 此字体下对应的点阵为:宽x高=16x16 --*/
0x40,0x42,0xDC,0x08,0x00,0x90,0x90,0x90,0x90,0x90,0xFF,0x10,0x12,0x1C,0x10,0x00,
0x00,0x00,0x7F,0x20,0x10,0x20,0x20,0x1F,0x10,0x10,0x01,0x06,0x18,0x20,0x78,0x00
};
char code kai[]={
/*-- 文字: 开 --*/
/*-- 宋体12; 此字体下对应的点阵为:宽x高=16x16 --*/
0x40,0x42,0x42,0x42,0x42,0xFE,0x42,0x42,0x42,0x42,0xFE,0x42,0x42,0x42,0x42,0x00,
0x00,0x40,0x20,0x10,0x0C,0x03,0x00,0x00,0x00,0x00,0x7F,0x00,0x00,0x00,0x00,0x00
};
char code shi3[]={
/*-- 文字: 始 --*/
/*-- 宋体12; 此字体下对应的点阵为:宽x高=16x16 --*/
0x10,0x90,0x70,0x1F,0x12,0xF0,0x00,0x20,0x70,0x28,0x27,0x22,0x28,0x70,0x20,0x00,
0x40,0x21,0x12,0x0C,0x06,0x09,0x30,0x00,0x7F,0x21,0x21,0x21,0x21,0x7F,0x00,0x00
};

char code wan[]={
/*-- 文字: 完 --*/
/*-- 宋体12; 此字体下对应的点阵为:宽x高=16x16 --*/
0x00,0x90,0x8C,0xA4,0xA4,0xA4,0xA5,0xA6,0xA4,0xA4,0xA4,0xA4,0x94,0x8C,0x04,0x00,
0x00,0x80,0x40,0x20,0x18,0x07,0x00,0x00,0x00,0x3F,0x40,0x40,0x40,0x70,0x00,0x00
};
char code bi[]={
/*-- 文字: 毕 --*/
/*-- 宋体12; 此字体下对应的点阵为:宽x高=16x16 --*/
0x00,0x00,0xFF,0x88,0x48,0x28,0x08,0x80,0x7F,0x88,0x88,0x88,0x84,0x84,0xE0,0x00,
0x04,0x04,0x04,0x04,0x04,0x04,0x04,0xFF,0x04,0x04,0x04,0x04,0x04,0x04,0x04,0x00
};


/* AM12864B系列测试首页显示内容 */
/*****************/
/* ANDORIN */
/* 安的利光电科技*/
/* AM12864 */
/* 测试程序 1.0 */
/*****************/

unsigned char code FirstPage[]={
/*-- 调入了一幅图像:\\Andorin-server\开发部\arin\12864.bmp --*/
/*-- 宽度x高度=128x64 --*/
0x00,0x00,0x00,0x80,0xF0,0xFE,0x7E,0x0E,0x7E,0xFE,0xF0,0x80,0x00,0x00,0x00,0x00,
0xFE,0xFE,0xFE,0x3C,0xF0,0xE0,0x80,0x00,0x00,0xFE,0xFE,0xFE,0x00,0x00,0x00,0xFE,
0xFE,0xFE,0x0E,0x0E,0x0E,0x0E,0x0E,0x3E,0xFC,0xF8,0xE0,0x00,0x00,0xE0,0xF8,0xFC,
0x3C,0x1E,0x0E,0x0E,0x0E,0x0E,0x1E,0x3C,0xFC,0xF8,0xE0,0x00,0x00,0x00,0xFE,0xFE,
0xFE,0x8E,0x8E,0x8E,0x8E,0x8E,0xFE,0xFC,0xF8,0x00,0x00,0x00,0xFE,0xFE,0xFE,0x00,
0x00,0xFE,0xFE,0xFE,0x3C,0xF0,0xE0,0x80,0x00,0x00,0xFE,0xFE,0xFE,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x80,0xF0,0xFE,0x7F,0x1F,0x1D,0x1C,0x1C,0x1C,0x1D,0x1F,0x7F,0xFE,0xF0,0x80,0x00,
0xFF,0xFF,0xFF,0x00,0x00,0x03,0x0F,0x3E,0x78,0xFF,0xFF,0xFF,0x00,0x00,0x00,0xFF,
0xFF,0xFF,0xE0,0xE0,0xE0,0xE0,0xE0,0x70,0x7F,0x3F,0x0F,0x00,0x00,0x0F,0x3F,0x7F,
0x78,0xF0,0xE0,0xE0,0xE0,0xE0,0xF0,0x78,0x7F,0x3F,0x0F,0x00,0x00,0x00,0xFF,0xFF,
0xFF,0x03,0x03,0x03,0x0F,0x1F,0x7D,0xF9,0xE0,0x80,0x00,0x00,0xFF,0xFF,0xFF,0x00,
0x00,0xFF,0xFF,0xFF,0x00,0x00,0x03,0x0F,0x3E,0x78,0xFF,0xFF,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,0x40,0x30,0x10,0x10,0x10,0xD0,0x12,0x1C,0x10,0x10,0x10,0x10,0x50,
0x30,0x00,0x00,0x00,0x00,0xF0,0x10,0x18,0x16,0x10,0xF0,0x80,0x40,0x30,0x1E,0x10,
0x10,0x10,0xF8,0x10,0x00,0x00,0x40,0x48,0x48,0x48,0xC8,0xF8,0x44,0x46,0x44,0x40,
0x00,0xF8,0x00,0x00,0xFE,0x00,0x00,0x00,0x00,0x00,0x00,0x08,0x10,0x60,0x00,0x00,
0xFE,0x00,0x80,0x60,0x18,0x00,0x80,0x00,0x00,0x00,0x00,0x00,0xF0,0x10,0x10,0x10,
0x10,0xFE,0x10,0x10,0x10,0x10,0x10,0xF8,0x10,0x00,0x00,0x00,0x48,0x48,0x48,0x44,
0xFC,0x42,0x42,0x40,0x80,0x08,0x30,0x00,0x00,0xFE,0x00,0x00,0x00,0x00,0x20,0x20,
0x20,0xFE,0x20,0x20,0x00,0x20,0x20,0x20,0xFE,0x20,0x20,0x20,0x30,0x20,0x00,0x00,
0x00,0x00,0x01,0x01,0x01,0x01,0x09,0x8F,0x91,0x51,0x21,0x21,0x59,0x47,0x81,0x81,
0x81,0x01,0x00,0x00,0x00,0xFF,0x42,0x42,0x42,0x42,0xFF,0x00,0x00,0x01,0x0E,0x80,
0x00,0x80,0x7F,0x00,0x00,0x00,0x20,0x10,0x08,0x06,0x01,0xFF,0x01,0x02,0x0C,0x00,
0x00,0x1F,0x80,0x00,0xFF,0x00,0x00,0x00,0x01,0x01,0x01,0x81,0x41,0x3F,0x01,0x01,
0x01,0xFF,0x01,0x01,0x01,0x01,0x01,0xF1,0x00,0x00,0x00,0x00,0x1F,0x09,0x09,0x09,
0x09,0xFF,0x09,0x09,0x09,0x09,0x09,0x1F,0xC0,0x00,0x00,0x00,0x10,0x08,0x04,0x03,
0xFF,0x01,0x06,0x10,0x10,0x13,0x08,0x08,0x08,0xFF,0x04,0x04,0x00,0x00,0x04,0x84,
0x02,0xFF,0x01,0x01,0x00,0x81,0x87,0x59,0x21,0x51,0x4D,0x83,0x81,0x80,0x00,0x00,
0x00,0x00,0x00,0x01,0x01,0x01,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x01,0x00,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x80,0xF1,0x7C,0x0C,0x7C,0xF0,0x80,
0x01,0x00,0x00,0xFC,0xFC,0x3C,0xF8,0xC0,0x00,0x00,0x00,0xC1,0xF8,0x3C,0xFC,0xFC,
0x00,0x00,0x00,0x61,0x30,0x18,0xFC,0xFC,0x01,0x01,0x01,0x00,0x30,0x38,0x1C,0x0C,
0x0C,0x1C,0xF9,0xF1,0x01,0x01,0x71,0xF9,0x8C,0x8C,0x8C,0x8C,0xF8,0x70,0x00,0x00,
0xE0,0xF8,0x1D,0x8D,0x8D,0x8D,0x19,0x11,0x01,0x00,0x00,0xC0,0xE0,0x38,0xFC,0xFC,
0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x00,0x00,0x00,
0x01,0x00,0x00,0x01,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x60,0x7C,0x1F,0x07,0x06,0x06,0x06,0x07,0x1F,
0x7C,0x60,0x00,0x7F,0x7F,0x00,0x01,0x1F,0x7C,0x60,0x7C,0x1F,0x01,0x00,0x7F,0x7F,
0x00,0x00,0x00,0x00,0x00,0x00,0x7F,0x7F,0x00,0x00,0x00,0x00,0x60,0x70,0x78,0x6C,
0x66,0x63,0x61,0x60,0x00,0x00,0x1E,0x3F,0x61,0x61,0x61,0x61,0x3F,0x1E,0x00,0x00,
0x0F,0x3F,0x73,0x61,0x61,0x61,0x3F,0x1E,0x00,0x0E,0x0F,0x0D,0x0C,0x0C,0x7F,0x7F,
0x0C,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,0x10,0x61,0x06,0xC0,
0x00,0xFE,0x02,0xF2,0x02,0xFE,0x00,0x00,0xF8,0x00,0xFF,0x00,0x00,0x00,0x80,0x82,
0x84,0x8C,0x00,0x10,0x90,0x90,0x90,0x90,0x90,0xFF,0x10,0x12,0x14,0x10,0x00,0x00,
0x24,0x24,0xA4,0xFE,0xA2,0x23,0x22,0x80,0xBE,0xA2,0xA2,0xA2,0xA2,0xA2,0xBF,0x82,
0x00,0x00,0x00,0x00,0xFC,0x04,0x14,0x14,0x14,0x15,0x56,0x94,0x54,0x34,0x14,0x14,
0x06,0x04,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x60,0x30,0x18,0xFC,0xFC,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xF0,0xF8,0x1C,0x0C,0x0C,0x1C,0xF8,0xF0,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x08,0x08,0x7E,0x81,
0x40,0x27,0x10,0x0F,0x10,0x67,0x00,0x00,0x4F,0x80,0x7F,0x00,0x00,0x00,0x00,0x00,
0x00,0x7F,0x20,0x10,0x20,0x60,0x3F,0x10,0x10,0x03,0x1C,0x20,0x40,0xF0,0x00,0x00,
0x10,0x0E,0x01,0xFF,0x00,0x03,0x80,0x88,0x88,0x88,0x88,0xFF,0x88,0x88,0x88,0xC8,
0x80,0x00,0x80,0x60,0x1F,0x00,0x01,0x01,0x01,0x41,0x81,0x7F,0x01,0x01,0x01,0x05,
0x03,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7F,0x7F,0x00,
0x00,0x00,0x00,0x00,0x60,0x60,0x00,0x00,0x1F,0x3F,0x70,0x60,0x60,0x70,0x3F,0x1F,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00
};

/*------------------延时子程序-----------------------------*/
void delay(unsigned int t)
{
unsigned int i,j;
for(i=0;i for(j=0;j<10;j++)
;
}

/*------------------写命令到LCD------------------------------*/
void write_com(unsigned char cmdcode)
{

Di=0;
RW=0;

Lcd_Bus=cmdcode;
delay(0);
Enable=1;
delay(0);
Enable=0;
}

/*-------------------写数据到LCD----------------------------*/

void write_data(unsigned char Dispdata)
{

Di=1;
RW=0;

Lcd_Bus=Dispdata;
delay(0);
Enable=1;
delay(0);
Enable=0;
}

/*-------------------读LCD数据----------------------------*/

unsigned char read_data()
{
unsigned char tmpin;

Di=1;
RW=1;
delay(0);
Enable=1;
delay(0);
Enable=0;

tmpin=Lcd_Bus;

return tmpin;
}

 

/*------------------显示边框-------------------------------*/
void frame()
{
unsigned char i;
Mcs=1;
Scs=1;
write_com(Page_Add+0);
write_com(Col_Add+0);
for(i=0;i<64;i++) write_data(0x01);
write_com(Page_Add+7);
write_com(Col_Add+0);
for(i=0;i<64;i++) write_data(0x80);

for(i=0;i<8;i++)

{
Mcs=0;
Scs=1;
write_com(Page_Add+i);
write_com(Col_Add+63);
write_data(0xff);
Mcs=1;
Scs=0;
write_com(Page_Add+i);
write_com(Col_Add+0);
write_data(0xff);
}
}

 

/*------------------清除内存---------------*/
void Clr_Scr()
{
unsigned char j,k;
Mcs=1;Scs=1;
write_com(Page_Add+0);
write_com(Col_Add+0);

for(k=0;k<8;k++){
write_com(Page_Add+k);
for(j=0;j<64;j++)write_data(0x00);
}
}

/*------------------显示12864图片---------------------------*/
void Disp_Img(unsigned char code *img)
{
unsigned char j,k;
for(k=0;k<8;k++){
Mcs=1;Scs=0;delay(10);
write_com(Page_Add+k);
write_com(Col_Add+0);
for(j=0;j<64;j++) write_data(img[k*128+j]);
Mcs=0;Scs=1; delay(10);
write_com(Page_Add+k);
write_com(Col_Add+0);
for(j=64;j<128;j++) write_data(img[k*128+j]);
}
}

/*------------------显示横---------------------------*/
void Disp_H_Line()
{
unsigned char i,j;
Mcs=1;
Scs=1;
write_com(Disp_On);
write_com(Page_Add);
write_com(Start_Line);
write_com(Col_Add);

for(j=0;j<8;j++)
{
write_com(Page_Add+j);
write_com(Col_Add+0);
// write_com(Start_Line+0);
for(i=0;i<64;i++)write_data(0x55);
}
}


/*------------------显示列-----------------------------*/
void Disp_V_Line()
{
unsigned char i,j;
write_com(Disp_On);
write_com(Page_Add);
write_com(Start_Line);
write_com(Col_Add);

for(j=0;j<8;j++)
{
write_com(Page_Add+j);
write_com(Col_Add+0);
write_com(Start_Line+0);
for(i=0;i<32;i++)
{
write_data(0x00);
write_data(0xff);
}

}
}

/*------------------棋盘-----------------------------*/
void Disp_Cross_Line(unsigned char mode)
{
unsigned char i,j;
unsigned char data1,data2;
if(mode==0) {data1=0xaa;data2=0x55;}
else if(mode==1) {data1=0x55;data2=0xaa;}
else return;
Mcs=1;Scs=1;
write_com(Disp_On);
write_com(Page_Add);
write_com(Start_Line);
write_com(Col_Add);
for(j=0;j<8;j++)
{
write_com(Page_Add+j);
write_com(Col_Add+0);
write_com(Start_Line+0);
for(i=0;i<32;i++){
write_data(data1);
write_data(data2);
}
}
}


/*---------------------指定位置显示汉字16*16-----------------------*/

void hz_disp16(unsigned char pag,unsigned char col, unsigned char code *hzk)
{
unsigned char j=0,i=0;
for(j=0;j<2;j++){
write_com(Page_Add+pag+j);
write_com(Col_Add+col);
for(i=0;i<16;i++) write_data(hzk[16*j+i]);
}
}


/*------------------初始化LCD屏--------------------------*/
void init_lcd()
{
Lcd_Rst=0;
delay(100);
Lcd_Rst=1;
delay(100);

Mcs=1;
Scs=1;

delay(100);
write_com(Disp_Off);
write_com(Page_Add+0);
write_com(Start_Line+0);
write_com(Col_Add+0);
write_com(Disp_On);
}


/*------------------------------信息显示------------------------*/
void Msg(int flg)
{
Clr_Scr();
frame();
if(flg==0){ //显示“测试开始”
Mcs=1;Scs=0;
hz_disp16(3,32,ce);
delay(2000);
hz_disp16(3,48,shi);
delay(2000);
Mcs=0;Scs=1;
hz_disp16(3,0,kai);
delay(2000);
hz_disp16(3,16,shi3);
delay(2000);
}
else if(flg==1){ //显示“测试完毕”
Mcs=1;Scs=0;
hz_disp16(3,32,ce);
hz_disp16(3,48,shi);
Mcs=0;Scs=1;
hz_disp16(3,0,wan);
hz_disp16(3,16,bi); 
}
}


/*--------------------------------键盘扫描-------------------------*/
void Key_Scan()
{
while(Test_Key);
while(~Test_Key);
}


/*--------------------主程序---------------------------------*/


main()
{
unsigned char i=0;
while(1){
// Key_Scan();
init_lcd();
Disp_Img(FirstPage);
delay(10000);
// Key_Scan();
Msg(0);
delay(10000);
Disp_H_Line();
delay(10000);
Disp_V_Line();
delay(10000);
Msg(1); 
delay(10000);
}
}

关键字:51单片机  控制液晶 引用地址:51单片机控制液晶12864源代码

上一篇:8051中断定时器及串行口初始化
下一篇:VB实现PC与单片机串口通信

推荐阅读最新更新时间:2024-03-16 15:16

51单片机入门 - IIC(I2C)总线
UART 属于异步通信,比如电脑发送给单片机,电脑只负责把数据通过TXD 发送出来即可,接收数据是单片机自己的事情。而 I2C 属于同步通信, SCL 时钟线负责收发双方的时钟节拍, SDA 数据线负责传输数据。 I2C 的发送方和接收方都以 SCL 这个时钟节拍为基准进行数据的发送和接收。 I2C总线包括SCL,SDA 两根信号线,其中SCL是时钟线,SDA是数据线。 1、起始信号 UART 通信是从一直持续的高电平出现一个低电平标志起始位;而 I2C 通信的起始信号的定义是 SCL 为高电平期间, SDA 由高电平向低电平变化产生一个下降沿,表示起始信号。 2、数据传 UART 是低位在前,高位在后;而
[单片机]
<font color='red'>51单片机</font>入门 - IIC(I2C)总线
AT89C51单片机在LED显示屏控制电路设计中的应用
LED显示屏又叫电子显示屏,是由LED点阵组成,通过红色或绿色灯珠的亮灭来显示文字、图片、动画、视频,内容可以随时更换,通常由显示模块、控制系统及电源系统组成。显示模块由LED灯组成的点阵构成,负责发光显示;控制系统通过控制相应区域的亮灭,可以让屏幕显示文字、图片、视频等内容,恒舞动卡主要是播放动画的;电源系统负责将输入电压电流转为显示屏需要的电压电流。 LED显示屏广泛应用于信息指示灯,大屏幕显示,液晶显示的背光灯,固体照明等。本文设计一种由4个16×16点阵LED模块组成的显示屏,由单片机作控制器,平滑移动显示任意多个文字或图形符号,本电路可级联扩展实现由任意多个16×16点阵LED模块组成的显示屏。 一、控制电路设计 控制电
[电源管理]
AT89C<font color='red'>51单片机</font>在LED显示屏<font color='red'>控制</font>电路设计中的应用
51单片机秒表精确计时
#include REG51.H #include intrins.h #define uint unsigned int #define uchar unsigned char uint second ; code unsigned char table ={0x3f,0x06,0x5b,0x4f,0x66,0x6d,0x7d,0x07,0x7f,0x6f,0x00}; uchar code DIS_BIT ={0xff,0xfe,0xfd,0xfc,0xfb,0xfa,0xf9,0xf8}; uchar count=0; /*void delay(int j) //delay 1 ms { uchar i; while(j-
[单片机]
8051单片机(STC89C52)八段数码管稳定显示0 ~ 7
在轮流显示0~7程序的基础上, 将delay()函数提供的时延大幅缩小, 以达到视觉短暂的停留效果. 在该种情况下的数码管亮度和对比度较轮流显示时有一定幅度的降低. 另外, 如果想感知到动态扫描的存在, 可从拍摄视频中观察(到像波浪一样的光浪). #include STC89C5xRC.H void delay()//提供时延 { int i, j; for(i = 0; i 15 ; i++) for(j = 0; j 15; j++) ; } void f1_3_4_3()//在8个数码管上轮流显示0~7 { unsigned char code DIG_CODE = {0x3f, 0x06, 0x5b
[单片机]
51单片机(入门保姆级教程)——LED闪烁及流水灯
一、LED基本原理和知识 图1 LED共阳极原理图 1.1 LED共阴极和共阳极的含义 LED的最小单元是发光二极管。发光二极管是区分正负极的,正向导通,反向截止。共阴极就是发光二极管的负极连接在一起,共阳极就是发光二极管的正极连接在一起。 1.2 共阴极和共阳极的区别 耗能不一样。共阳极二极管的公共端接在高电平,需要高电平时时刻刻处在工作状态;而共阴极二极管公共端接低(GND),只需指定二极管工作时给某个二极管高电平即可,有效降低了功耗,对长时间工作LED来言有效降低了屏热。 线路复杂程度不同。一般在实际工程中共阴极二极管比共阳极二极管的线路复杂,共阳极不需要那么多的高电平线路驱动。 二、单个LED的闪烁 2.1 KEI
[单片机]
51单片机-多文件编写
为了与主流的编程素养接轨,我们本章讲解如何书写简洁并且高效率的代码以及首次运用多文件编程。多文件的作用是方便编写大程序时更加的模块化,那么至于原理,头文件包含关系等这些知识还需读者自己再多多补补C语言知识了。 1.多文件的优势 运用多文件编程是为了使我们教程无需每次都贴出相同功能的代码,像第一阶段最后的一个例程,已经有很多代码完全可以前往以前的例程里复制即可,笔者也是考虑到一开始我们都是从单个“.c”文件入门单片机编程,所以之前的例程都是提供完整的代码给大家方便复制移植到自己的单个“.c”工程文件中。 可后期的例程里我们的代码量越来越大,显然全部给出就不合适了,所以我们把经常使用的功能模块代码封装起来放在另一个“.c”文件
[单片机]
<font color='red'>51单片机</font>-多文件编写
51单片机lcd1602
{ Uchar i; for (i=0;i 16;i++) { DispOneChar(i,1,dd++); dd &= 0x7f; if (dd 32) dd=32; } } // 显示光标定位 void LocateXY( char posx,char posy) { Uchar temp; temp = posx & 0xf; posy &= 0x1; if ( posy )temp |= 0x40; temp |= 0x80; LcdWriteCommand(temp,0); } // 按指定位置显示数出一个字符 void DispOneChar(Uchar x,Uchar y,Uchar Wd
[单片机]
基于nRF905模块和51单片机的无线收发系统设计
前言 在闭环钻井系统中,要求实时地把井下的信息传递到地面,以实施人工监控。通常情况下该任务由MWD中泥浆压力脉冲发生器来完成。当使用井下动力钻具组合时,近钻头传感器和MWD被动力钻具隔开。传感器无法用线缆与MWD连接,因此要把传感器的信息传送给MWD只能通过无线通信的方法。 本文设计了由C8051F0606单片机和nRF905无线射频器收发组成的一种无线数据传输系统的方案。该系统由发射和接收模块组成,发射模块主要将要发送的数据经单片机处理后,通过nRF905发送出去;在接收模块中,nRF905则将数据正确接收后通过上位机界面显示出来,从而实现短距离井下的无线通信。 无线收发系统硬件设计 nRF905模块简介 nRF905是Nord
[单片机]
基于nRF905模块和<font color='red'>51单片机</font>的无线收发系统设计
小广播
添点儿料...
无论热点新闻、行业分析、技术干货……
设计资源 培训 开发板 精华推荐

最新单片机文章
何立民专栏 单片机及嵌入式宝典

北京航空航天大学教授,20余年来致力于单片机与嵌入式系统推广工作。

换一换 更多 相关热搜器件
电子工程世界版权所有 京B2-20211791 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号 Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved