📄 sysinit.c
字号:
/********************************************
公司名称:
文 件 名:
版 本 号:
程序设计:
说 明:
完成日期:
修改日期:
功能摘要:
**********************************************/
#define _SysInit
#include "includes.h"
void Timer0Init(void);
void WatchDogInit(void);
void SysInit(void);
void PinInit(void);
//----------------------------
void SysInit(void)
{
OS_CLOSE_INT();
PinInit();
Timer0Init();
WatchDogInit();
bit_shut();
LoadFunData();
UART_Init();
Rest5460A();
Initi5460A();
LoadCalibration();
CountLag();
OS_OPEN_INT();
}
//-------------------------------------------------
void Timer0Init(void)
{
TIMSK |= (1 << TOIE0) | (1 << TOIE1); //开定时器0\1溢出中断 TIMSK中断屏蔽寄存器
TCCR0 |= (1 << CS00) | (1 << CS01); //64分频
TCNT0 = 256 - (uint32)((float)F_CPU * CLOCK_TIME0 / F_N_TIME0 / 1000); //1MS
TCCR1B |= (1 << CS10) | (1 << CS11); //64分频
TCNT1 = 65536 - (uint32)((float)F_CPU * CLOCK_TIME1 / F_N_TIME1 / 1000); //10MS
}
//--------------------------------------------------
void WatchDogInit(void)
{ wdt_enable(WDTO_1S); } //看门狗初始化,溢出时间为1S
//--------------------------------------------------
void PinInit(void)
{
DDRB = 0xc7;
PORTB = 0xff;
DDRC = 0xf7;
PORTC = 0xff;
DDRD = 0xff;
PORTD = 0xff;
// AlarmSwitch= 0x01;
IO_HighAlarm = ON;
fH_Alarm = OFF;
IO_LowAlarm = ON;
fL_Alarm = OFF;
}
//--------------------------------------------------
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -