- 博客(22)
- 资源 (3)
- 收藏
- 关注
原创 定时一秒和秒表
#include <reg52.h>unsigned char chagenum[16]={0xc0,0xf9,0xa4,0xb0,0x99,0x92,0x82,0xf8,0x80,0x90,0x88,0x83,0xC6,0xA1,0x86,0x8E}; // 0-9void delay_1s(){ unsigned char i; for(i = 0; i < 20; i++
2017-02-28 09:20:05 667
原创 串口显示
#include<reg52.h>#include "delay.h"#include "1602.h"unsigned char str[10];unsigned char Temp; //定义临时变量unsigned char i = 0; void uart_init() { SCON = 0x50;//设置串口方式1,打开允许接受 //SMO =
2017-02-27 07:39:29 936
原创 串口发送数据到1602显示
#include<reg52.h>#include "delay.h"#include "1602.h"unsigned char str[10];unsigned char Temp; //定义临时变量 unsigned char i = 0; void uart_init() { SCON = 0x50;//设置串口方式1,打开允许接受 //SMO =
2017-02-26 11:23:27 6606 1
原创 串口的 初步设置
#include <reg52.h>#include "./delay/delay.h"#include "1602.h"void uart_init(){ SCON = 0x50; //设置寄存器开接收 //SM0 = 0; SM1 = 1; REN = 1; TMOD |= 0x20; //设置定时器工作方式2 TH1 = 0xfd;
2017-02-25 10:50:59 340
原创 按键去抖
#include <reg52.h>unsigned char LED[10] = {0xc0,0xf9,0xa4,0xb0,0x99,0x92,0x82,0xf8,0x80,0x90};sbit key =P1^0;void delay(unsigned char i){ unsigned char k,j; for(k = 0; k < 255; k++) f
2017-02-24 10:35:35 435
原创 按键控制数码管
#include <reg52.h>/*void delay(unsigned char i){ unsigned char j,k; for(j = 0; j < 255; j++) for(k = 0; k < i; k++) ;}*/void main(){ unsigned char code chagenum[8]={0
2017-02-23 09:22:04 1801
原创 按键控制LED
#include <reg52.h>void delay(unsigned char i){ unsigned char k,j; for(k = 0; k < 255; k++) for(j = 0; j < i; j++) ;}void delay_us(unsigned char t){ while(--t);}void
2017-02-22 09:01:00 642
原创 按键计数小程序
#include <reg52.h>unsigned char LED[10] = {0xc0,0xf9,0xa4,0xb0,0x99,0x92,0x82,0xf8,0x80,0x90};void main(){ TMOD = 0x05; TL0 = 0x00; TH0 = 0x00; TR0 = 1; while(1) { P1 =
2017-02-21 09:24:20 2346
原创 较为准确的延迟函数
#include <reg52.h>void timer0_init(){ EA = 1; TMOD |= 0x01; TH0 = (65536 - 50000)/256; TL0 = (65536 - 50000)%256; ET0 = 1; TR0 = 1;}void timer0_init(){ static unsigned ch
2017-02-20 12:57:26 542
原创 LCD显示时钟
#include<reg52.h> #define uchar unsigned char #define uint unsigned int #define KEY_IO P3 #define LCD_IO P0 sbit LCD_RS = P2^0; sbit LCD_RW = P2^1; sbit LCD_EN = P2^2; sbit SPK = P1^2; sbit LE
2017-02-19 09:09:17 1139
原创 4路AD中的4路检测外部模拟量输入 使用液晶显示
/*----------------------------------------------- 名称:IIC协议 PCF8591 AD/DA转换 内容:使用4路AD中的4路检测外部模拟量输入 使用液晶显示------------------------------------------------*/ #include <reg52.h> #inc
2017-02-18 18:31:47 1715 1
原创 LCD的静态显示
/*----------------------------------------------- 名称:LCD1602 内容:通过标准程序静态显示字符 引脚定义如下:1-VSS 2-VDD 3-V0 4-RS 5-R/W 6-E 7-14 DB0-DB7 15-BLA 16-BLK------------------------------------------------*/#
2017-02-17 09:27:59 2358
原创 LCD滚动显示
/*----------------------------------------------- 名称:LCD1602 内容:通过标准程序移屏滚动显示字符 引脚定义如下:1-VSS 2-VDD 3-V0 4-RS 5-R/W 6-E 7-14 DB0-DB7 15-BLA 16-BLK------------------------------------------------*/
2017-02-16 09:55:29 8261 1
原创 LCD的动态显示
/*----------------------------------------------- 名称:LCD1602 内容:通过标准程序动态显示字符 引脚定义如下:1-VSS 2-VDD 3-V0 4-RS 5-R/W 6-E 7-14 DB0-DB7 15-BLA 16-BLK------------------------------------------------*/#
2017-02-15 12:37:39 5597 1
原创 LCD的时钟显示
#include<reg52.h> //包含头文件,一般情况不需要改动,头文件包含特殊功能寄存器的定义#include<intrins.h>sbit RS = P2^4; //定义端口 sbit RW = P2^5;sbit EN = P2^6;sbit spk = P1^2;#define RS_CLR RS=0 #define RS_SET RS=1#define RW_CLR
2017-02-14 09:23:07 1923
原创 DS18B20 LCD显示当前温度
include include “./delay/delay.h”include include <1602.h>include define SUCC 1define ERR 0void ds18b20_init() { ds = 0; delay_us(200); delay_us(200);ds = 1;delay_us(30);if(ds == 0){
2017-02-13 20:07:59 1830
原创 DAC按键控制加减LCD显示
#include #include "i2c.h"#include "delay.h"#include "display.h"#define AddWr 0x90 #define AddRd 0x91 sbit KEY_ADD=P3^3; sbit KEY_DEC=P3^4;extern bit ack
2017-02-12 09:01:35 1486
原创 2402存储一个数据
/*----------------------------------------------- 名称:IIC协议 EEPROM24c02 存数读取数据 论坛:www.doflye.net 编写:shifang 修改:无 内容:此程序用于检测EEPROM性能,测试方法如下:写入24c02一个数据,然后在内存中改变这些数据, 掉电后主内存将失去这些信
2017-02-11 09:08:17 1016
原创 51单片机100次按键
#include#define Dataport P0sbit Latch_seg = P2^2; //段sbit Latch_bit = P2^3; //位unsigned char arr[16] = {0xC0,0xF9,0xA4,0xB0,0x99,0x92,0x82,0xF8,0x80,0x90,0x88,0x83,0xC6,0xA1,0x86,0x8E};u
2017-02-10 09:03:08 703
原创 51单片机60秒倒计时
#include#define Dataport P0sbit Latch_seg = P2^2; //??sbit Latch_bit = P2^3; //??unsigned char arr_bit[8] = {0xfe,0xfd,0xfb,0xf7,0xef,0xdf,0xbf,0x7f};unsigned char arr_seg[16] = {0x3F,0x
2017-02-10 09:02:22 10219
原创 1路AD数码管显示
寒假后上课第二天,开始由张工执教/*----------------------------------------------- 名称:IIC协议 PCF8591 AD/DA转换 修改:无 内容:使用4路AD中的1路检测外部模拟量输入------------------------------------------------*/ #include
2017-02-08 08:59:30 711
原创 10秒倒计时
寒假集训年后第一天 #include//sbit Led1 = P0^0;sbit Latch_seg = P2^0;sbit Latch_bit = P2^1;sbit BUZZ = P2^2; void delay(unsigned char cnt);/*unsigned char code LedChar[16
2017-02-07 08:54:07 829
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人