?? func.c
字號(hào):
/************************************************
* 文件名:func.c *
* 文件功能:子函數(shù),包括: *
* 作者:xxlxws *
* 日期:2007-03-07 *
* 版本號(hào):1.0 *
************************************************/
#include <ioavr.h>
#include <intrinsics.h>
#include "mylib.h"
#include "common.h"
#include "main.h"
#include "init.h"
#include "func.h"
#include "inter.h"
extern struct _Led Led;
extern struct _Data Data;
extern struct _Count Count;
extern struct _Moto Moto_A,Moto_B,Moto_Mid,Moto_HT;
extern uint8 Mass[4];
extern uint8 LedCode[10];
extern uint8 Crc[12];
/************************************************
* 函數(shù)名:CRC_Check *
* 入口參數(shù):無(wú) *
* 出口參數(shù):無(wú) *
* 作者:xxlxws *
* 日期:2007-05-29 *
* 函數(shù)功能:CRC校驗(yàn) *
************************************************/
void CRC_Check(void)
{
uint8 i,j,tmp;
uint16 dat = 0xffff;
for(i=0; i<CRC_BYTE; i++) /*要校驗(yàn)字節(jié)數(shù)*/
{
dat ^= Crc[i];
for(j=0; j<8; j++)
{
tmp = (dat&0x01);
dat >>= 1;
if(tmp == 1)
{
dat ^= 0xa001;
}
}
}
Data.Crc = dat;
return;
}
/************************************************
* 函數(shù)名:Led_Disp *
* 入口參數(shù):無(wú) *
* 出口參數(shù):無(wú) *
* 作者:xxlxws *
* 日期:2006-12-13 *
* 函數(shù)功能:顯示10位數(shù)據(jù) *
************************************************/
void Led_Disp(void)
{
static uint8 i = 0x00;
uint8 temp;
i++;
if(i >= 0x05)
{
i = 0x00;
}
temp = Led.Sel[i]; /*LED位選信號(hào)*/
Led_Onebyte(temp);
temp = Led.Seg[i];
Led_Onebyte(temp);
RCK = 0;
RCK = 1;
RCK = 0;
return;
}
/************************************************
* 函數(shù)名:Moto_Mode_Set *
* 入口參數(shù):無(wú) *
* 出口參數(shù):無(wú) *
* 作者:xxlxws *
* 日期:2007-05-15 *
* 函數(shù)功能:模式設(shè)置 *
************************************************/
void Moto_Mode_Set(void)
{
uint8 temp;
if(Moto_Mid.Flag)
{
if(Data.Mode == 0x01)
{
if(((Moto_Mid.Count >= 1) && (Moto_Mid.Count < 6)) ||
((Moto_Mid.Count >= 10) && (Moto_Mid.Count < 16)) ||
((Moto_Mid.Count >= 20) && (Moto_Mid.Count < 28)) ||
((Moto_Mid.Count >= 52) && (Moto_Mid.Count < 66)) ||
((Moto_Mid.Count >= 70) && (Moto_Mid.Count < 83)))
{
temp = Data.Mass_Max;
}
else if(Moto_Mid.Count >= 102)
{
temp = 0;
Moto_Mid.Count = 0;
}
else
{
temp = 0;
}
}
else if(Data.Mode == 0x02)
{
temp = Data.Mass_Max;
if(Moto_Mid.Count < 112)
{
temp++;
}
else if(Moto_Mid.Count < 224)
{
temp--;
}
else if(Moto_Mid.Count >= 300) //375
{
temp = 0;
Moto_Mid.Count = 0;
}
else
{
temp = 0;
}
}
else if(Data.Mode == 0x03)
{
temp = Data.Mass_Max;
Moto_Mid.Count = 0;
}
else if(Data.Mode == 0x04)
{
temp = Moto_Mid.Mass;
if(Moto_Mid.Count >= 0x03)
{
Moto_Mid.Count = 0x00;
temp--;
if(temp < (Data.Mass_Max-0x40))
{
temp = Data.Mass_Max;
}
}
}
}
else
{
temp = 0x00;
Moto_Mid.Count = 0;
}
Moto_Mid.Mass = temp;
return;
}
?? 快捷鍵說(shuō)明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號(hào)
Ctrl + =
減小字號(hào)
Ctrl + -