- 博客(6)
- 收藏
- 关注
原创 编程4
甲;#include<reg51.h> #define uint unsigned int #define uchar unsigned char sbit s1=P1^1; uchar a=0; void delay(uint z) //延时函数 { uint x,y; for(x=100;x>0;x–) for(y=z;y>0;y–); } void key() { if(s10) { delay(5); if(s10) { while(!s1);
2020-07-18 15:20:17
295
原创 编程序3
#include “reg52.h” //此文件中定义了单片机的一些特殊功能寄存器 typedef unsigned int u16; //对数据类型进行声明定义 typedef unsigned char u8; unsigned char code tab[]={0xc0,0xf9,0xa4,0xb0,0x99,0x92,0x82,0xf8,0x80,0x90,0xff,0x88}; u8 num; void Int0Init() { //设置INT0 IT0=1;//跳变沿出发方式(下降沿)
2020-07-18 15:07:42
254
原创 编程2
#include<reg52.h> //头文件 #include<intrins.h> //头文件 #define uint unsigned int //宏定义 #define uchar unsigned char //宏定义 uchar flag; //变量 uchar count=0; uchar time=0; sbit key1=P1^0; uchar mode; void delay(uint z) //延时函数 { uint x,
2020-07-18 15:02:04
230
原创 编程序1
#include “reg52.h” //此文件中定义了单片机的一些特殊功能寄存器 typedef unsigned int u16; //对数据类型进行声明定义 typedef unsigned char u8; sbit led=P1^0; //定义P10口是led void Timer0Init() { TMOD|=0X01;//选择为定时器0模式,工作方式1,仅用TR0打开启动。 TH0=0XFC; //给定时器赋初值,定时1ms TL0=0X18; ET0=1;//打开定时器0中断允
2020-07-18 14:43:50
191
原创 单片机设计
单片机1: #include <reg51.h> sbit key1=P3^0; sbit key2=P3^4; unsigned char code tab[]={0xc0,0xf9,0xa4,0xb0,0x99,0x92,0x82,0xf8,0x80,0x90,0x88,0x83,0xc6,0xa1,0x86,0x8e}; unsigned char num=8; void delay_ms(unsigned char t) { unsigned char x,y; for(x=t;x>
2020-07-18 10:13:03
618
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人
RSS订阅