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

📄 init.c

📁 单片机仿真电路里面对于初学者很有帮助
💻 C
字号:
/************************************************************
Copyright (C) Xiong,Hui at www.51embed.com
FileName: init.c
Author: Xiong,Hui huixiong73@gmail.com
Date:08/3/13
Description: initilize the SFRs and variales
Version: 1.0
Function List: 
    1. mcu_init();
	2. sys_init();
History: 
    1. Huixiong 08/3/13 1.0 build this moudle
***********************************************************/

#include "at89x52.H"
#include "init.H"
/*************************************************************
*  Function: mcu_init()
*  Description:	 initilize the SFRs of MCU
*  Calls: none
*  Called by: main()
*  Input:
*  Output:
*  Return:
*  Others:
*  History:
	1. Huixiong 08/3/13 created 
*************************************************************/
void mcu_init(void)
{
	TMOD = 0x21;		//timers' control mode
	TH0 = 0xF6; 		//timer0's 2.5ms interrupt (for AT89S52, system clock is 11.092MHz)
	TL0 = 0x00;
	TH1 = 0xFD; 		// 9600 Bds at 11.059MHz */
	TL1 = 0xFD; 		// 9600 Bds at 11.059MHz */
	PCON = 0x00;
	SCON = 0x50;		//serial communication control
	IP   = 0x00;
	TCON = 0x50;
	TI   = 0;
	RI   = 0;
	REN  = 1;			//enable serial uart's interruption
	IE   = 0x12;
	ES = 1; 			// Enable serial interrupt*/
	TR1 = 1; 			// Timer 1 run */
}
/*************************************************************
*  Function: sys_init()
*  Description:	 initilize the runtime varibales of system
*  Calls: none
*  Called by: main()
*  Input:
*  Output:
*  Return:
*  Others:
*  History:
	1. Huixiong 08/3/13 created
*************************************************************/
void sys_init(void)
{
	timer10msflag = FALSE; 
	testiicflag = 1;
	testledflag = 1;
	led_flag = 1;
	uartproflag = 1;

	lcd_init();
}

⌨️ 快捷键说明

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