⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 main.c

📁 进行单片机与LCD的接口通讯与显示。使用清华的液晶。
💻 C
📖 第 1 页 / 共 5 页
字号:
void  disp511() //Vab, Ia->Vneutral
{CLEAR1();
  dispes(0,3,29,menu_str[64]); //"Vab:                        V"
  dispes(0,4,29,"Ia:                         A");
  dispes(0,5,29,menu_str[65]); //"Vbc:                        V"
  dispes(0,6,29,"Ic:                         A");
  dispes(0,7,29,menu_str[66]); //"Vneutral:                   V"
  dispes(0,8,28,menu_str[67]);    //"output power:            KVA"
  dispes(0,9,28,menu_str[68]);   //"output frequency:         HZ"
  dispes(0,10,28,menu_str[69]);   //"output speed:           rd/s"
  dispes(0,11,30,menu_str[70]);   //"sum hours of operation:      h"
  dispes(0,12,28,menu_str[71]);   //"sum kWh:                 kWh"
  float1=int_float3(buf[3],buf[4],buf[5]);
    dispf(25,3,float1,1);

    float2=int_float3(buf[6],buf[7],buf[8]);
    dispf(25,4,float2,1);

    float3=int_float3(buf[9],buf[10],buf[11]);
    dispf(25,5,float3,1);

    float4=int_float3(buf[12],buf[13],buf[14]);
    dispf(25,6,float4,1);

   float5=int_float3(buf[15],buf[16],buf[17]);
    dispf(25,7,float5,1);

    float6=int_float3(buf[18],buf[19],buf[20]);
    dispf(25,8,float6,1);
     float7=int_float2(buf[21],buf[22]);
    dispf(25,9,float7,1);
     float8=int_float2(buf[23],buf[24]);
    dispf(25,10,float8,1);
     float8=int_float2(buf[25],buf[26]);
    dispf(25,11,float8,1);
     float8=int_float2(buf[27],buf[28]);
    dispf(25,12,float8,1);

  }
void  disp512() //output power->sum kWh
{ }

void  disp521() //main switch state->motor state
{CLEAR1();
  dispes(0,3,18,menu_str[72]);   //"main switch state:"
  dispes(0,4,23,menu_str[73]);   //"main transformer state:"
  dispes(0,5,12,menu_str[74]);   //"pulse state:"
  dispes(0,6,19,menu_str[75]);   //"P.U. cabinet state:"
  dispes(0,7,12,menu_str[76]);  //"motor state:"
  dispes(0,8,10,menu_str[77]);  //"UPS state:"
  dispes(0,9,18,menu_str[78]);  //"peripherial state:"
  dispes(0,10,13,menu_str[79]);  //"current date:"
  dispes(0,11,13,menu_str[80]); //"current time:"
  on_off_state_general(buf[4],3);
  on_off_state_general(buf[6],4);
  on_off_state_general(buf[8],5);
  on_off_state_general(buf[10],6);
  on_off_state_general(buf[12],7);
  on_off_state_general(buf[14],8);
  on_off_state_general(buf[16],9);

  dispint(20,10,200);
  dispint(21,10,buf[18]);
  dispes(21,10,1,".");
  dispint(23,10,buf[20]);
  dispes(23,10,1,".");
  dispint(26,10,buf[22]);

  dispint(22,11,buf[24]);
  dispes(22,11,1,":");
  dispint(25,11,buf[26]);
  }
void  disp522() //UPS state->current time
{ }

void disp531()    //v/f relation:
 {CLEAR1();
     dispes_f(0,3,13,menu_str[81]); //"v/f relation:"
     dispes(0,5,29,menu_str[82]); //"ramp-up time,in sec.:      SEC"
     dispes(0,7,29,menu_str[83]); //"ramp-down time,in sec.:    SEC"
     dispes(0,9,10,menu_str[84]); //"ramp type:"
     dispes(0,11,29,menu_str[85]); //"boost starting voltage:     %"
     int1=int_2(buf[5],buf[6]);
     dispint(25,5,int1);
     int2=int_2(buf[8],buf[9]);
     dispint(25,7,int2);
     if(buf[4]==1)
    { dispes(15,9,6,"linear");}
     else
    {dispes(15,9,9,"parabolic");}
    int3=buf[12];
    dispint(27,11,int3);
   }
void disp532() //ramp-up time, in  sec.
 {blank_line(3);
  blank_line(5);
   dispes(0,3,13,menu_str[81]); //"v/f relation:"
     dispes_f(0,5,29,menu_str[82]); //"ramp-up time,in sec.:     SEC"
     int1=int_2(buf[5],buf[6]);
     dispint_f(25,5,int1);
     }
