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

📄 main.c

📁 Lcd test demo code based on St arm mcu
💻 C
字号:
/******************** (C) COPYRIGHT 2003 STMicroelectronics ********************
* File Name          : main.c
* Author             : MCD Application Team
* Date First Issued  : 31/07/2003
* Description        : This example shows how to use the software library to
*                      manage the converter in the single channel mode
*                      of conversion.the converter in this example is managed
*                      in the interrupt mode.
*                      Getting the conversion result is done in the interrupt
*                      handler of 71x_it.c file.
*********************************************************************************
* History:
* 31/07/2003: first issued
*********************************************************************************/
#include "71x_lib.h"

int main (void)
{
  u16 Conv_Res,value;

 #ifdef DEBUG
  debug();
 #endif /* DEBUG */

  // Configure the used analog input to HI_AIN
  GPIO_Config (????, 0x0001, ????);

  // Configure GPIO0 pins to output push-pull
  ????

  // Initialize the conveter register.
  ????

  // Configure the ADC prescaler to have a sampling frequency = 500Hz  ????(500);

  // Select the conversion mode=single channel
  ADC12_ModeConfig (????);

  // Select the channel to be converted
  ADC12_ChannelSelect(????);

  // Start the Converter
  ????

  // Infinite loop
  while(1)
  {
  // Wait until the availabiliy of data in the specific flags
  while (!ADC12_FlagStatus (????));

  // Get the conversion result from the correponding Data register
  Conv_Res = ADC12_ConversionValue(????);

  // Display the conversion result
  GPIO_ByteWrite(GPIO0,GPIO_LSB,0x0);

  if ((Conv_Res>=0x970)&&(Conv_Res<0xCB9))
      GPIO_BitWrite(GPIO0,0,1);

  if (Conv_Res>=0xCB9)
         GPIO_BitWrite(GPIO0,1,1);

  if(Conv_Res<=0x3C8)
    GPIO_BitWrite(GPIO0,2,1);

  if ((Conv_Res>0x3C8)&&(Conv_Res<=0x790))
         GPIO_BitWrite(GPIO0,3,1);
  }
}

/******************* (C) COPYRIGHT 2003 STMicroelectronics *****END OF FILE****/

⌨️ 快捷键说明

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