⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 adc.h

📁 ST7 MCU Analoy to Digital control setting for learning
💻 H
字号:
/*
*******************************************************************************
COPYRIGHT 2003 STMicroelectronics
Source File Name : adc.h
Group            : IPSW,CMG-IPDF.
Author           : MCD Application Team
Date First Issued: 6/3/2002
********************************Documentation**********************************
General Purpose - This file defines prototypes for all the functions whose 
				  source code appears in adc.c.
********************************RevisionHistory********************************
_______________________________________________________________________________
Date :06/03/2002 Release:1.0 
Date :22/09/2003 Release:2.0 
                 1.Replaced functions prototype of three function with Macro.
                 2.Included necessary comments.
                 3.Removed inclusion of adc_hr.h.
                 4.Modified the code to support new devices mentioned in adc.c.
   
******************************************************************************/
	
#ifndef ADC_H
#define ADC_H     

#include "ST7lib_config.h"     	          /*Selection of device and compiler */
           

                       /* Enums for ADC Initialisation for different devices */
/*---------------------------------------------------------------------------*/
#ifdef ADC_72F521
typedef enum {
              ADC_DEFAULT = (unsigned char) 0x00,
              ADC_SPEED   = (unsigned char) 0x40
             }Typ_ADC_InitParameter;
#endif /* 72F521 */

/*---------------------------------------------------------------------------*/
#ifdef ADC_72F62
typedef enum {
              ADC_DEFAULT       = (unsigned char) 0x00,
              ADC_SPEED         = (unsigned char) 0x40,
              ADC_ONESHOT       = (unsigned char) 0x08,
              ADC_IT_ENABLE     = (unsigned char) 0x10 
             }Typ_ADC_InitParameter;
#endif /* 72F62 */

/*---------------------------------------------------------------------------*/
#if (defined ADC_LITE0 || defined ADC_SUPERLITE )
typedef enum {
              ADC_DEFAULT      = (unsigned char) 0x00,
              ADC_AMPLIFIER_ON = (unsigned char) 0x04,
              ADC_SPEED        = (unsigned char) 0x40,
              ADC_SLOW         = (unsigned char) 0x08              
             }Typ_ADC_InitParameter;
	      	
#endif /* LITE0 |SUPERLITE  */
/*---------------------------------------------------------------------------*/
#if (defined ADC_72F561 || defined ADC_72F264)
typedef enum {
   	      ADC_DEFAULT    = (unsigned char) 0x00,
  	      ADC_SPEED      = (unsigned char) 0x40,
              ADC_SLOW       = (unsigned char) 0x10
    	     }Typ_ADC_InitParameter;
	     
#endif /* 72F561 | 72F264 */	     
/*---------------------------------------------------------------------------*/
#if (defined ADC_LITE3 )
typedef enum {
	      ADC_DEFAULT    = (unsigned char) 0x00,
	      ADC_SPEED      = (unsigned char) 0x40,
    	      ADC_SLOW       = (unsigned char) 0x08
     	     }Typ_ADC_InitParameter;
	    
#endif /* LITE3  */	    
	    
/*---------------------------------------------------------------------------*/
#if (defined ADC_DALI || defined ADC_LITE1 || defined ADC_LITE2)
typedef enum {
	      ADC_DEFAULT      = (unsigned char) 0x00,
    	      ADC_SPEED        = (unsigned char) 0x40,
    	      ADC_SLOW         = (unsigned char) 0x08,
    	      ADC_AMPLIFIER_ON = (unsigned char) 0x04,
    	      ADC_AMPLIFIER_CAL= (unsigned char) 0x10
	     }Typ_ADC_InitParameter;
#endif /* DALI | LITE1 | LITE2 */				
/*---------------------------------------------------------------------------*/
#if (defined ADC_72F63 || defined ADC_72F65)
typedef enum {
              ADC_DEFAULT = (unsigned char) 0x00
             }Typ_ADC_InitParameter;
	      	
#endif /* 72F63 | 72F65 */
/*---------------------------------------------------------------------------*/

                                                        /* MACRO Definations */

#define ADC_Enable() (ADCCSR |= 0x20)          /* macro for Enabling the adc */

#define ADC_Disable() (ADCCSR &= 0xDF)        /* macro for disabling the adc */

                                         /* macro for reading converted data */  
#if (defined ADC_LITE0 || defined ADC_SUPERLITE ||defined ADC_72F63 || defined ADC_72F65 )
#define ADC_Conversn_Read() (ADCDR)
#endif					

/* FUNCTIONS Prototype */
/*---------------------------------------------------------------------------*/
#if (defined ADC_72F561 || defined ADC_72F521 || defined ADC_72F62 ||\
defined ADC_72F264 || defined ADC_DALI ||defined ADC_LITE1 ||\
defined ADC_LITE2 || defined ADC_LITE3)
unsigned int ADC_Conversn_Read (void);                 /* Read the conversion*/
#endif

/*---------------------------------------------------------------------------*/
#ifdef ADC_72F62 
void ADC_IT_Routine(void);                       /* Interrupt service routine*/
#endif
/*---------------------------------------------------------------------------*/
void ADC_Init(Typ_ADC_InitParameter InitValue);             /* Initialize ADC*/
BOOL ADC_Test_Conversn_Complete (void);   /* Wait till conversion is complete*/
void ADC_Select_Channel (unsigned char ADC_AIN);/* Select the desired channel*/
#endif
/**********   (c) 2003  ST Microelectronics ***************END OF FILE *******/



⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -