虫虫首页|资源下载|资源专辑|精品软件
登录|注册

define

define,宏定义,C语言中预处理命令一种。分为无参宏定义和带参宏定义。无参宏定义的一般形式为:#define宏名字符串;带参宏定义的一般形式为:#define宏名(参数表)字符串;
  • this code define genetic programming tools and some applications

    this code define genetic programming tools and some applications

    标签: applications programming genetic define

    上传时间: 2014-02-05

    上传用户:徐孺

  • 了解模数转换器的噪声、ENOB

    Abstract: Specifications such as noise, effective number of bits (ENOB), effective resolution, and noise-free resolution inlarge part define how accurate an ADC really is. Consequently, understanding the performance metrics related to noise isone of the most difficult aspects of transitioning from a SAR to a delta-sigma ADC. With the current demand for higherresolution, designers must develop a better understanding of ADC noise, ENOB, effective resolution, and signal-to-noiseratio (SNR). This application note helps that understanding.

    标签: ENOB 模数转换器

    上传时间: 2013-10-16

    上传用户:x18010875091

  • TLC2543 中文资料

    TLC2543是TI公司的12位串行模数转换器,使用开关电容逐次逼近技术完成A/D转换过程。由于是串行输入结构,能够节省51系列单片机I/O资源;且价格适中,分辨率较高,因此在仪器仪表中有较为广泛的应用。 TLC2543的特点 (1)12位分辩率A/D转换器; (2)在工作温度范围内10μs转换时间; (3)11个模拟输入通道; (4)3路内置自测试方式; (5)采样率为66kbps; (6)线性误差±1LSBmax; (7)有转换结束输出EOC; (8)具有单、双极性输出; (9)可编程的MSB或LSB前导; (10)可编程输出数据长度。 TLC2543的引脚排列及说明    TLC2543有两种封装形式:DB、DW或N封装以及FN封装,这两种封装的引脚排列如图1,引脚说明见表1 TLC2543电路图和程序欣赏 #include<reg52.h> #include<intrins.h> #define uchar unsigned char #define uint unsigned int sbit clock=P1^0; sbit d_in=P1^1; sbit d_out=P1^2; sbit _cs=P1^3; uchar a1,b1,c1,d1; float sum,sum1; double  sum_final1; double  sum_final; uchar duan[]={0x3f,0x06,0x5b,0x4f,0x66,0x6d,0x7d,0x07,0x7f,0x6f}; uchar wei[]={0xf7,0xfb,0xfd,0xfe};  void delay(unsigned char b)   //50us {           unsigned char a;           for(;b>0;b--)                     for(a=22;a>0;a--); }  void display(uchar a,uchar b,uchar c,uchar d) {    P0=duan[a]|0x80;    P2=wei[0];    delay(5);    P2=0xff;    P0=duan[b];    P2=wei[1];    delay(5);   P2=0xff;   P0=duan[c];   P2=wei[2];   delay(5);   P2=0xff;   P0=duan[d];   P2=wei[3];   delay(5);   P2=0xff;   } uint read(uchar port) {   uchar  i,al=0,ah=0;   unsigned long ad;   clock=0;   _cs=0;   port<<=4;   for(i=0;i<4;i++)  {    d_in=port&0x80;    clock=1;    clock=0;    port<<=1;  }   d_in=0;   for(i=0;i<8;i++)  {    clock=1;    clock=0;  }   _cs=1;   delay(5);   _cs=0;   for(i=0;i<4;i++)  {    clock=1;    ah<<=1;    if(d_out)ah|=0x01;    clock=0; }   for(i=0;i<8;i++)  {    clock=1;    al<<=1;    if(d_out) al|=0x01;    clock=0;  }   _cs=1;   ad=(uint)ah;   ad<<=8;   ad|=al;   return(ad); }  void main()  {   uchar j;   sum=0;sum1=0;   sum_final=0;   sum_final1=0;    while(1)  {              for(j=0;j<128;j++)          {             sum1+=read(1);             display(a1,b1,c1,d1);           }            sum=sum1/128;            sum1=0;            sum_final1=(sum/4095)*5;            sum_final=sum_final1*1000;            a1=(int)sum_final/1000;            b1=(int)sum_final%1000/100;            c1=(int)sum_final%1000%100/10;            d1=(int)sum_final%10;            display(a1,b1,c1,d1);           }         } 

    标签: 2543 TLC

    上传时间: 2013-11-19

    上传用户:shen1230

  • MEGA16制作的电子时钟(附仿真图+源代码)

    #include <iom16v.h> #include <macros.h> #define uchar unsigned char #define uint unsigned int uchar num,miao,fen,shi,miaoge,miaoshi,fenge,fenshi,shig

    标签: MEGA 16 电子时钟 仿真图

    上传时间: 2013-10-14

    上传用户:sc965382896

  • AVR单片机数码管秒表显示

    #include<iom16v.h> #include<macros.h> #define uint unsigned int #define uchar unsigned char uint a,b,c,d=0; void delay(c) { for for(a=0;a<c;a++) for(b=0;b<12;b++); }; uchar tab[]={ 0xc0,0xf9,0xa4,0xb0,0x99,0x92,0x82,0xf8,0x80,0x90,

    标签: AVR 单片机 数码管

    上传时间: 2013-10-21

    上传用户:13788529953

  • c51流水灯仿真与程序

    对应程序: #include<reg52.h> #define uint unsigned int #define uchar unsigned char uchar code tab[]={ 0x81, 0x42, 0x24, 0x18, }; void delay(uint z) { uint i,j; for(i=z;i>0;i--) for(j=120;j>0;j--); } void init() { P0=0x00; }

    标签: c51 流水灯 仿真 程序

    上传时间: 2014-01-16

    上传用户:ruan2570406

  • ucos在ATMEGA128L上的移植

    和其他的μC/OS-II移植文件类似,设备代码由以下3 到5 个文件组成的。 Os_cpu.h Os_cpu_c.c Os_cpu_a.s90 (该文件仅在ICC 编译器中使用) Os_cpu_i.s90 (该文件仅在ICC 编译器中使用) Os_dbg.c Os_dbg.c 仅需在IAR 工程中使用。 3.01 OS_CPU.H 3.01.01 OS_CPU.H, macros for ‘externals’ Listing 3-1, OS_CPU.H, 外部宏(macros for ‘externals’) #ifdef OS_CPU_GLOBALS #define OS_CPU_EXT #else #define OS_CPU_EXT extern #endif  

    标签: ATMEGA ucos 128L 128

    上传时间: 2013-11-24

    上传用户:zhaistone

  • 单片机几种软件滤波程序示例

    假定从8位AD中读取数据(如果是更高位的AD可定义数据类型为int),子程序为get_ad(); 1、限幅滤波法(又称程序判断滤波法)     A、方法:         根据经验判断,确定两次采样允许的最大偏差值(设为A)         每次检测到新值时判断:         如果本次值与上次值之差<=A,则本次值有效         如果本次值与上次值之差>A,则本次值无效,放弃本次值,用上次值代替本次值     B、优点:         能有效克服因偶然因素引起的脉冲干扰     C、缺点         无法抑制那种周期性的干扰         平滑度差 /*  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;          } 2、中位值滤波法     A、方法:         连续采样N次(N取奇数)         把N次采样值按大小排列         取中间值为本次有效值     B、优点:         能有效克服因偶然因素引起的波动干扰         对温度、液位的变化缓慢的被测参数有良好的滤波效果     C、缺点:         对流量、速度等快速变化的参数不宜 /*  N值可根据实际情况调整     排序采用冒泡法*/

    标签: 单片机 软件滤波 程序

    上传时间: 2014-12-26

    上传用户:nanshan

  • 51单片机实现的RS485通讯程序

      #ifndef __485_C__   #define __485_C__   #include   #include   #define unsigned char uchar   #define unsigned int uint   /* 通信命令 */   #define __ACTIVE_ 0x01 // 主机询问从机是否存在   #define __GETDATA_ 0x02 // 主机发送读设备请求   #define __OK_ 0x03 // 从机应答   #define __STATUS_ 0x04 // 从机发送设备状态信息   #define __MAXSIZE 0x08 // 缓冲区长度   #define __ERRLEN 12 // 任何通信帧长度超过12则表示出错   uchar dbuf[__MAXSIZE]; // 该缓冲区用于保存设备状态信息   uchar dev; // 该字节用于保存本机设备号   sbit M_DE = P1^0; // 驱动器使能,1有效   sbit M_RE = P1^1; // 接收器使能,0有效

    标签: 485 RS 51单片机 通讯程序

    上传时间: 2014-12-26

    上传用户:604759954

  • ds18b20程序

      /通过DS18B20测试当前环境温度, 并通过数码管显示当前温度值, 目前显示范围: 0.0~ +99.9度   #include   #include   #define uchar unsigned char   #define uint unsigned int   #define DATAPORT P0 //定义P0口为Led数据口   //#define SETTEMP P1 //定义P1口为设定温度   #define SELECT P2 //定义P2口为选择信号   sbit L1 = P1^1; //灯作为电机   sbit L2 = P1^2;   sbit L3 = P1^3;

    标签: 18b b20 ds 18

    上传时间: 2013-11-04

    上传用户:liulinshan2010