蓝桥杯单片机各个模块
清纯献给了作业
出于热爱,忠于完美。
展开
-
实时时钟DS1302的基本操作
#include "reg52.h" #include "intrins.h"sbit HC138_A = P2^5; sbit HC138_B = P2^6; sbit HC138_C = P2^7; sbit SCLK = P1^7;sbit RST = P1^3;sbit DSIO = P2^3;unsigned char code READ_RTC_ADDR[7] = {0x81, 0x83, 0x85, 0x87, .原创 2021-04-20 20:23:37 · 172 阅读 · 0 评论 -
单总线温度传感器DS18B20的基本操作
#include<reg52.h>#include<onewire.h>#define uint unsigned intunsigned int temp=0;unsigned char SMG_No_Dot[10]={0xc0,0xf9,0xa4,0xb0,0x99,0x92,0x82,0xf8,0x80,0x90};unsigned char SMG_Dot[10]={0x40,0x79,0x24,0x30,0x19,0x12,0x02,0x78,0x00.原创 2021-04-20 20:23:20 · 335 阅读 · 0 评论 -
串行接口的进阶与实战应用
#include<reg52.h>#define uint unsigned intsfr AUXR=0x8e;unsigned int count=0;unsigned char num[4];unsigned int flag=0;void SelectHC573(unsigned char n){ switch(n) { case 4: P2=(P2 & 0x1f) | 0x80; break; case 5: P2=(P2 & .原创 2021-04-18 21:55:52 · 175 阅读 · 0 评论 -
串行接口的基本原理与应用
#include<reg52.h>#define uint unsigned intunsigned char dat=0x00;sfr AUXR=0x8e;void SelectHC573(unsigned char n){ switch(n) { case 4: P2=(P2 & 0x1f) | 0x80; break; case 5: P2=(P2 & 0x1f) | 0xa0; break; case 6: P2=(P.原创 2021-04-18 21:41:28 · 190 阅读 · 0 评论 -
定时器实现秒表
#include<reg52.h>#define uint unsigned intunsigned int count=0;unsigned h=0;unsigned f=0;unsigned m=1;sbit S5=P3^2;sbit S4=P3^3;unsigned char code SMG[18]={0xc0,0xf9,0xa4,0xb0,0x99,0x92,0x82,0xf8,0x80,0x90,0x88,0x80,0xc6,0xc0,0x86,0x8e,0.原创 2021-04-18 21:37:17 · 878 阅读 · 0 评论 -
定时器的基本原理与应用
#include<reg52.h>#define uint unsigned intunsigned int count=0;sbit L1=P0^0;sbit L2=P0^1;void SelectHC573(unsigned char n){ switch(n) { case 4: P2=(P2 & 0x1f) | 0x80; break; case 5: P2=(P2 & 0x1f) | 0xa0; break; case .原创 2021-04-18 21:35:19 · 312 阅读 · 0 评论 -
51单片机的中断系统
#include<reg52.h>#define uint unsigned intunsigned flag=0;sbit L1=P0^0;sbit L8=P0^7;void delay(uint time){ uint i,j; for(i=time;i>0;i--) for(j=114;j>0;j--);}void SelectHC573(unsigned char n){ switch(n) { case 4: P2=(P2 &.原创 2021-04-18 21:33:17 · 91 阅读 · 0 评论 -
矩阵键盘的基本控制
#include<reg52.h>#define uint unsigned intsfr P4=0xC0;sbit R1=P3^0;sbit R2=P3^1;sbit R3=P3^2;sbit R4=P3^3;sbit C4=P3^4;sbit C3=P3^5;sbit C2=P4^2;sbit C1=P4^4;unsigned char code SMG[18]={0xc0,0xf9,0xa4,0xb0,0x99,0x92,0x82,0xf8,0x80,0x90.原创 2021-04-18 21:29:07 · 485 阅读 · 0 评论 -
独立按键的基本操作
#include<reg52.h>#define uint unsigned intunsigned char code SMG[18]={0xc0,0xf9,0xa4,0xb0,0x99,0x92,0x82,0xf8,0x80,0x90,0x88,0x80,0xc6,0xc0,0x86,0x8e,0xbf,0x7f};sbit S7=P3^0;sbit S6=P3^1;sbit S5=P3^2;sbit S4=P3^3;void delay(uint time).原创 2021-04-18 21:27:32 · 208 阅读 · 0 评论 -
动态数码管的显示(共阳数码管)
#include<reg52.h> #define uint unsigned intunsigned int mouth=1;unsigned char code SMG[18]={0xc0,0xf9,0xa4,0xb0,0x99,0x92,0x82,0xf8,0x80,0x90,0x88,0x80,0xc6,0xc0,0x86,0x8e,0xbf,0x7f};void delay_SMG(uint time){ uint i,j; for(i=time;i&g.原创 2021-04-18 21:25:27 · 647 阅读 · 0 评论 -
数码管的静态显示(共阳数码管)
#include<reg52.h>#define uint unsigned intunsigned char code SMG[16]={0xc0,0xf9,0xa4,0xb0,0x99,0x92,0x82,0xf8,0x80,0x90,0x88,0x83,0xc6,0xa1,0x86,0x8e};void delay(uint time){ uint i,j; for(i=time;i>0;i--) for(j=114;j>0;j--);}voi.原创 2021-04-18 21:23:13 · 746 阅读 · 0 评论 -
LED的基本操作(138译码器 573锁存器)
写在最前面:致参加蓝桥杯比赛,提交代码时没有提交整体压缩工程文件,仅仅提交了.hex文件一事,错失机会,有感总结;#include<reg52.h>#define uint unsigned intvoid delay(uint time){ uint i,j; for(i=time;i>0;i--) for(j=114;j>0;j--); }void SelectHC573(unsigned char n){ switch(n) { cas原创 2021-04-18 21:19:18 · 690 阅读 · 0 评论