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

📄 board.c

📁 msp430fg4618 LCD 显示程序
💻 C
字号:
//******************************************************************************
//   MSP430xG46x Demo - Software Toggle P5.1
//
//   Description: Toggle P5.1 by xor'ing P5.1 inside of a software loop.
//   ACLK = 32.768kHz, MCLK = SMCLK = default DCO
//
//                   MSP430xG461x
//             -----------------------
//         /|\|                       |
//          | |                   P2.2|-->LED1
//          --|RST                P2.1|-->LED2
//            |                   P5.1|-->LED4
//            |                       |
//      SW1-->|P1.0                   |        SoftBaugh SBLCDA4 4-mux LCD
//      SW2-->|P1.1           P10.5/S4|-->S0-->PIN14 (1A_1B_1C_1D)
//            |               P10.4/S5|-->S1-->PIN13 (1F_1G_1E_DP1)
//            |               P10.3/S6|-->S2-->PIN12 (2A_2B_2C_2D)
//            |               P10.2/S7|-->S3-->PIN11 (2F_2G_2E_DP2)
//            |               P10.1/S8|-->S4-->PIN10 (3A_3B_3C_3D)
//            |               P10.0/S9|-->S5-->PIN9  (3F_3G_3E_COL3)
//            |               P9.7/S10|-->S6-->PIN8  (4A_4B_4C_4D)
//            |               P9.6/S11|-->S7-->PIN7  (4F_4G_4E_DP4)
//            |               P9.5/S12|-->S8-->PIN6  (5A_5B_5C_5D)
//            |               P9.4/S13|-->S9-->PIN5  (5F_5G_5E_COL5)
//            |               P9.3/S14|-->S10->PIN4  (6A_6B_6C_6D)
//            |               P9.2/S15|-->S11->PIN3  (6F_6G_6E_DP6)
//            |               P9.1/S16|-->S12->PIN2  (7A_7B_7C_7D)
//            |               P9.0/S17|-->S13->PIN1  (7F_7G_7E_DP7)
//            |               P8.7/S18|-->S14->PIN19 (F5_PR_P4_P3)
//            |               P8.6/S19|-->S15->PIN20 (F1_F2_F3_F4)
//            |               P8.5/S20|-->S16->PIN21 (PL_P0_P1_P2)
//            |               P8.4/S21|-->S17->PIN22 (AU_AR_AD_AL)
//            |               P8.3/S22|-->S18->PIN23 (BT_B1_B0_BB)
//            |               P8.2/S23|-->S19->PIN24 (ANT_A2_A1_A0)
//            |               P8.1/S24|-->S20->PIN25 (ENV_TX_RX_8BC)
//            |               P8.0/S25|-->S21->PIN26 (DOL_ERR_MINUS_MEM)
//            |                   COM3|-->COM3 (COM3)
//            |                   COM2|-->COM2 (COM2)
//            |                   COM1|-->COM1 (COM1)
//            |                   COM0|-->COM0 (COM0)
//            |                       |
//
//
//   G. Morton
//   Texas Instruments Inc.
//   February 2007
//   Built with IAR Embedded Workbench Version: 3.42A
//******************************************************************************
#include <Board.h>
#include <LCD.h>


//
// Function Declarations
//
void initBasicTimer(void);
void initPortPins(void);





void main(void)
{
  WDTCTL = WDTPW + WDTHOLD;                 // Stop WDT
  FLL_CTL0 |= XCAP18PF;                     // Set load cap for 32k xtal

  initPortPins();                           // Initialize port pins
  initBasicTimer();                         // Initialize basic timer
  initLCD_A();                              // Initialize LCD_A

  testAll();

  for(;;)
  {
    _BIS_SR(LPM3_bits + GIE);               // LPM3, enable interrupts

    testChar();
    testSpecialChar();
    testSigLvl();
    testBatt();
    testPwrLvl();
    testFunc();
    testArrow();
    testSymbol();
  }
}


// Basic Timer Interrupt Service Routine
#pragma vector=BASICTIMER_VECTOR
__interrupt void basic_timer_ISR(void)
{
  P2OUT ^= PIN2+PIN1;                       // Toggle P2.2,1
  P5OUT ^= PIN1;                            // Toggle P5.1

  LPM3_EXIT;
}


//
// Initialize port pins
//
void initPortPins(void)
{
  P2DIR = PIN2+PIN1;                        // Set P2.2,1 as outputs
  P5DIR = PIN1;                             // Set P5.1 as output
  P2OUT = PIN1;                             // Set P2.1 to 1
}


//
// Initialize basic timer
//
void initBasicTimer(void)
{
  // Basic timer setup
  // Set ticker to 32768/(256*128)
  // Enable BT interrupt
  BTCTL = BT_fCLK2_DIV128 | BT_fCLK2_ACLK_DIV256;
  IE2 |= BTIE;
}


⌨️ 快捷键说明

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