void disp533() //ramp-down time, in sec.
 { blank_line(5);
  blank_line(7);
  dispes(0,5,31,menu_str[82]); //"ramp-up time,in sec.:     SEC"
     dispes_f(0,7,31,menu_str[83]); //"ramp-down time,in sec.:   SEC"
     int1=int_2(buf[5],buf[6]);
     int2=int_2(buf[8],buf[9]);
       dispint(25,5,int1);
     dispint_f(25,7,int2);
  }
void disp534() //ramp type:
 { blank_line(7);
  blank_line(9);
 dispes(0,7,29,menu_str[83]); //"ramp-down time,in sec.:   SEC"
     dispes_f(0,9,10,menu_str[84]); //"ramp type:"
     int2=int_2(buf[8],buf[9]);
  dispint(25,7,int2);
     if(buf[4]==1)
    { dispes_f(15,9,6,"linear");}
     else
    {dispes_f(15,9,9,"parabolic");}
     }
void disp535() //boost starting voltage:
 { blank_line(9);
  blank_line(11);
 dispes(0,9,10,menu_str[84]); //"ramp type:"
     dispes_f(0,11,29,menu_str[85]); //"boost starting voltage:     %"
     if(buf[4]==1)
    { dispes(15,9,6,"linear");}
     else
    {dispes(15,9,9,"parabolic");}
    int3=buf[12];
    dispint_f(27,11,int3);
   }
void disp536()  //modify ramp-up time, in  sec.
 {
 modify_int2(int1,disp532,5,6);
 }
void disp537() //modify ramp-down time, in sec.
{
 modify_int2(int2,disp533,8,9);
 }
void disp538() //modify ramp type:
 {switch(key2)
  {case 5:buf[4]=1;
  disp534();
  break;
  case 4: buf[4]=2;
  disp534();
  break; }
  }
void disp539() //modify boost starting voltage:
 {
 modify_int1(int3,disp535,12);
 }
void disp5310() //display modified
 {CLEAR1();
 dispes(0,5,26,"basic v/f control modified");}

void disp611()//第六层unit 1: state/Vdc->unit 5: state/Vdc
{CLEAR1();
   dispes(0,3,18,menu_str[86]); //"unit 1: state/Vdc:"
   dispes(0,4,18,menu_str[87]); //"unit 2: state/Vdc:"
   dispes(0,5,18,menu_str[88]); //"unit 3: state/Vdc:"
   dispes(0,6,18,menu_str[89]); //"unit 4: state/Vdc:"
   dispes(0,7,18,menu_str[90]); //"unit 5: state/Vdc:"
   dispes(0,8,18,menu_str[91]); //"unit 6: state/Vdc:"
   on_off_state(buf[3],3);
   dispes(21,3,1,"/");
   float1=int_float3(buf[9],buf[10],buf[11]);
   dispf(28,3,float1,1);
  dispes(29,3,1,"V");

  on_off_state(buf[4],4);
  dispes(21,4,1,"/");
   float2=int_float3(buf[12],buf[13],buf[14]);
   dispf(28,4,float2,1);
   dispes(29,4,1,"V");

  on_off_state(buf[5],5);
  dispes(21,5,1,"/");
   float3=int_float3(buf[15],buf[16],buf[17]);
   dispf(28,5,float3,1);
  dispes(29,5,1,"V");

  on_off_state(buf[6],6);
  dispes(21,6,1,"/");
   float4=int_float3(buf[18],buf[19],buf[20]);
   dispf(28,6,float4,1);
  dispes(29,6,1,"V");

  on_off_state(buf[7],7);
  dispes(21,7,1,"/");
   float5=int_float3(buf[21],buf[22],buf[23]);
   dispf(28,7,float5,1);
  dispes(29,7,1,"V");

  on_off_state(buf[8],8);
  dispes(21,8,1,"/");
   float6=int_float3(buf[24],buf[25],buf[26]);
   dispf(28,8,float6,1);
  dispes(29,8,1,"V");
   }
void disp612()//unit 6: state/Vdc
 { }
void disp621() //linear : k
{CLEAR1();
   dispes_f(0,3,7,menu_str[92]); //"linear : k"
   dispes(0,5,10,menu_str[93]); //"parabolic:"
   float1=int_float2(buf[4],buf[5]);
   dispf_f(15,3,float1,1);
   float2=int_float2(buf[7],buf[8]);
   dispf(15,5,float2,1);
   float3=int_float2(buf[10],buf[11]);
   dispf(15,7,float3,1);
  }
void disp622()//parabolic_1
 {CLEAR1();
   dispes(0,3,7,menu_str[92]); //"linear: "
   dispes_f(0,5,10,menu_str[93]); //"parabolic:"
   float1=int_float2(buf[4],buf[5]);
   float2=int_float2(buf[7],buf[8]);
   float3=int_float2(buf[10],buf[11]);
   dispf(15,3,float1,1);
   dispf_f(15,5,float2,1);
   dispf(15,7,float3,1);
  }
