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

📄 main.c

📁 ARM STR710
💻 C
字号:
/*
P1.0  a
P1.1  b
P1.2  c
P1.3  d
P1.4  e
P1.5  f
P1.6  g

P1.8  Disp 0
P1.9  Disp 1
P1.10 Disp 2
P1.11 Disp 3
*/

#include "71x_lib.h"

const u8 b7SegmentTable[16] = {0x3F,    /* 0 */
                               0x06,    /* 1 */
                               0x5B,    /* 2 */
                               0x4F,    /* 3 */
                               0x66,    /* 4 */
                               0x6D,    /* 5 */
                               0x7D,    /* 6 */
                               0x07,    /* 7 */
                               0x7F,    /* 8 */
                               0x6F,    /* 9 */
                               0x77,    /* A */
                               0x7C,    /* B */
                               0x39,    /* C */
                               0x5E,    /* D */
                               0x79,    /* E */
                               0x71     /* F */
                              };
                             
  /*  Pointer to the variable to display */
  u16 *pCharToDisplay;
  /* DP to display */
  u8 bDP;

int main(void)
{
  #ifdef DEBUG
  debug();
  #endif

/*  Set system clock to 32 MHz-------------------------------------------------------*/

  /*  Configure the PLL with a multiplication factor = 16 and division factor = 4 */
  RCCU_PLL1Config(RCCU_Mul_16, RCCU_Div_4);

  /*  Set the APB2 clock to default */
  RCCU_PCLKConfig(RCCU_DEFAULT);

  /*  Set the RCLK to the PLL output */
  RCCU_RCLKSourceConfig(RCCU_PLL1_Output);

/*  EIC configuration -------------------------------------------------------------- */

  /*  Set the Timer 0 IRQ channel priority to 1 */
  EIC_IRQChannelPriorityConfig(T0TIMI_IRQChannel, 1);
  /*  Enable the Timer 0 IRQ channel interrupts */

  EIC_IRQChannelConfig(T0TIMI_IRQChannel, ENABLE);

  /*  Enable IRQ interrupts */
  EIC_IRQConfig(ENABLE);

/* GPIO 1 configuration ----------------------------------------------------------- */

  /*  Configure the GPIO 1 port to output Puch-Pull */
  GPIO_Config(GPIO1, 0xFFFF, GPIO_OUT_PP);

  /*  Disable all 7-segment displays */
  GPIO_WordWrite(GPIO1, 0);

/* TIM0 configuration ------------------------------------------------------------- */
  /* Configure the Prescaler to 0x02 to get an Overflow interrupt every 5.120 ms
     This will gives an update rate of 48.8 Hz*/

  /*  Inisialize the Timer 0 */
  TIM_Init( TIM0 );  

  /*  Configure the Timer 0 prescaler */
  TIM_PrescalerConfig ( TIM0, 0x02); 

  /*  Enable the Overflow Interrupt */
  TIM_ITConfig        ( TIM0, TIM_TO_IT, ENABLE);

  /*  Start the TIM0 Counter */
  TIM_CounterConfig   ( TIM0, TIM_START );

  /*  Configure the real time clock */
  RTC_PrescalerConfig (0x8000);

  /*  Get the RTC->CNTL register address */
  pCharToDisplay = (u16 *)RTC->CNTL;

  /*  Enable the third DP */
  bDP = 0x04;
  /*  infinite loop */
  while(1);

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

⌨️ 快捷键说明

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