#include
#define uchar unsigned char
#define uint unsigned int
sbit led1=P1^0;
uchar num;
void main()
{
TMOD=0X01;
//设置定时器0为工作方式1(M1M0为01)
TH0=(65536-45872)/256;
//装处初值11.0592M晶振定时50ms数为458...
分类:
其他好文 时间:
2014-07-18 23:08:30
阅读次数:
684
52控制DAC0832芯片输出电流,让发光二极管D12由灭均匀变到最亮,再有亮变灭,在最亮和最灭的时候蜂鸣器发出报警声,完成整个周期的时间是控制在5s左右。
#include
#define uchar unsigned char
#define uint unsigned int
sbit dula=P2^6;
sbit wela=P2^7;
sbit dawr=...
分类:
其他好文 时间:
2014-07-18 23:02:11
阅读次数:
284
数码管显示00~59按键1每按一次显示值加一,按键2每按一次显示值减一,按键3功能归零,按键4启动或停止定时器0
#include
#define uchar unsigned char
#define uint unsigned int
sbit key1=P3^4;
sbit key2=P3^5;
sbit key3=P3^6;
sbit key4=P3^7;
sb...
分类:
其他好文 时间:
2014-07-18 22:04:02
阅读次数:
228
开始时数码管不显示,顺序按下矩阵键盘后,在数码管上依次显示0~F,6个数码管同时静态显示。
数码管和矩阵键盘
首先关闭所有的数码管的段选不让数码管显示任何数字,然后位选中所有的数码管,接下来只需要选中所有的数码管,以后的操作的只需要送段选数据就行了,接着进入while()大循环不停的扫描键盘是否有被按下
#include
#define uchar unsigned char
#de...
分类:
其他好文 时间:
2014-07-18 21:29:08
阅读次数:
269
#include
#define uchar unsigned char
#define uint unsigned int
sbit dula=P2^6;
sbit wela=P2^7;
sbit led1=P1^0;
uchar code table[]=
{
0x3f,0x06,0x5b,0x4f,0x66,
0x6d,0x7d,0x07,0x7f,0x6f,
0x7...
分类:
其他好文 时间:
2014-07-18 21:24:27
阅读次数:
208
在上位机上用串口调试助手发送一个字符X,单片机收到字符后返回给上位机“I get X”,串口波特率设为9600bps。
#include
#define uchar unsigned char
unsigned char flag,a,i;
uchar code table[]="I get";
void init()
{
TMOD=0x20; //设定T1定时器的工作模式2
...
分类:
其他好文 时间:
2014-07-18 21:23:22
阅读次数:
193
以下注释的源代码都在memcached项目的assoc.c文件中 1 /* how many powers of 2's worth of buckets we use */ 2 unsigned int hashpower = HASHPOWER_DEFAULT; /* 哈希表bucket的级.....
分类:
其他好文 时间:
2014-07-18 15:20:11
阅读次数:
344
1.不要直接调用mallocvoid *malloc(unsigned int num_bytes);malloc函数的工作机制malloc函数的实质体现在,它有一个将可用的内存块连接为一个长长的列表的所谓空闲链表。调用malloc函数时,它沿连接表寻找一个大到足以满足用户请求所需要的内存块。然后,...
分类:
其他好文 时间:
2014-07-18 15:04:11
阅读次数:
162
#include
#include
#include
#define uchar unsigned char
#define uint unsigned int
sbit dula=P2^6;
sbit wela=P2^7;
sbit adwr=P3^6;
sbit adrd=P3^7;
uchar flag,a;
uchar flag_uart,flag_time,flag_...
分类:
其他好文 时间:
2014-07-17 16:19:01
阅读次数:
263
#include
#include
#define uchar unsigned char
#define uint unsigned int
sbit dula=P2^6;
sbit wela=P2^7;
sbit adwr=P3^6;
sbit adrd=P3^7;
uchar code table[]={
0x3f,0x06,0x5b,0x4f,0x66,
0x6d...
分类:
其他好文 时间:
2014-07-16 16:15:47
阅读次数:
240