📄 init_.c
字号:
#include "Def_.h"
/*----------------------------------------------------
初始化函数等
----------------------------------------------------*/
#if USE_INIT_INPT
void InitInpt(void)
/*
所用到的中断初始化
*/
{
TMOD = 0x22;
TR0 = 1;
ET0 = 1; /* 允许中断 */
TL0 = 0xff-((U08)(T0_OVERFLOW_COUNT));
TH0 = 0xff-((U08)(T0_OVERFLOW_COUNT));
TR1 = 1;
ET1 = 0; /* 禁止中断 */
TL1 = T1_INIT_COUNT;
TH1 = T1_INIT_COUNT;
TR2 = 1;
ET2 = 0; /* 禁止中断 */
T2CON = 0x05;
SCON = 0x50; /* 串口方式2 */
PCON = 0x80; /* 双倍 */
ES = 1; /* 允许中断 */
IE |= 0x80;
}
#endif
#if USE_INIT_VAR
void InitVar(void)
/*
变量初始化
*/
{
U08 i;
SerSendPos = 0x00;
SerRecPos = 0x00;
for(i=0;i<SER_SEND_BUFF_MAX;i++)
SerSendBuff[i] = 0x00;
for(i=0;i<SER_REC_BUFF_MAX;i++)
SerRecBuff[i] = 0x00;
Flag1ms = 0;
Flag10ms = 0;
DallasChar = 0x55;
for(i=0; i<DALLAS_SEND_BUFF_MAX; i++)
DallasSendBuff[i] = 0x00;
for(i=0; i<DALLAS_REC_BUFF_MAX;i++)
DallasRecBuff[i] = 0x00;
DallasSendPos = 0x00;
DallasRecPos = 0x00;
CrcU08MyDat = 0x00;
CrcU16MyDat = 0x0000;
DallasAddr = 0x0000;
CrcU16RdDat = 0x0000;
for(i=0; i<TEMP_BUFF_8BYTE_SIZE; i++)
TempBuff8Byte[i] = 0x00;
RelayStat = 0x00000000;
}
#endif
#if USE_INIT_PORT
void InitPort(void)
/*
IO端口初始化
*/
{
DALLAS_PROG_0;
P0 = 0x00;
PExtEn = 1;
PExtLe_1 = 0;
PExtLe_2 = 0;
PExtLe_3 = 0;
PExtLe_4 = 0;
PExtLe_5 = 0;
PExtLe_6 = 0;
PExtLe_7 = 0;
PFakeI2cClk = 1;
PFakeI2cDatOut = 0;
PFakeI2cDatIn = 0;
PAdd0 = 1;
PAdd1 = 1;
PAdd2 = 1;
}
#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -