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

📄 main.c

📁 是基于单片机的温度控制程序
💻 C
字号:
/*
****************************************************************************************************
是否使能省电模式
在省电模式下,只有定时器2工作,其它功能部件均关闭
应将确定不使用的引脚置为输出,并输出低电平
在main中除设定引脚电平,和使能省电模式外,应不写其它语句
在熔丝配置时,设定晶振频率为内部128K,关闭看门狗,禁止Brown-out
如果使能省电模式,应声明如下语句
#define Power_Save_Mode
****************************************************************************************************
*/		
/*
****************************************************************************************************
外设选择,必须包含
****************************************************************************************************
*/
#include ".\SelPeripheral.h"
/*
****************************************************************************************************
驱动层,必须包含
****************************************************************************************************
*/
#include "..\driver\config.h"
/*
****************************************************************************************************
驱动中间层,选择包含
已完成的中间层驱动程序
		Delay.h:延时中间层驱动程序
		I2C.h:I2C中间层驱动程序,使用该程序应进行如下硬件映射
					#define SDA       (1<<x)
					#define SCL       (1<<x)
					#define I2C_PORT  PORTx
					#define I2C_DIR	  DDRx
					#define I2C_IN    PINx
****************************************************************************************************
*/
#include "..\driver\MiddleLayer\delay.h"	
/*
****************************************************************************************************
硬件映射层,必须包含
****************************************************************************************************
*/
#include	".\HAL.h"
/*
****************************************************************************************************
应用层,选择包含
已完成的应用层程序
		SD2300.h:威帆公司时钟芯片,使用该硬件,应首先正确初始化相应I2C
		HC595_165.h	HC595_165应用程序,如果使用应按下列方法进行初始化
				注:在使用时CS_595,CS_165,Clock_595_165,MISO_165,MOSI_595应使用同一个端口				
				#define CS_595					BITx		
				#define CS_165					BITx		
				#define Clock_595_165		BITx		
				#define	MISO_165				BITx		
				#define	MOSI_595				BITx		
				#define HC595_165_PORT	PORTx
				#define HC595_165_DIR		DDRx
				#define HC595_165_IN		PINx				
****************************************************************************************************
*/
#ifdef Per_OCMJ2X8C
	#include "..\Application\OCMJ2X8C.h"
#endif
#ifdef Per_SerialEncode
	#include "..\Application\SerialEncode.h"
#endif
#ifdef Per_SerialDecode
	#include "..\Application\SerialDecode.h"	
#endif
#ifdef Per_HC595_165
	#include "..\Application\HC595_165.h"
#endif 
#ifdef Per_AT45DB161D
	#include "..\Application\AT45DB161D.h"
#endif
#include "..\Application\VS1003B.h"
/*
****************************************************************************************************
算法层函数,应包含
****************************************************************************************************
*/
#include "..\Driver\Algorithm\Common.h"
/*
****************************************************************************************************
逻辑层函数,应包含
****************************************************************************************************
*/
#include ".\LogicFunction.h"
/*
****************************************************************************************************
用户程序
****************************************************************************************************
*/
#include ".\Main_Logic.c"
#ifdef Per_Uart0
    	#include ".\UART0_INT.c"
#endif
#ifdef Per_Timer0
    	#include ".\Timer0_INT.c"
#endif
#ifdef Per_Timer1
    	#include ".\Timer1_INT.c"
#endif
#ifdef Per_Timer2
    	#include ".\Timer2_INT.c"
#endif
#ifdef Per_INT0
	#include ".\INT0_INT.c"
#endif
#ifdef Per_INT1
	#include ".\INT1_INT.c"
#endif
#ifdef Per_PORTB_PCINT
    	#include ".\PORTB_PCINT.c"
#endif
#ifdef Per_PORTC_PCINT
    	#include ".\PORTC_PCINT.c"
#endif
#ifdef Per_PORTD_PCINT
    	#include ".\PORTD_PCINT.c"
#endif
/*
***************************************************************
逻辑实现
***************************************************************
*/
int main(void)
{
	/*
	***************************************************************
	目标板初始化
	***************************************************************
	*/
	Target_Init();
	/*
	***************************************************************
	初始化芯片外部设备
	***************************************************************
	*/
	#ifdef Per_OCMJ2X8C 
		OCMJ2X8C_Init();
	#endif	
	#ifdef Per_HC595_165
		HC595_165_Init();
	#endif
	#ifdef Per_AT45DB161D	
		AT45DB161D_Init();
	#endif
	VS1003B_Init();
        /*
	***************************************************************
	调用Main_Logic函数
	***************************************************************
	*/
        Main_Logic();	
        /*
	***************************************************************
	返回0,永不发生
	***************************************************************
	*/	
	return 0;
}





⌨️ 快捷键说明

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