📄 main.c
字号:
{ 110,108,110,110,110,113,49,4,(*disp453)}, //modify fwd/rev:
{ 111,109,107,111,111,113,49,4,(*disp454)}, //modify jog freq. in Hz
{ 112,112,108,112,112,113,49,4,(*disp455)}, //modify jog time in sec.:
{ 113,113,113,113,113,113,113,113,(*commu26)}, //send modified
{ 114,114,114,114,114,114,49,4,(*disp456)}, //display modified
{ 115,116,115,119,119,123,51,4,(*disp460)}, //DC mag. Time :
{ 116,117,115,120,120,123,51,4,(*disp461)}, //DC mag. current
{ 117,118,116,121,121,123,51,4,(*disp462)}, //DC braking time
{ 118,118,117,122,122,123,51,4,(*disp463)}, //DC braking current:
{ 119,116,119,119,119,123,51,4,(*disp464)}, //modify DC mag. Time
{ 120,117,115,120,120,123,51,4,(*disp465)}, //modify mag. current
{ 121,118,116,121,121,123,51,4,(*disp466)}, //modify braking time
{ 122,122,117,122,122,123,51,4,(*disp467)}, //modify braking current
{ 123,123,123,123,123,123,123,123,(*commu27)}, //send modified
{ 124,124,124,124,124,124,51,4,(*disp468)}, //display modified
{ 125,126,125,131,131,137,53,4,(*disp470)}, //DC unblance limit:
{ 126,127,125,132,132,137,53,4,(*disp471)}, //output overvoltage limit
{ 127,128,126,133,133,137,53,4,(*disp472)}, //output over current limit:
{ 128,129,127,134,134,137,53,4,(*disp473)}, // trans overtemp limit
{ 129,130,128,135,135,137,53,4,(*disp474)}, //cabinet overtemp. limit:
{ 130,130,129,136,136,137,53,4,(*disp475)}, //motor overtemp. limit:
{ 131,126,131,131,131,137,53,4,(*disp476)}, //modify DC unblance limit:
{ 132,127,125,132,132,137,53,4,(*disp477)}, //modify output overvoltage limit
{ 133,128,126,133,133,137,53,4,(*disp478)}, //modify output over current limit:
{ 134,129,127,134,134,137,53,4,(*disp479)}, //modify trans overtemp limit
{ 135,130,128,135,135,137,53,4,(*disp4710)}, //modify cabinet overtemp. limit:
{ 136,136,129,136,136,137,53,4,(*disp4711)}, //modify motor overtemp. limit:
{ 137,137,137,137,137,137,137,137,(*commu28)}, //send modified
{ 138,138,138,138,138,138,53,4,(*disp4712)}, //display modified
{ 139,140,139,147,147,155,55,4,(*disp480)}, //scale of Vab:
{ 140,141,139,148,148,155,55,4,(*disp481)}, //scale of Vbc:
{ 141,142,140,149,149,155,55,4,(*disp482)}, //offset of Vab:
{ 142,143,141,150,150,155,55,4,(*disp483)}, //offset of Vbc:
{ 143,144,142,151,151,155,55,4,(*disp484)}, //scale of current a
{ 144,145,143,152,152,155,55,4,(*disp485)}, //scale of current c
{ 145,146,144,153,153,155,55,4,(*disp486)}, //offset of current a
{ 146,146,145,154,154,155,55,4,(*disp487)}, //offset of current c
{ 147,140,147,147,147,155,55,4,(*disp488)}, //modify scale of Vab:
{ 148,141,139,148,148,155,55,4,(*disp489)}, //modify scale of Vbc:
{ 149,142,140,149,149,155,55,4,(*disp4810)}, //modify offset of Vab:
{ 150,143,141,150,150,155,55,4,(*disp4811)}, //modify offset of Vbc:
{ 151,144,142,151,151,155,55,4,(*disp4812)}, //modify scale of current a
{ 152,145,143,152,152,155,55,4,(*disp4813)}, //modify scale of current c
{ 153,146,144,153,153,155,55,4,(*disp4814)}, //modify offset of current a
{ 154,154,145,154,154,155,55,4,(*disp4815)}, //modify offset of current c
{ 155,155,155,155,155,155,155,155,(*commu29)}, //send modified
{ 156,156,156,156,156,156,55,4,(*disp4816)}, //display modified
{ 157,159,157,157,157,158,57,4,(*disp501)}, //第五层phase A:
{ 158,158,158,158,158,158,158,158,(*commu30)}, //request
{ 159,161,157,159,159,160,57,4,(*disp502)}, //phase B:
{ 160,160,160,160,160,160,160,160,(*commu31)}, //request
{ 161,161,159,161,161,162,57,4,(*disp503)}, //phase C:
{ 162,162,162,162,162,162,162,162,(*commu32)}, //request
{ 163,164,163,163,163,163,58,4,(*disp511)}, //Vab, Ia->Vneutral
{ 164,164,163,164,164,164,58,4,(*disp512)}, //output power->sum kWh
{ 165,166,165,165,165,165,60,4,(*disp521)}, //main switch state->motor state
{ 166,166,165,166,166,166,60,4,(*disp522)}, //UPS state->current time
{ 167,169,167,167,167,168,100,4,(*disp531)}, //v/f relation:
{ 168,168,168,168,168,168,168,168,(*commu33)}, //request
{ 169,170,167,173,173,177,100,4,(*disp532)}, //ramp-up time, in sec.
{ 170,171,169,174,174,177,100,4,(*disp533)}, //ramp-down time, in sec.
{ 171,172,170,175,175,177,100,4,(*disp534)}, //ramp type:
{ 172,172,171,176,176,177,100,4,(*disp535)}, //boost starting voltage:
{ 173,170,167,173,173,177,100,4,(*disp536)}, //modify ramp-up time, in sec.
{ 174,171,169,174,174,177,100,4,(*disp537)}, //modify ramp-down time, in sec.
{ 175,172,170,175,175,177,100,4,(*disp538)}, //modify ramp type:
{ 176,176,171,176,176,177,100,4,(*disp539)}, //modify boost starting voltage:
{ 177,177,177,177,177,177,177,177,(*commu34)}, //send modified
{ 178,178,178,178,178,178,100,4,(*disp5310)}, //display modified
{ 179,180,179,179,179,179,157,4,(*disp611)},//第六层unit 1: state/Vdc->unit 5: state/Vdc
{ 180,180,179,180,180,180,157,4,(*disp612)},//unit 6: state/Vdc
{ 181,182,181,183,183,185,167,4,(*disp621)},//linear : k
{ 182,188,181,184,184,185,167,4,(*disp622)},//parabolic_1
{ 183,182,183,183,183,185,167,4,(*disp631)},//modify linear : k
{ 184,188,181,184,184,185,167,4,(*disp632)},//modify parabolic_1
{ 185,185,185,185,185,185,185,185,(*commu35)},//send modified
{ 186,186,186,186,186,186,167,4,(*disp633)},//display modified
{ 187,187,187,187,187,187,187,187,(*commu36)}, //request basic V/f control
{ 188,188,182,189,189,185,167,4,(*disp623)},//parabolic_2
{ 189,189,182,189,189,185,167,4,(*disp634)},//modify parabolic_2
/*machine up*/
{ 190,190,190,190,190,190,190,190,(*commu100)},//communication signal
{ 191,191,191,191,191,191,5,191,(*disp100)},//communication OK
{ 192,192,192,192,192,192,5,192,(*disp101)},//self-checking
{ 193,193,193,193,193,193,5,193,(*disp102)},//self-checking finished
{ 194,194,194,194,194,194,5,194,(*disp103)},//main switch closed
{ 195,195,195,195,195,195,5,195,(*disp104)},//charging finished
{ 196,196,196,196,196,196,5,196,(*disp105)},//release ok
{ 197,197,197,197,197,4,5,197,(*disp106)},//speeding up finished
{ 198,198,198,198,198,198,198,198,(*disp107)},//V I F
{ 199,199,199,199,199,199,199,199,(*disp108)},//normal down
{ 200,200,200,200,200,200,200,200,(*disp109)},//fault down
/*password*/
{ 201,201,201,201,201,202,5,4,(*disp110)},
{ 202,202,202,202,202,202,5,4,(*disp111)},
};
INT_1(); /* 调初始化函数 */
CLEAR(); /* 调清屏函数 */
/*UART init*/
Uart_init();
O_X=0x1d;
O_Y=0x0f;
P3_5=1;
//dispes_f(0,3,11,"I LOVE YOU:"); //"Entry:"
//dispes(0,5,11,"I LOVE YOU:");
while(1)
{
key=scankey();
if(keybutton==1)
{key2=key;
P3_4=0;
P3_5=1;}
if(!keybutton)
{ P3_4=1;
//********************
if(key2==8)
{commu110();}
else if(key2==10)
{commu111();}
//********************
switch(key2)
{
case 1: //回车键,找出新的菜单状态编号
{
KeyFuncIndex=KeyTab[KeyFuncIndex].KeyCrState;
KeyState=1;
break;
}
case 7: //向上键,找出新的菜单状态编号
{
KeyFuncIndex=KeyTab[KeyFuncIndex].KeyUpState;
KeyState=1;
break;
}
case 6: //向下键,找出新的菜单状态编号
{
KeyFuncIndex=KeyTab[KeyFuncIndex].KeyDnState;
KeyState=1;
break;
}
case 2: //退出键,找出新的菜单状态编号
{
KeyFuncIndex=KeyTab[KeyFuncIndex].KeyEsState;
KeyState=1;
break;
}
case 3: //返回键,找出新的菜单状态编号
{
KeyFuncIndex=KeyTab[KeyFuncIndex].KeyFhState;
KeyState=1;
break;
}
case 5: //向左键
{
KeyFuncIndex=KeyTab[KeyFuncIndex].KeyLeft;
KeyState=1;
break;
}
case 4: //向右键
{
KeyFuncIndex=KeyTab[KeyFuncIndex].KeyRight;
KeyState=1;
break;
}
default: //按键错误的处理
// ......
break;
}
if(KeyState||Keyfirst)
{
KeyFuncPtr=KeyTab[KeyFuncIndex].CurrentOperate;
(*KeyFuncPtr)(); //执行当前按键的操作
KeyState=0;
key2=0;
} ;
};
}
}
/*display function difinetion*/
void CLEAR1()
{blank_line(2);
blank_line(3);
blank_line(4);
blank_line(5);
blank_line(6);
blank_line(7);
blank_line(8);
blank_line(9);
blank_line(10);
blank_line(11);
blank_line(12);
blank_line(13);
}
void disp11()
{ CLEAR1();
}
void disp12()
{ CLEAR1();
}
void disp13()
{switch(state_num)
{case 1: Keyfirst=1;
KeyFuncIndex=192;
break;
case 2: Keyfirst=1;
KeyFuncIndex=193;
break;
case 3: Keyfirst=1;
KeyFuncIndex=194;
break;
case 4: Keyfirst=1;
KeyFuncIndex=195;
break;
case 5: Keyfirst=1;
KeyFuncIndex=196;
break;
case 6: Keyfirst=1;
KeyFuncIndex=197;
break;
}
}
void disp211()
{ CLEAR1();
Keyfirst=0;
dispes_f(0,3,8,"display:"); //"display:"
dispes(0,5,12,"programming:"); //"programming:"
dispes(0,7,11,"fault ack.:"); //"fault ack.:"
dispes(0,11,26,"Device is normal operating");
//kai shi shua xing
length=2;
send(head);
send(length);
send(116);
verify=head^length^116;
send(verify);
}
void disp212()
{ CLEAR1();
dispes(0,3,8,"display:"); //"display:"
dispes_f(0,5,12,"programming:"); //"programming:"
dispes(0,7,11,"fault ack.:"); //"fault ack.:"
dispes(0,11,26,"Device is normal operating");
//kai shi shua xing
length=2;
send(head);
send(length);
send(116);
verify=head^length^116;
send(verify);
}
void disp213()
{ CLEAR1();
dispes(0,3,8,"display:"); //"display:"
dispes(0,5,12,"programming:"); //"programming:"
dispes_f(0,7,11,"fault ack.:"); //"fault ack.:"
dispes(0,11,26,"Device is normal operating");
//kai shi shua xing
length=2;
send(head);
send(length);
send(116);
verify=head^length^116;
send(verify);
}
void disp214(){;}
void disp215()
{ CLEAR1();
dispes(0,5,20,"fault message acked."); //"fault message acked."
}
void disp301()
{ CLEAR1();
dispes_f(0,3,24,"operating stats/measure:"); //"operating stats/measure:"
dispes(0,5,15,"history events:"); //"history events:"
}
void disp302()
{ CLEAR1();
dispes(0,3,24,"operating stats/measure:"); //"operating stats/measure:"
dispes_f(0,5,15,"history events:"); //"history events:"
}
void disp303(){;}
void disp311()
{CLEAR1();
dispes_f(0,3,18,"date/time setting:"); //"date/time setting:"
dispes(0,5,9,"language:"); //"language:"
dispes(0,7,6,"scale:"); //"scale:"
dispes(0,9,21,menu_str[10]); //"motor specifications:"
dispes(0,11,17,menu_str[11]); //"freqency setting:"
//ping bi shua xing
length=2;
send(head);
send(length);
send(115);
verify=head^length^115;
send(verify);
Keyfirst=0;
}
void disp312() //display current time year_f
{CLEAR1();
dispes_f(0,3,5,"year:");
dispes(0,5,6,"month:");
dispes(0,7,4,"day:");
dispes(0,9,5,"hour:");
dispes(0,11,7,"minute:");
dispint_f(10,3,200);
dispint_f(11,3,buf[4]);
dispint(10,5,buf[6]);
dispint(10,7,buf[8]);
dispint(10,9,buf[10]);
dispint(10,11,buf[12]);
}
void disp313() //month_f
{
blank_line(3);
blank_line(5);
dispes(0,3,5,"year:");
dispint(10,3,200);
dispint(11,3,buf[4]);
dispes_f(0,5,6,"month:");
dispint_f(10,5,buf[6]);
}
void disp314() //day_f
{ blank_line(5);
blank_line(7);
dispes(0,5,6,"month:");
dispint(10,5,buf[6]);
dispes_f(0,7,4,"day:");
dispint_f(10,7,buf[8]);
}
void disp315() //hour_f
{blank_line(7);
blank_line(9);
dispes(0,7,4,"day:");
dispint(10,7,buf[8]);
dispes_f(0,9,5,"hour:");
dispint_f(10,9,buf[10]);
}
void disp316() //minute_f
{blank_line(9);
blank_line(11);
dispes(0,9,5,"hour:");
dispint(10,9,buf[10]);
dispes_f(0,11,7,"minute:");
dispint_f(10,11,buf[12]);
;}
void disp317() //modify year
{ blank_point(11,3,2);
switch(key2)
{ case 5: buf[4]-=1;
dispint_f(11,3,buf[4]);
break;
case 4: buf[4]+=1;
dispint_f(11,3,buf[4]);
break;
default: break;
}
}
void disp318() //modify month
{ blank_point(10,5,2);
switch(key2)
{ case 5: buf[6]-=1;
dispint_f(10,5,buf[6]);
break;
case 4: buf[6]+=1;
dispint_f(10,5,buf[6]);
break;
default: break;
}
}
void disp319() //modify day
{ blank_point(10,7,2);
switch(key2)
{ case 5: buf[8]-=1;
dispint_f(10,7,buf[8]);
break;
case 4: buf[8]+=1;
dispint_f(10,7,buf[8]);
break;
default: break;
}
}
void disp3110() //modify hour
{ blank_point(10,9,2);
switch(key2)
{ case 5: buf[10]-=1;
dispint_f(10,9,buf[10]);
break;
case 4: buf[10]+=1;
dispint_f(10,9,buf[10]);
break;
default: break;
}
}
void disp3111() //modify minute
{ blank_point(10,11,2);
switch(key2)
{ case 5: buf[12]-=1;
dispint_f(10,11,buf[12]);
break;
case 4: buf[12]+=1;
dispint_f(10,11,buf[12]);
break;
default: break;
}
}
void disp3112() //display time modified
{ CLEAR1();
dispes(0,5,13,"time modified");}
void disp3113()
{CLEAR1();
dispes(0,3,18,menu_str[7]); //"date/time setting:"
dispes_f(0,5,9,menu_str[8]); //"language:"
dispes(0,7,6,menu_str[9]); //"scale:"
dispes(0,9,21,menu_str[10]); //"motor specifications:"
dispes(0,11,17,menu_str[11]); //"freqency setting:"
}
void disp3114() //display language
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -