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

📄 fet430_oa0_comp_01.c

📁 msp430开发c语言例程
💻 C
字号:
//******************************************************************************
//   MSP-FET430P430 Demo - OA0 Configured For Comparator Mode
//
//   Description; Configure OA0 of the MSP430FG439 for Comparator mode. In this
//   example, the OA0 is configured as a comparator. The comparator reference is
//   on the - input and comes from the integrated R ladder. The reference level
//   is selected with the OAFBR bits. The + terminal is connected to the OA0I0
//   signal at the pin.
//   //* MSP430FG439 Device Required*//
// 
//                MSP430FG439
//             -------------------
//         /|\|                XIN|-  
//          | |                   |
//          --|RST            XOUT|-
//            |                   |
//            |      P6.0/A0/OA0I0|<-  Input
//            |       P6.1/A1/OA0O|->  OA0 Output (comparator mode)
//            |                   |
//
//   M.Mitchell
//   Texas Instruments, Inc
//   April 2004
//   Built with IAR Embedded Workbench Version: 2.21B
//******************************************************************************
#include  <msp430xG43x.h>

void main(void)
{
  WDTCTL = WDTPW + WDTHOLD;             // Stop watchdog timer
  OA0CTL0 = OAPM_1 + OAADC1;            // Select inputs, power mode
  OA0CTL1 = OAFC_3 + OAFBR_1 + OARRIP;  // Mode, OAFBRx sets level
  
  LPM3;                                 // LPM3
}

⌨️ 快捷键说明

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