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

📄 08111-081121c18.c

📁 实现电动机的软启动控制
💻 C
📖 第 1 页 / 共 5 页
字号:
  
  {71 ,72 ,73 ,74 ,181,181,181,181,BypassSwitchLcd},
  {72 ,72 ,73 ,74 ,181,181,181,181,BypassSwitchDec},
  {73 ,72 ,73 ,74 ,181,181,181,181,BypassSwitchInc},
  {74 ,22 ,22 ,22 ,181,181,181,181,BypassSwitchSet},
  
  {75 ,76 ,77 ,78 ,181,181,181,181,SoftStopTimeLcd},
  {76 ,76 ,77 ,78 ,181,181,181,181,SoftStopTimeDec},
  {77 ,76 ,77 ,78 ,181,181,181,181,SoftStopTimeInc},
  {78 ,23 ,23 ,23 ,181,181,181,181,SoftStopTimeSet},
  
  {79 ,80 ,81 ,82 ,181,181,181,181,StartModLcd},
  {80 ,80 ,81 ,82 ,181,181,181,181,StartModDec},
  {81 ,80 ,81 ,82 ,181,181,181,181,StartModInc},
  {82 ,24 ,24 ,24 ,181,181,181,181,StartModSet},
  
  {83 ,84 ,85 ,86 ,181,181,181,181,SpeedValueLcd},
  {84 ,84 ,85 ,86 ,181,181,181,181,SpeedValueDec},
  {85 ,84 ,85 ,86 ,181,181,181,181,SpeedValueInc},
  {86 ,25 ,25 ,25 ,181,181,181,181,SpeedValueSet},
  
  {87 ,88 ,89 ,90 ,181,181,181,181,SpeedProportionLcd},
  {88 ,88 ,89 ,90 ,181,181,181,181,SpeedProportionDec},
  {89 ,88 ,89 ,90 ,181,181,181,181,SpeedProportionInc},
  {90 ,26 ,26 ,26 ,181,181,181,181,SpeedProportionSet},
  
  {91 ,92 ,93 ,94 ,181,181,181,181,SpeedIntegralLcd},
  {92 ,92 ,93 ,94 ,181,181,181,181,SpeedIntegralDec},
  {93 ,92 ,93 ,94 ,181,181,181,181,SpeedIntegralInc},
  {94 ,27 ,27 ,27 ,181,181,181,181,SpeedIntegralSet},
  
  {95 ,96 ,97 ,98 ,181,181,181,181,CurrentSelcetLcd},
  {96 ,96 ,97 ,98 ,181,181,181,181,CurrentSelectDec},
  {97 ,96 ,97 ,98 ,181,181,181,181,CurrentSelectInc},
  {98 ,28 ,28 ,28 ,181,181,181,181,CurrentSelectSet},
  
  {99 ,100,101,102,181,181,181,181,CurrentProportionLcd},
  {100,100,101,102,181,181,181,181,CurrentProportionDec},
  {101,100,101,102,181,181,181,181,CurrentProportionInc},
  {102,29 ,29 ,29 ,181,181,181,181,CurrentProportionSet},
  
  {103,104,105,106,181,181,181,181,CurrentIntegralLcd},
  {104,104,105,106,181,181,181,181,CurrentIntegralDec},
  {105,104,105,106,181,181,181,181,CurrentIntegralInc},
  {106,30 ,30 ,30 ,181,181,181,181,CurrentIntegralSet},
  
  {107,108,109,110,181,181,181,181,ProtectShieldLcd},
  {108,108,109,110,181,181,181,181,ProtectShieldDec},
  {109,108,109,110,181,181,181,181,ProtectShieldInc},
  {110,31 ,31 ,31 ,181,181,181,181,ProtectShieldSet},
  
  {111,112,113,114,181,181,181,181,InductLcd},
  {112,112,113,114,181,181,181,181,InductDec},
  {113,112,113,114,181,181,181,181,InductInc},
  {114,32 ,32 ,32 ,181,181,181,181,InductSet},
  
  {115,116,117,118,181,181,181,181,OverVProtectLcd},
  {116,116,117,118,181,181,181,181,OverVProtectDec},
  {117,116,117,118,181,181,181,181,OverVProtectInc},
  {118,33 ,33 ,33 ,181,181,181,181,OverVProtectSet},
  
  {119,120,121,122,181,181,181,181,UnderVProtectLcd},
  {120,120,121,122,181,181,181,181,UnderVProtectDec},
  {121,120,121,122,181,181,181,181,UnderVProtectInc},
  {122,34 ,34 ,34 ,181,181,181,181,UnderVProtectSet},
  
  {123,143,7  ,129,181,181,181,181,MainSlaveDelaySetLcd},
  {124,130,131,129,181,181,181,181,MainSlaveDelay_LCD},//no execute
  
  {125,126,127,128,181,181,181,181,MainSlave1DelayLcd},
  {126,126,127,128,181,181,181,181,MainSlave1DelayDec},
  {127,126,127,128,181,181,181,181,MainSlave1DelayInc},
  {128,129,129,129,181,181,181,181,SetMainSlave1Delay},
  
  {129,130,134,125,181,181,181,181,MainSlave1SelectLcd},
  {130,131,129,135,181,181,181,181,MainSlave2SelectLcd},
  {131,134,130,139,181,181,181,181,MainSlave3SelectLcd},
  {132,14 ,34 ,7  ,181,181,181,181,ReturnValueSet},
  {133,181,181,181,181,181,181,181,None},/**/
  {134,129,131,123,181,181,181,181,ReturnMainSlave},
  
  {135,136,137,138,181,181,181,181,MainSlave2DelayLcd},
  {136,136,137,138,181,181,181,181,MainSlave2DelayDec},
  {137,136,137,138,181,181,181,181,MainSlave2DelayInc},
  {138,130,130,130,181,181,181,181,SetMainSlave2Delay},
  
  {139,140,141,142,181,181,181,181,MainSlave3DelayLcd},
  {140,140,141,142,181,181,181,181,MainSlave3DelayDec},
  {141,140,141,142,181,181,181,181,MainSlave3DelayInc},
  {142,131,131,131,181,181,181,181,SetMainSlave3Delay},
  
  {143,148,123,144,181,181,181,181,FactorySetValueLcd},
  {144,145,168,164,181,181,181,181,FactorySetAloneLcd},
  {145,146,144,164,181,181,181,181,FactorySetMainLcd},
  {146,147,145,165,181,181,181,181,FactorySetSlave1Lcd},
  {147,163,146,166,181,181,181,181,FactorySetSlave2Lcd},/*any key can return,and lcd dispaly,and cover the value*/
  
  {148,160,143,149,181,181,181,181,ErroViewLcd},
  {149,150,159,181,181,181,181,181,Erro1Lcd},
  {150,151,149,181,181,181,181,181,Erro2Lcd},
  {151,152,150,181,181,181,181,181,Erro3Lcd},
  {152,153,151,181,181,181,181,181,Erro4Lcd},
  {153,154,152,181,181,181,181,181,Erro5Lcd},
  {154,155,153,181,181,181,181,181,Erro6Lcd},
  {155,156,154,181,181,181,181,181,Erro7Lcd},
  {156,157,155,181,181,181,181,181,Erro8Lcd},
  {157,158,156,181,181,181,181,181,Erro9Lcd},
  {158,159,157,181,181,181,181,181,Erro10Lcd},

  {159,149,158,148,181,181,181,181,ErroReturnLcd},
  {160,1  ,148,0  ,181,181,181,181,EscLcd},
  
  {161,8  ,12 ,7  ,181,181,181,181,SetReturnLcd},
  {162,162,162,1  ,181,181,181,181,SelectOkLcd},
  {163,168,147,167,181,181,181,181,FactorySetSlave3Lcd},
  {164,143,143,143,181,181,181,181,FactorySetValue},
  {165,143,143,143,143,181,181,181,FactorySetValue},
  {166,143,143,143,181,181,181,181,FactorySetValue},
  {167,143,143,143,181,181,181,181,FactorySetValue},
  {168,144,163,143,181,181,181,181,FactorySetValueReturn},
