文章分类 - 单片机
摘要:#include //器件配置文件 #include //传感器接口 sbit RX = P2^0; sbit TX = P2^1; //按键声明 sbit S1 = P3^0; sbit S2 = P3^1; sbit S3 = P3^2; //蜂鸣器 sbit Feng= P2^3; //数码管段选和位选 sbit Duan = P2^6; sbit Wei = P2^7; /...
阅读全文
摘要:1.http://www.alldatasheet.com 2.www.datasheet4u.net 3.http://www.datasheetcatalog.com 4.http://www.datasheet5.com
阅读全文
摘要:1 #include <reg54.h> 2 #include <intrins.h> 3 4 void delay(uint z) 5 { 6 uint x,y; 7 for(x=z;x>0;x--) 8 for(y=114;y>0;y--); 9 } 10 11 12 void main() 1
阅读全文
摘要:1 #include 2 void main( void ) 3 { 4 FILE *stream; 5 char list[30]; 6 int i, numread, numwritten; 7 // 以文本方式打开文件 8 if( (stream = fopen( "test.txt", "w+t" )) != NULL ) //...
阅读全文
摘要:1 /********************************************************************************* 2 * 【编写时间】: 2016年02月15日 3 * 【作 者】: 清翔电子:03 4 * 【版 本】: 1.0 5 * 【网
阅读全文
摘要:1 #include <stdio.h> 2 #define Mon 1 3 #define Tues 2 4 #define Wed 3 5 #define Thurs 4 6 #define Fri 5 7 #define Sat 6 8 #define Sun 7 9 int main(){
阅读全文
摘要:1 #include <stdio.h> 2 #include <string.h> 3 4 union Data 5 { 6 int i; 7 float f; 8 char str[20]; 9 }; 10 11 int main( ) 12 { 13 union Data data; 14 1
阅读全文
摘要:1 #include <stdio.h> 2 #include <string.h> 3 4 struct Books 5 { 6 char title[50]; //书名 7 char author[50]; //作者 8 char subject[100]; //科目 9 int book_id
阅读全文
摘要:I2C 通信 1-WIRE DS18B20 I2C (本课) SDA (serial data I/O) SCL (serial clock) I2C传输协议 I2C传输起始和终止信号 I2C字节的传送与应答 应答位的作用 I2C写数据流程 I2C读数据流程 软件模拟I2C通信时序 1 /*I2C初
阅读全文
摘要:串口通信工作模式 【SM】 发送中断标志位 接收中断标志位 ES中断【串口中断】 波特率设置 fosc为晶振频率 程序 1 void init() 2 { 3 TMOD = 0x20; //T1 8位 4 TH1 = 0xfd; 5 TL1=0xfd; //253 T初始 6 TR1 =1; //开
阅读全文
摘要:1 #include<reg52.h> 2 #include<intrins.h> 3 #define uchar unsigned char 4 #define uint unsigned int 5 sbit buzzer=P2^3; 6 sbit key=P3^0; 7 void delay(
阅读全文
摘要:1 #include <reg52.h> 2 #include <intrins.h> 3 #define MAIN_Fosc 11059200UL //宏定义主时钟HZ 4 #define PCF8591_ADDR 0x90 //PCF8591地址 5 #define DACOUT_EN 0x40
阅读全文
摘要:1 void Delay_Ms(INT16U ms) //typedef unsigned int INT16U 2 { 3 INT16U i; 4 do{ 5 i = MAIN_Fosc/96000; //#define MAIN_Focs 11059200UL (UL > unsigned lo
阅读全文
摘要:1 #include 2 3 #define uchar unsigned char 4 #define uint unsigned int 5 6 uint count; 7 void delay(uint z) 8 { 9 uint x,y; 10 for(x = z; x > 0; x--) 11 for(y = 114; y > ...
阅读全文
摘要:1 #include <reg52.h> 2 #include <intrins.h> 3 #define MAIN_Fosc 11059200UL //ºê¶¨ÒåÖ÷ʱÖÓHZ 4 /* 5 ×Ô¶¨ÒåÀàÐÍÃû 6 */ 7 typedef unsigned char INT8U; 8
阅读全文
摘要:一.了解单片机的串口通信 二.串行接口结构 三.串行接口寄存器 四.波特率计算 五.使用串行通信的步骤 注意:在串口通信中为什么都是定时器1呢,不感觉有问题吗,其实这是内部决定的,串口通信与T0没有关系了 六.代码 1 #include <reg52.h> 2 3 #define uchar uns
阅读全文

浙公网安备 33010602011771号