1 /**————————————————————2 〖说明〗I2C总线驱动程序(用两个普通IO模拟I2C总线)3 包括100Khz(T=10us)的标准模式(慢速模式)选择,4 和400Khz(T=2.5us)的快速模式选择,5 默认11.0592Mhz的晶振。6 〖文件〗PCF8563T.C ﹫2001/11/2 77 〖作者〗龙啸九天 c51@yeah.net http://www.c51bbs.co /8 〖修改〗修改建议请到论坛公布 http://www.c51bbs.co m9 〖版本〗V1.00A Build 080310 —————————————————————*/1112 #ifndef SDA13 #define SDA P0_014 #define SCL P0_115 #endif1617 extern uchar SystemError;1819 #define uchar unsigned char20 #define uint unsigned int21 #define Byte unsigned char22 #define Word unsigned int23 #define bool bit24 #define true 125 #define false 02627 #define SomeNOP(); _nop_();_nop_();_nop_();_nop_();2829 /**--------------------------------------------------------------------------------30 调用方式:void I2CStart(void) ﹫2001/07/0 431 函数说明:私有函数,I2C专用32 ---------------------------------------------------------------------------------*/33 void I2CStart(void)34 {35 EA=0;36 SDA=1; SCL=1; SomeNOP();//INI37 SDA=0; SomeNOP(); //START38 SCL=0;39 }4041 /**--------------------------------------------------------------------------------42 调用方式:void I2CStop(void) ﹫2001/07/0 443 函数说明:私有函数,I2C专用44 ---------------------------------------------------------------------------------*/45 void I2CStop(void)46 {47 SCL=0; SDA=0; SomeNOP(); //INI48 SCL=1; SomeNOP(); SDA=1; //STOP49 EA=1;50 }5152 /**--------------------------------------------------------------------------------53 调用方式:bit I2CAck(void) ﹫2001/07/0 454 函数说明:私有函数,I2C专用,等待从器件接收方的应答55 ---------------------------------------------------------------------------------*/56 bool WaitAck(void)57 {58 uchar errtime=255;//因故障接收方无ACK,超时值为255。59 SDA=1;SomeNOP();60 SCL=1;SomeNOP();61 while(SDA) {errtime--; if (!errtime) {I2CStop();SystemError=0x11;return false;}}62 SCL=0;63 return true;
上传时间: 2014-04-11
上传用户:xg262122
拼音输入法杳询函数: unsigned char code * py_ime(unsigned char input_py_val[]); input_py_val为已输入的拼音码字符串头指针, 反回值为中文的起始地址,当为0时,杳询失败 应用举例: { unsigned char input_string[]={"bang"}; unsigned char chines_string[100]; sprintf(chines_string,"%s",py_ime(input_string)); }
上传时间: 2014-03-18
上传用户:gxy670166755
EEPROM为ATMEL公司的AT24C01A。单片机为ATMEL公司的AT89C51。2. 软件说明 C语言为Franklin C V3.2。将源程序另存为testi2c.c,用命令C51 testi2c.cL51 TESTI2C.OBJOHS51 TESTI2C编译,连接,得到TESTI2C.HEX文件,即可由编程器读入并进行写片,实验。3.源程序#include <reg51.h>#include <intrins.h> #define uchar unsigned char#define uint unsigned int#define AddWr 0xa0 /*器件地址选择及写标志*/#define AddRd 0xa1 /*器件地址选择及读标志*/#define Hidden 0x0e /*显示器的消隐码*/
上传时间: 2013-10-09
上传用户:hjshhyy
This application note shows how to achieve low-cost, efficient serial configuration for Spartan FPGA designs. The approachrecommended here takes advantage of unused resources in a design, thereby reducing the cost, part count, memory size,and board space associated with the serial configuration circuitry. As a result, neither processor nor PROM needs to be fullydedicated to performing Spartan configuration.In particular, information is provided on how the idle processing time of an on-board controller can be used to loadconfiguration data from an off-board source. As a result, it is possible to upgrade a Spartan design in the field by sending thebitstream over a network.
上传时间: 2014-08-16
上传用户:adada
ADXL345的详细介绍资料 本模块使用说明书。 本压缩文件能够利用角度传感器对x,y,z三方的加速度值,角度值进行测量,并集成了1602对其进行显示。 为了便于使用,我们分别将模块单独化,如果您有使用的意向,可以单独摘出 angle.c 引入到您自己新建的工程中。 关于angle.c文件的内部函数使用说明。 首先为了便于使用和方便引用我们对内部函数进行了高度集成化,您在引入angle.c后直接在您的主程序中调用 dis_data();函数,可完成ADXL345芯片的测量数据, 测量数据说明: char as_Xjiasu[6],as_Yjiasu[6],as_Zjiasu[6]; //定义3轴静态重力加速度值的ASCII码值 unsigned char as_Xangel[4],as_Yangel[4],as_Zangel[4]; //定义3轴角度值的ASCII码值 as_Xjiasu[x]数组里边我们为了您的使用直接将 加速度值转换成了 能够直接显示到 1602上的ASCII码值,同理as_Xangel 真实数据存放说明。 float jiasu_xyz[3]; angel_xyz[3]; //存放X,Y,Z 轴的静态重力加速度,角度值 存放了 加速度和角度的真实值(未经转换成ASCII码的数据)--本数据可以用于其他用途,直接参与MCU内部运算等。
上传时间: 2013-11-17
上传用户:wpwpwlxwlx
多远程二极管温度传感器-Design Considerations for pc thermal management Multiple RDTS (remote diode temperature sensing) provides the most accurate method of sensing an IC’s junction temperature. It overcomes thermal gradient and placement issues encountered when trying to place external sensors. PCB component count decreases when using a device that provides multiple inputs.Better temperature sensing improves product performance and reliability. Disk drive data integrity suffers at elevated temperatures. IBM published an article stating that a 5°C rise in operating temperature causes a 15% increase in the drive’s failure rate. The overall performance of a system can be improved by providing a more accurate temperature measurement of the most critical devices allowing them to run just a few degrees hotter.The LM83 directly senses its own temperature and the temperature of three external PN junctions. One is dedicated to the CPU of choice, the other two go to other parts of your system that need thermal monitoring such as the disk drive or graphics chip. The SMBus-compatible LM83 supports SMBus timeout and logic levels. The LM83 has two interrupt outputs; one for user-programmable limits and WATCHDOG capability (INT), the other is a Critical Temperature Alarm output (T_CRIT_A) for system power supply shutdown.
标签: Considerat Design 远程 二极管
上传时间: 2014-12-21
上传用户:ljd123456
Abstract: With industrial/scientific/medical (ISM) band radio frequency (RF) products, often times users are new to the structure of Maxim's low pin-count transmitters andfully integrated superheterodyne receivers. This tutorial provides simple steps that can be taken to get the best performance out of these transmitters and receivers whileproviding techniques to measure the overall capability of the design.
上传时间: 2013-11-02
上传用户:yph853211
10种软件滤波方法的示例程序 假定从8位AD中读取数据(如果是更高位的AD可定义数据类型为int),子程序为get_ad(); 1、限副滤波 /* A值可根据实际情况调整 value为有效值,new_value为当前采样值 滤波程序返回有效的实际值 */ #define A 10 char value; char filter() { char new_value; new_value = get_ad(); if ( ( new_value - value > A ) || ( value - new_value > A ) return value; return new_value; }
上传时间: 2013-11-11
上传用户:gxf2016
简单电子琴的51单片机程序 #include<reg51.h> //包含51单片机寄存器定义的头文件 sbit P14=P1^4; //将P14位定义为P1.4引脚 sbit P15=P1^5; //将P15位定义为P1.5引脚 sbit P16=P1^6; //将P16位定义为P1.6引脚 sbit P17=P1^7; //将P17位定义为P1.7引脚 unsigned char keyval; //定义变量储存按键值 sbit sound=P2^0; //将sound定义为P2.0 unsigned int C; //全局变量,储存定时器的定时常数 unsigned int f; //全局变量,储存音阶的频率 //以下是C调低音的音频宏定义 #define l_dao 262 //将“l_dao”宏定义为低音“1”的频率262Hz #define l_re 294 //将“l_re” 宏定义为低音“2”的频率294Hz #define l_mi 330 //将“l_mi” 宏定义为低音“3”的频率330Hz #define l_fa 349 //将“l_fa” 宏定义为低音“4”的频率349Hz #define l_sao 392 //将“l_sao”宏定义为低音“5”的频率392Hz #define l_la 440 //将“l_la” 宏定义为低音“6”的频率440Hz #define l_xi 494 //将“l_xi” 宏定义为低音“7”的频率494Hz //以下是C调中音的音频宏定义 #define dao 523 //将“dao”宏定义为低音“1”的频率Hz #define re 587 //将“re” 宏定义为低音“2”的频率Hz #define mi 659 //将“mi” 宏定义为低音“3”的频率Hz #define fa 698 //将“fa” 宏定义为低音“4”的频率Hz #define sao 784 //将“sao”宏定义为低音“5”的频率Hz #define la 880 //将“la” 宏定义为低音“6”的频率Hz #define xi 988 //将“xi” 宏定义为低音“7”的频率Hz
上传时间: 2013-11-09
上传用户:tian126vip
#include<reg51.h> unsigned char miao=0,fen=0,shi=0; unsigned char miao1=0,miao2=0; unsigned char fen1=0,fen2=0; unsigned char shi1=0,shi2=0;
上传时间: 2013-11-04
上传用户:ruan2570406