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

📄 init_sys.c

📁 ks0108 avr单片机1284显示
💻 C
字号:
/*----------------------------------------------------------------------------*-
   
   Source Name   :  Init_SYS.C (v1.00)  

  ---------------------------------------------------------------------------- 
   COPYRIGHT 
   ---------	

   Created Date  :  2008.03.01
   Created By    :  HOCHIEN
   Modified By   :
   Modified Date :
   Version       :  2.0  
   Description   :  Global system initialization source files. 
   
   * * * This program is from : www.ICEworksop.com * * *

-*----------------------------------------------------------------------------*/

#include "Main.H"
#include "Init_SYS.H"

// ------ Private function prototypes ----------------------------------------

static void Port_Init(void);

/*----------------------------------------------------------------------------*-

   Port_Init() 
   
   Globally set up all the port pins to a certain state. 

-*----------------------------------------------------------------------------*/
static void Port_Init(void)
   {
   PORTA = 0x00;
   DDRA  = 0x00;
   PORTB = 0x00;
   DDRB  = 0x00;
   PORTC = 0x00;
   DDRC  = 0x00;
   PORTD = 0x00;
   DDRD  = 0x00;
   }

/*----------------------------------------------------------------------------*-

   Init_System()
   
   System initialization function.
   Call this routine to initialize all peripherals 

-*----------------------------------------------------------------------------*/  
void Init_System(void)
   {
   OSCCAL = 0xA7; // Calibrate internal RC 1MHz
   
   // Stop errant interrupts until set up
   CLI(); // Disable all interrupts
   
   Port_Init(); // Set port
   
   MCUCR = 0x00;
   GICR  = 0x00;
   TIMSK = 0x00; // Timer interrupt sources
   SEI(); // Re-enable interrupts
   // All peripherals are now initialized
   } 

/*----------------------------------------------------------------------------*-
  ---- END OF FILE -----------------------------------------------------------
-*----------------------------------------------------------------------------*/

⌨️ 快捷键说明

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