void disp623() //parabolic_2
 {CLEAR1();
   dispes(0,3,7,menu_str[92]); //"linear:"
   dispes_f(0,5,10,menu_str[93]); //"parabolic:"
   float1=int_float2(buf[4],buf[5]);
   float2=int_float2(buf[7],buf[8]);
   float3=int_float2(buf[10],buf[11]);
   dispf(15,3,float1,1);
   dispf(15,5,float2,1);
   dispf_f(15,7,float3,1);
  }
void disp631()//modify linear : k
 {
  modify_float2(float1,disp621,4,5);
 }
void disp632()//modify parabolic_1
 {
  modify_float2(float2,disp622,7,8);
 }
void disp633()//display modified
 {CLEAR1();
 dispes(0,5,21,"v/f relation modified");}
void disp634() //modify parabolic_2
 {
  modify_float2(float3,disp623,10,11);
 }

/*communocation function define*/
void commu1()      //request normal display
 {length=2;
  send(head);
  send(length);
  send(1);
  verify=head^length^1;
  send(verify);
  }

void commu2()          //request fault message
 {length=2;
  send(head);
  send(length);
  send(2);
  verify=head^length^2;
  send(verify);
  }

void commu3()         //ack. fault message
 {length=2;
  send(head);
  send(length);
  send(3);
  verify=head^length^3;
  send(verify);
  }

void commu4()         //request history events:
 {length=2;
  send(head);
  send(length);
  send(10);
  verify=head^length^10;
  send(verify);
  }

void commu5()          //request date/time setting:
 {length=2;
  send(head);
  send(length);
  send(11);
  verify=head^length^11;
  send(verify);
  }

void commu6()       //send modified time
  {uchar i;
  length=12;
  send(head);
  send(length);
  send(12);
  verify=head^length^12;
  for(i=3;i<=length;i++)
  {send(buf[i]);
   verify=verify^buf[i];
  }
  send(verify);
  }

/*void commu7()        //request language
 {length=2;
  send(head);
  send(length);
  send(13);
  verify=head^length^13;
  send(verify);
  }
void commu8()       //send modified language
 {length=3;
  send(head);
  send(length);
  send(14);
  send(buf[3]);
  verify=head^length^14;
  send(verify);
  }
void commu9()       //request scale
 {length=2;
  send(head);
  send(length);
  send(15);
  verify=head^length^15;
  send(verify);
  }
void commu10()     //send modified scale
  {length=3;
  send(head);
  send(length);
  send(16);
  send(buf[3]);
  verify=head^length^16;
  send(verify);
  }  */
void commu11()    //request  motor specifications
  {length=2;
  send(head);
  send(length);
  send(17);
  verify=head^length^17;
  send(verify);
  }
void commu12()   //request  frequency setting
   {length=2;
  send(head);
  send(length);
  send(19);
  verify=head^length^19;
  send(verify);
  }
void commu13()        //request  groups in operation
  {length=2;
  send(head);
  send(length);
  send(21);
  verify=head^length^21;
  send(verify);
  }
void commu14()     //request control mode
 {length=2;
  send(head);
  send(length);
  send(23);
  verify=head^length^23;
  send(verify);
  }
void commu15()       //request  fwd/rev & jog
 {length=2;
  send(head);
  send(length);
  send(25);
  verify=head^length^25;
  send(verify);
  }
void commu16()        //request DC applying
 {length=2;
  send(head);
  send(length);
  send(27);
  verify=head^length^27;
  send(verify);
  }
void commu17()         //request limit parameters
  {length=2;
  send(head);
  send(length);
  send(29);
  verify=head^length^29;
  send(verify);
  }
void commu18()        //request calibration
 {length=2;
  send(head);
  send(length);
  send(31);
  verify=head^length^31;
  send(verify);
  }
void commu19()        //request general measurement
 {length=2;
  send(head);
  send(length);
  send(40);
  verify=head^length^40;
  send(verify);
  }
void commu20()           //request general states
 {length=2;
  send(head);
  send(length);
  send(41);
  verify=head^length^41;
  send(verify);
  }
void commu21()           //send modified motor specifications
 {uchar idata i;
  length=17;
  send(head);
  send(length);
  send(18);
  verify=head^length^18;
  for(i=3;i<=length;i++)
  {send(buf[i]);
   verify=verify^buf[i];
  }
  send(verify);
  }
void commu22()          //send modified frequency setting
  {uchar idata i;
  length=16;
  send(head);
  send(length);
  send(20);
  verify=head^length^

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -