资源简介

本程序,是以LPC1768为控制核心,外围有ds18b20,dht11,mq-2来分别采集温度、湿度、烟雾浓度,可是实现在一个局域网内进行查看的功能。

资源截图

代码片段和文件信息

/****************************************Copyright (c)****************************************************
**                                 http://www.PowerAVR.com
**    http://www.PowerMCU.com
**--------------File Info---------------------------------------------------------------------------------
** File name:           adc.c
** Last modified Date:  2010-05-12
** Last Version:        V1.00
** Descriptions:        
**
**--------------------------------------------------------------------------------------------------------
** Created by:          PowerAVR
** Created date:        2010-05-10
** Version:             V1.00
** Descriptions:        编写示例代码
**
**--------------------------------------------------------------------------------------------------------       
*********************************************************************************************************/
#include “lpc17xx.h“                              /* LPC17xx definitions    */
#include “adc.h“
int i;
uint16_t ADC_Data;
volatile uint32_t ADC_Buf = 0; // 保证本条指令不因为编译器的优化而省略
/*----------------------------------------------------------------------------
  initialize ADC Pins
 *----------------------------------------------------------------------------*/
void ADC_Init (void) {

  LPC_PINCON->PINSEL3 &= ~(3UL<<28);               /* P1.30 is GPIO */
  LPC_PINCON->PINSEL3 |=  (3UL<<28);               /* P1.30 is AD0.4 */

  LPC_SC->PCONP       |=  (1<<12);               /* Enable power to ADC block */

  LPC_ADC->ADCR        =  (1<< 4) |              /* select AD0.4 pin */
                          (4<< 8) |              /* ADC clock is 25MHz/5 */
                          (1<<21);               /* enable ADC */ 
}

/*----------------------------------------------------------------------------
  start ADC Conversion
 *----------------------------------------------------------------------------*/
void ADC_StartCnv (void) {
  LPC_ADC->ADCR &= ~(7<<24);                     /* stop conversion  */
  LPC_ADC->ADCR |=  (1<<24);                     /* start conversion */
}


/*----------------------------------------------------------------------------
  stop ADC Conversion
 *----------------------------------------------------------------------------*/
void ADC_StopCnv (void) {
  LPC_ADC->ADCR &= ~(7<<24);                     /* stop conversion */
}

/*----------------------------------------------------------------------------
  get converted ADC value
 *----------------------------------------------------------------------------*/
uint32_t ADC_GetCnv (void) {
  uint32_t adGdr;
//  uint32_t adDr2;

  while (!(LPC_ADC->ADGDR & (1UL<<31)));         /* Wait for Conversion end */
  adGdr = LPC_ADC->ADGDR;
//  adDr2 = LPC_ADC->ADDR2;
  return((adGdr >> 4) & ADC_VALUE_MAX);          /* read converted value */
}

/*------------------------------------------------------------------------------
  read a converted value fro

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----

     文件       1552  2009-05-19 15:29  http_demo(温湿度和烟雾+视频)12.16\Http_demo\Abstract.txt

     文件       4055  2013-12-16 21:48  http_demo(温湿度和烟雾+视频)12.16\Http_demo\adc.c

     文件       1412  2013-12-13 20:50  http_demo(温湿度和烟雾+视频)12.16\Http_demo\adc.h

     文件       1084  2013-12-06 18:55  http_demo(温湿度和烟雾+视频)12.16\Http_demo\delay.c

     文件        135  2013-12-06 18:54  http_demo(温湿度和烟雾+视频)12.16\Http_demo\delay.h

     文件       1978  2013-12-16 22:44  http_demo(温湿度和烟雾+视频)12.16\Http_demo\dht11.c

     文件        717  2013-12-16 22:43  http_demo(温湿度和烟雾+视频)12.16\Http_demo\dht11.h

     文件       5130  2013-11-30 09:40  http_demo(温湿度和烟雾+视频)12.16\Http_demo\ds18b20.c

     文件       3318  2009-09-29 12:32  http_demo(温湿度和烟雾+视频)12.16\Http_demo\GLCD.h

     文件      18563  2013-12-16 22:51  http_demo(温湿度和烟雾+视频)12.16\Http_demo\HTTP_CGI.c

     文件       8798  2014-02-25 09:25  http_demo(温湿度和烟雾+视频)12.16\Http_demo\HTTP_demo.c

     文件       9315  2011-11-23 23:43  http_demo(温湿度和烟雾+视频)12.16\Http_demo\Http_demo.opt.bak

     文件      11882  2010-04-13 11:57  http_demo(温湿度和烟雾+视频)12.16\Http_demo\Http_demo.Uv2.bak

    .......     93154  2014-02-25 21:00  http_demo(温湿度和烟雾+视频)12.16\Http_demo\Http_demo.uvopt

     文件      74451  2013-12-16 22:59  http_demo(温湿度和烟雾+视频)12.16\Http_demo\Http_demo.uvproj

     文件      74731  2013-11-25 08:23  http_demo(温湿度和烟雾+视频)12.16\Http_demo\Http_demoFrank.uvopt

     文件       3761  2013-11-25 08:23  http_demo(温湿度和烟雾+视频)12.16\Http_demo\Http_demoFrank_MCB1700.dep

     文件       8117  2014-02-25 09:23  http_demo(温湿度和烟雾+视频)12.16\Http_demo\Http_demo_MCB1700 Debug.dep

     文件       4904  2010-04-13 11:54  http_demo(温湿度和烟雾+视频)12.16\Http_demo\Http_demo_MCB1700 RTX.dep

     文件       2914  2013-11-30 09:06  http_demo(温湿度和烟雾+视频)12.16\Http_demo\Http_demo_MCB1700.dep

     文件       9435  2010-04-13 16:56  http_demo(温湿度和烟雾+视频)12.16\Http_demo\Http_demo_Opt.Bak

     文件      12533  2009-11-10 19:50  http_demo(温湿度和烟雾+视频)12.16\Http_demo\Http_demo_Uv2.Bak

    .......     93157  2014-01-07 22:01  http_demo(温湿度和烟雾+视频)12.16\Http_demo\Http_demo_uvopt.bak

     文件      73454  2013-12-16 14:03  http_demo(温湿度和烟雾+视频)12.16\Http_demo\Http_demo_uvproj.bak

     文件     293124  2014-02-25 09:23  http_demo(温湿度和烟雾+视频)12.16\Http_demo\JlinkLog.txt

     文件      32027  2012-06-01 16:32  http_demo(温湿度和烟雾+视频)12.16\Http_demo\LPC17xx_Sun.h

     文件     191931  2014-02-25 09:20  http_demo(温湿度和烟雾+视频)12.16\Http_demo\Lst\Http_demo.map

     文件      32485  2014-02-25 09:20  http_demo(温湿度和烟雾+视频)12.16\Http_demo\Lst\startup_LPC17xx.lst

     文件      21297  2011-12-15 15:45  http_demo(温湿度和烟雾+视频)12.16\Http_demo\Net_Config.c

     文件       3637  2011-11-30 15:18  http_demo(温湿度和烟雾+视频)12.16\Http_demo\Net_Debug.c

............此处省略103个文件信息

评论

共有 条评论