distance.c
来自「使用MC9S12DG128芯片」· C语言 代码 · 共 63 行
C
63 行
#include "includes.h"
/*********************************************************/
void dist_Func(void)
{
INT8U LcdDist[] = {"check distance "};
LcdWriteAll(LcdDist);
InitPA(); //读取CarDistance变量可以获得当前脉冲计数
ClearPA();
StartPA();
for(;;) {
//display PWM menu
while (KeyFlag == ON) {
KeyFlag = OFF;
if (ValueKey == Enter){CalDistance();}
else if (ValueKey == Exit) return; //if have exit key,go back
}
}
}
void CalDistance(void) {
INT16U Distance = 0;
for(;;) {
Distance = CarLocation;
LcdWrite16U(0x80,Distance,4);
Distance = CarDistance;
LcdWrite16U(0xC0,Distance,4);
while (KeyFlag == ON)
KeyFlag = OFF;
if (ValueKey == Exit) return; //if have exit key,go back
}
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?