#ifdef bug
  {169,181,181,181,181,173,176,0  ,ResetReturn},
#else
  {169,173,176,172,181,181,181,0  ,ResetReturn},
#endif  
  {170,181,181,181,181,181,171,181,Running},
  
  {171,181,181,181,181,170,181,0  ,StopRunning},
#ifdef bug
  {172,181,181,181,181,174,176,177,MainResetLcd},
  {173,181,181,181,181,174,169,177,MainResetLcd},
  {174,181,181,181,181,175,173,178,Slave1ResetLcd},
  {175,181,181,181,181,176,174,179,Slave2ResetLcd},
  {176,181,181,181,181,169,175,180,Slave3ResetLcd},
#else
  {172,174,176,177,181,181,181,181,MainResetLcd},
  {173,174,169,177,181,181,181,181,MainResetLcd},
  {174,175,173,178,181,181,181,181,Slave1ResetLcd},
  {175,176,174,179,181,181,181,181,Slave2ResetLcd},
  {176,169,175,180,181,181,181,181,Slave3ResetLcd},
#endif
  {177,181,181,181,181,181,181,181,ResetMain},
#ifdef bug  
  {178,181,181,181,181,181,181,172,ResetSlave1},
  {179,181,181,181,181,181,181,172,ResetSlave2},
  {180,181,181,181,181,181,181,172,ResetSlave3},
#else
  {178,181,181,172,181,181,181,181,ResetSlave1},
  {179,181,181,172,181,181,181,181,ResetSlave2},
  {180,181,181,172,181,181,181,181,ResetSlave3},
