新手编程,大家帮帮忙,谢谢
下面程序有没有懂的,帮我每一句注释一下,谢谢了unsigned char Function_is_begin = 0;
unsigned char SettingAngle = 0;
static volatile unsigned char TempAngle = 0;
static volatile unsigned int Openloop_PWM = 100;
static volatile unsigned char Openloop_Step = 5;
void Key1_Press(unsigned char ktype)
{
Function_is_begin = 0;
PWM_Off();
if(++System_Function > 5)
System_Function = 0;
switch(System_Function){
case 0:
Openloop_Step = 5;
Openloop_PWM = 100;
PWM_OutPut(Openloop_PWM);
//Digit_Set(STEP_POS, 2);
LCD12864_SetXY(0,2);
LCD12864_PutNumber(2);
//// Digit_Number(1, Openloop_PWM);
break;
case 1:
// Digit_Off(STEP_POS);
TempAngle = 45;
SettingAngle = 45;
case 2:
case 3:
LCD12864_SetXY(0,4);
LCD12864_PutNumber(TempAngle/10);
LCD12864_SetXY(0,5);
LCD12864_PutNumber(TempAngle%10);
//Digit_Set(SETTING_POS0, TempAngle/10);
//Digit_Set(SETTING_POS1, TempAngle%10);
// Digit_FlashMode(SETTING_POS0);
//Digit_FlashMode(SETTING_POS1);
break;
case 4:
break;
case 5:
//Digit_Off(SETTING_POS0);
//Digit_Off(SETTING_POS1);
break; }
//Digit_Set(0, System_Function); // 显示系统功能编号
LCD12864_SetXY(0,0);
LCD12864_PutNumber(System_Function);
}
void Key2_Press(unsigned char ktype) {
switch(System_Function){
case 0:
switch(Openloop_Step){
case 1:
Openloop_Step = 5;
// Digit_Set(STE.
// P_POS, 2);
LCD12864_SetXY(0,2);
LCD12864_PutNumber(2);
break;
case 5:
Openloop_Step = 10;
// Digit_Set(STEP_POS, 3);
LCD12864_SetXY(0,2);
LCD12864_PutNumber(3);
break;
case 10:
Openloop_Step = 50;
//Digit_Set(STEP_POS, 4);
LCD12864_SetXY(0,2);