11 2019 档案

摘要:#include "REG52.H" #define const_voice_short 40#define const_key_time1 20#define const_key_time2 20#define const_interval_time1 200 //连续两次按键之间的有效时间差#d 阅读全文
posted @ 2019-11-30 21:04 烟火流沙 阅读(378) 评论(0) 推荐(0)
摘要:/* 上一例在主函数中利用累计定时器中断的次数来实现独立按键的检测,但是 如果在某些项目中,需要主函数里面间歇性地执行一些一气呵成的耗时任务, 当主函数正在执行一气呵成的耗时任务时(前提没有关闭定时器中断),这个时候 如果有按键按下来,就有可能没有被及时响应而遗漏了。 解决办法:在定时器里面处理独立 阅读全文
posted @ 2019-11-29 15:48 烟火流沙 阅读(1790) 评论(0) 推荐(0)
摘要:#include "REG52.H"#define const_voice_short 40 //蜂鸣器短叫的持续时间#define const_voice_long 200 //蜂鸣器长叫的持续时间#define const_key_time1 30 //按键去抖动的延时时间#define con 阅读全文
posted @ 2019-11-28 16:09 烟火流沙 阅读(366) 评论(0) 推荐(0)
摘要:#include "REG52.H"#define const_voice_short 40 //蜂鸣器短叫的持续时间#define const_voice_long 200 //蜂鸣器长叫的持续时间#define const_key_time1 500 //按键去抖动的延时时间#define co 阅读全文
posted @ 2019-11-27 22:35 烟火流沙 阅读(336) 评论(0) 推荐(0)
摘要: 阅读全文
posted @ 2019-11-26 22:17 烟火流沙 阅读(441) 评论(0) 推荐(0)
摘要:#include "REG52.H"#define const_time_05s 222#define const_time_1s 444#define const_time_3s 1332#define const_time_6s 2664 #define const_voice_short 40 阅读全文
posted @ 2019-11-26 21:48 烟火流沙 阅读(1158) 评论(0) 推荐(0)
摘要:#include "REG52.H"#define const_time_level 200void delay_long(unsigned int uiDelaylong);void initial_myself();void initial_peripheral();void led_flick 阅读全文
posted @ 2019-11-25 20:47 烟火流沙 阅读(431) 评论(0) 推荐(0)
摘要:#include "REG52.H"#define const_time_level 10000void initial_myself();void initial_peripheral();void delay_long(unsigned int uiDelaylong);void led_fli 阅读全文
posted @ 2019-11-24 17:20 烟火流沙 阅读(241) 评论(0) 推荐(0)
摘要:#include "REG52.H" void initial_myself(); //初始化单片机的寄存器及个别IO口,如继电器等等。void initial_peripheral(); /*初始化上电不立即处理的外围芯片和模块, 如液晶模块,AT24C02存储芯片,DS1302时钟芯片 */vo 阅读全文
posted @ 2019-11-22 15:29 烟火流沙 阅读(1189) 评论(0) 推荐(0)
摘要:#include <stdio.h>#include <string.h>#define MAXLINES 5000 /*进行排序的最大文本行*/char *lineptr[MAXLINES]; /*指向文本行的指针数组*/int readlines(char *lineptr[],int nlin 阅读全文
posted @ 2019-11-22 14:02 烟火流沙 阅读(256) 评论(0) 推荐(0)
摘要:/*strlen函数:返回字符串s长度*/int strlen(char *s){ int n; for(n=0;*s!='\0';s++) n++; return n;} #define ALLOCSIZE 10000 /*可用空间大小*/static char allocbuf(ALLOCSIZ 阅读全文
posted @ 2019-11-20 10:33 烟火流沙 阅读(306) 评论(0) 推荐(0)
摘要:STC单片机,TXD和RXD 直接接 P3.0 , P3.1 就可以下载了,下载的时候冷启动。所谓冷启动就是,点击下载后立刻断开单片机电源在接通电源如果不能下载,就对调一下TXD和RXD,如果还不行,就看看波特率吧,通常都是这么干的STC那么便宜的芯片,没人作假的就像1毛钱那样,你见过假的吗 阅读全文
posted @ 2019-11-19 20:39 烟火流沙 阅读(133) 评论(0) 推荐(0)
摘要:/*该版本的getint函数在到达文件结尾时返回EOF,当下一个输入不是数字时返回0,当输入中包含一个有意义的数字时返回一个正值。*/#include <stdio.h>int getch(void);void ungetch(int);/*getint函数:将输入中的下一个整型数赋值给*pn*/i 阅读全文
posted @ 2019-11-19 11:35 烟火流沙 阅读(139) 评论(0) 推荐(0)
摘要:#include <ctype.h>int getch(void);void ungetch(int);/*getop函数:获取下一个运算符或数值操作数*/int getop(char s[]){ int i,c; while ((s[0] = c = getch()) == ' ' || c == 阅读全文
posted @ 2019-11-18 11:02 烟火流沙 阅读(201) 评论(0) 推荐(0)
摘要:/*atof函数:把字符串s转换为相应的双精度浮点数*/#include <ctype.h>double atof(char s[]){ double val,power; int i,sign; for(i =0;isspace(s[i]);i++) /*isspace判断是否为空白符*/ ; s 阅读全文
posted @ 2019-11-17 11:33 烟火流沙 阅读(225) 评论(0) 推荐(0)
摘要:#include <stdio.h>#define MAXLINE 1000 /*最大输入行长度*/int getline(char line[], int max);int strindex(char source[], char searchfor[]);char pattern[] = 'ou 阅读全文
posted @ 2019-11-16 11:09 烟火流沙 阅读(146) 评论(0) 推荐(0)
摘要:/*reverse函数:倒置字符串s中各个字符的位置*/#include <string.h>void reverse(char s[]){ int c, i, j; for(i=0,j=strlen(s)-1;i<j;i++,j--) { c=s[i]; s[i]=s[j]; s[j]=c; }} 阅读全文
posted @ 2019-11-15 16:47 烟火流沙 阅读(205) 评论(0) 推荐(0)
摘要:/*binsearch函数:在v[0]<=v[1]<=v[2]<=...<=v[n-1]中查找x*/int binsearch(int x,int v[], int n){ int low, high, mid; low = 0; high = n-1; while(low <= high) { m 阅读全文
posted @ 2019-11-14 22:14 烟火流沙 阅读(127) 评论(0) 推荐(0)
摘要:/*squeeze函数:从字符串s中删除字符c*/void squeeze(char s[], int c){ int i, j; for(i = j = 0;s[i] != '\0';i++) if(s[i] != c) s[j++] = s[i]; s[j] = '\0'; } /*strcat 阅读全文
posted @ 2019-11-13 15:54 烟火流沙 阅读(110) 评论(0) 推荐(0)
摘要:标准头文件<string.h>中声明了strlen和其他字符串函数。/*strlen函数:返回s的长度*/int strlen(char s[]){ int i; i = 0; while(s[i] != '\0') { ++i; return i; }} 标准头文件<stdlib.h>声明了ato 阅读全文
posted @ 2019-11-12 22:17 烟火流沙 阅读(121) 评论(0) 推荐(0)
摘要:#include <stdio.h>#define MAXLINE 1000 int max;char line[MAXLINE];char longest[MAXLINE]; int getline(void);void copy(void); /*打印最长的行,*特别版本*/main(){ in 阅读全文
posted @ 2019-11-11 21:50 烟火流沙 阅读(661) 评论(0) 推荐(0)
摘要:/***********函数*************/#include <stdio.h>int power(int m,int n);/*测试power函数*/main(){ int i; for(i=0;i<10;++i) printf("%d %d %d\n",i,power(2,i),po 阅读全文
posted @ 2019-11-09 17:41 烟火流沙 阅读(209) 评论(0) 推荐(0)
摘要:/******************************************************//*统计各个数字、空白符及其他字符出现的次数*/#include <stdio.h>main(){ int c,i,nwhite,nother; int ndigit[10]; nwhit 阅读全文
posted @ 2019-11-08 16:33 烟火流沙 阅读(112) 评论(0) 推荐(0)
摘要:/************************************/ /*文件复制*/#include <stdio.h>main(){ int c; c = getchar(); while(c != EOF) { putchar(c); c = getchar(); }} /****** 阅读全文
posted @ 2019-11-07 17:59 烟火流沙 阅读(168) 评论(0) 推荐(0)
摘要:#include <stdio.h>/*当fathr = 0,20,...,300时,分别打印fahr华氏温度与celsius摄氏温度对照表*/main(){ float fahr,celsius; int lower,upper,step; lower = 0;/*温度表的下限*/ upper = 阅读全文
posted @ 2019-11-06 22:23 烟火流沙 阅读(195) 评论(0) 推荐(0)
摘要:入门第一例: #include <stdio.h> main() { printf("hello,world\n"); } 下面一个例子与上面的等价: #include <stdio.h> main() { printf("hello,"); printf("world"); printf("\n" 阅读全文
posted @ 2019-11-05 22:30 烟火流沙 阅读(114) 评论(0) 推荐(0)
摘要:在函数传递过程中,如果传递的结构很大,那么使用指针方式的效率通常比复制整个结构的效率要高。结构体指针类似于普通变量指针。声明 struct point *pp; 将pp定义为一个指向struct point类型对象的指针。如果pp指向一个point结构,那么指针*pp即为该结构,而(*pp).x和( 阅读全文
posted @ 2019-11-04 20:54 烟火流沙 阅读(119) 评论(0) 推荐(0)
摘要:指针数组的初始化: 指针数组的初始化语法与其他类型对象的初始化语法类似,下面是一个例子: char *month_name(int n) { static char *name[] = { "Illegal month","January","February","March","April","M 阅读全文
posted @ 2019-11-02 18:56 烟火流沙 阅读(7825) 评论(0) 推荐(0)
摘要:2019.1.11是我开通博客的第一天,以后我会每天更新我的博客,将我每天所学的感悟总结下来并且每天坚持下去,当回首望去,希望会成为我的一笔财富。加油!!! 首先,先分享一下我在B站上录制的视频,浏览量即将突破200。https://www.bilibili.com/video/av70151218 阅读全文
posted @ 2019-11-01 15:50 烟火流沙 阅读(134) 评论(0) 推荐(0)