#endif
  {181,181,181,181,181,181,181,181,None},
}; 
/*******************************************************************************
* Function Name  : 
* Description    : 
* Input          : None
* Output         : None
* Return         : None
******************************************************************************
void ErroCheck(void)
{
  switch(x_number[0x1d]){
      case 1:
        LcdSelectBrush();
        break;
      case 2:
        LcdSelectBrush();
        break;
      case 3:
        LcdSelectBrush();
        break;
      case 4:
        LcdSelectBrush();
        break;
      case 5:
        LcdSelectBrush();
        break;
      case 6: 
        LcdSelectBrush();
        break;
      case 7:
        LcdSelectBrush();
        break;
      default:
        x_number[0x1d]=0;
        LcdSelectBrush();        
  }
}
*/

#pragma code LOW_INTERRUPT_VECTOR = 0x8
void isrhandler(void)
{
   _asm goto interrupt_isr _endasm
}

#pragma code

/*******************************************************************************
* Function Name  : interrupt isr
* Description    : interrupt isr
* Input          : None
* Output         : None
* Return         : None
*******************************************************************************/
#pragma interrupt interrupt_isr
void interrupt_isr(void)
{
   char i;
   
   /* save the register */
   /* None 100u*/
   if((PIR1bits.TMR1IF)&&(PIE1bits.TMR1IE)){
    PIR1bits.TMR1IF=0;
    TMR1H=T1HValue;
    TMR1L=T1LValue;  
    Counter10ms++;
    if(Counter10ms==100){
      Counter10ms=0;
      Flag10ms=0xff;
      KeyScanFlag=1;
    }
    return;
   } 
   
   /* None */ 
   if((INTCONbits.RBIF)&&(INTCONbits.RBIE)){  
     i=PORTB; 
     INTCONbits.RBIF=0;  
    // rbint();
     return;
   } 
    
    /* receve the message */   
    if((PIR1bits.RCIF)&&(PIE1bits.RCIE)){
          *BufferPointIn=RCREG;
          BufferPointIn++;
          if(BufferPointIn==(&Bufferx[39]))BufferPointIn=Buffer;
          if(BufferPointIn==BufferPointOut)UsartInit();
          T3CONbits.TMR3ON=1;
          TMR3H=T3HValue;
          TMR3L=T3LValue;    
          return;
     }
   
    /* send the message */
    if((PIR1bits.TXIF)&&(PIE1bits.TXIE)){
       TXREG=data_buf[send_counter];
       send_counter++;
       if(send_counter==send_number){
         PIE1bits.TXIE=0;
         send_ok=1;
       }  
       return;
     }
   
    /* wait for receve end,6ms */
    if((PIR2bits.TMR3IF)&&(PIE2bits.TMR3IE)){
       PIR2bits.TMR3IF=0;
       T3CONbits.TMR3ON=0;
       T0CONbits.TMR0ON=0;
       Delay200=0;
       rece_counter++;
       return;
     } 
      
   
    /* wait for the slave ack and return message */
    if((INTCONbits.TMR0IF)&&(INTCONbits.TMR0IE)){
       INTCONbits.TMR0IF=0;
       Delay200++;
       if(Delay200==30){
         Delay200=0;
         T0CONbits.TMR0ON=0;
         MainSendNoack=1;
       }
       return;
     }   
    /* reout the register */   
}


void None(void)
{
  _asm nop _endasm
}
/*******************************************************************************
* Function Name  : BrushValue 
* Description    : brush the value want to display
* Input          : the line and the value,then divide it and to display
* Output         : None
* Return         : None
*******************************************************************************/
void BrushValue(uchar line,uint value)
{
  NumberNoPointMain(value);
  WriteCommand(line);
  WriteData(num_xi[0]);
  WriteData(num_xi[1]);
  WriteData(num_xi[2]);
  WriteData(num_xi[3]);
}
/*******************************************************************************
* Function Name  : 
* Description    : 
* Input          : None
* Output         : None
* Return         : None
*******************************************************************************/
void PowerOn(void)
{ 
#ifdef bug
  KeySetFlag=0;
#endif  
   CheckForbid=0;
   LcdPageBrush(24,25,26,27);
}
/*******************************************************************************
* Function Name  : 
* Description    : 
* Input          : None
* Output         : None
* Return         : None
*******************************************************************************/
void RunModleSetLcd(void)
{
  /* run program is here */
  CheckForbid=1;
  LcdPageBrush(67,89,67,28);
}
/*******************************************************************************
* Function Name  : 
* Description    : 
* Input          : None
* Output         : None
* Return         : None
*******************************************************************************/
void SelectAsAloneLcd(void)
{
   MainSlaveModeBuf=AloneMode;
   LcdPageBrush(89,67,35,67);
}
/*******************************************************************************
* Function Name  : 
* Description    : 
* Input          : None
* Output         : None
* Return         : None
*******************************************************************************/
void SelectAsMainLcd(void)
{
  MainSlaveModeBuf=MainMode;
  LcdPageBrush(89,67,36,67);
}
/*******************************************************************************

⌨️ 快捷键说明

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