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

📄 lib.h.rpk

📁 这是一个飞思卡尔智能车比赛的一个完整的程序
💻 RPK
📖 第 1 页 / 共 3 页
字号:
                           case 7:
                                 {
                                 ExtPd=*((uint *)2090);
                                 ExtPd--;
                                 LibEepromReProgWord(ExtPd,2090);
                                 ExtLcdPost=1;
                                 break; 
                                 }                                
                            }    
                   break;              
                   } 
            case 4 :
                   {
                  // if(ExtOSSystemStart=1)
                   //  {
                   //   OSTaskSuspend(13);
                   //   OSTaskSuspend(15);
                   //  }
                   
                   
                   switch (ExtMenu) 
                           {
                            case 6:
                                 {
                               
                                 ExtLcdPost=1;
                                 break; 
                                 }
                            case 8:
                                 {
                                 ExtOSSystemStart=1;
                                 ExtLcdPost=1;
                                 break; 
                                 }                                 
                           } 
                   break;
                   }      
            }     
        for(;PTJ!=0b11000011;)
           {
           PORTB_BIT1=1;
           }
           PORTB_BIT1=0;
         }       
      } 
      


/*************************************************************************************************/
/*************************************************************************************************/
/*************************************************************************************************/


           
/*----------------------------------LibSCITransmit(uchar TransmitData)----------------------------------*/         
void LibSCITransmit(uchar TransmitData)
     {
     while(!SCI0SR1_TDRE);//wait for transmit over
     SCI0DRL=TransmitData;//write data to transmit register
     }
/*----------------------------------LibSCIRecive(uchar ReciveData)----------------------------------*/         
uchar LibSCIRecive()
     {
     uchar ReciveData;
     while(!SCI0SR1_RDRF);//wait for recive end
     ReciveData=SCI0DRL;//read data for recive register
     return ReciveData;
     } 
/*----------------------------------LibPCSendMsg(char CHAR[])----------------------------------*/   
void LibPCSendMsg(char CHAR[])
     {
     char *p;
     p=CHAR;
     //Lib_PC_LINE_CHG();
     LibSCITransmit(' ');     
     for(;;)
        {
        LibSCITransmit(*p);
        p++;
        if(*p=='/')
          {
          break;
          } 
        }
      }
/*----------------------------------LibPCNumChgPost(unsigned int num)----------------------------------*/   
void LibPCNumChgPost(unsigned int num)
     { 
     unsigned char temp;   
     if(num<10)
        {
        temp=ExtNumTbl[num];
        LibSCITransmit(temp);
        LibSCITransmit(' ');
        } 
     else if(num>9 & num<100)
        {
        temp=ExtNumTbl[num/10];//十
        LibSCITransmit(temp);  
        temp=ExtNumTbl[num%10];//个
        LibSCITransmit(temp);
        LibSCITransmit(' ');
        }
     else if(num>99 & num<1000)
        { 
        temp=ExtNumTbl[num/100];//百
        LibSCITransmit(temp);
        temp=ExtNumTbl[(num%100)/10];//十
        LibSCITransmit(temp);
        temp=ExtNumTbl[num%10];//个
        LibSCITransmit(temp);
        LibSCITransmit(' ');
        }    
     else if(num>999 & num<10000)   
        {
        temp=ExtNumTbl[num/1000];//千
        LibSCITransmit(temp);
        temp=ExtNumTbl[(num%1000)/100];//百
        LibSCITransmit(temp);  
        temp=ExtNumTbl[(num%100)/10];//十
        LibSCITransmit(temp);
        temp=ExtNumTbl[num%10];//个
        LibSCITransmit(temp);
        LibSCITransmit(' ');
        }
     else if(num>9999)   
        {
        temp=ExtNumTbl[num/10000];//万
        LibSCITransmit(temp);
        temp=ExtNumTbl[(num%10000)/1000];//千
        LibSCITransmit(temp);
        temp=ExtNumTbl[(num%1000)/100];//百
        LibSCITransmit(temp);  
        temp=ExtNumTbl[(num%100)/10];//十
        LibSCITransmit(temp);
        temp=ExtNumTbl[num%10];//个
        LibSCITransmit(temp);
        LibSCITransmit(' ');
        } 
      } 



/*************************************************************************************************/
/*************************************************************************************************/
/*************************************************************************************************/















//************************************************************************/
//               MicroC/Os-II The Real-Time Kernel                                                     /
//                                                                        /
//************************************************************************/

#if OS_CPU_HOOKS_EN
/*
*********************************************************************************************************
*                                          TASK CREATION HOOK
*
* Description: This function is called when a task is created.
*
* Arguments  : ptcb   is a pointer to the task control block of the task being created.
*
* Note(s)    : 1) Interrupts are disabled during this call.
*********************************************************************************************************
*/
void OSTaskCreateHook (OS_TCB *ptcb)
{
}


/*
*********************************************************************************************************
*                                           TASK DELETION HOOK
*
* Description: This function is called when a task is deleted.
*
* Arguments  : ptcb   is a pointer to the task control block of the task being deleted.
*
* Note(s)    : 1) Interrupts are disabled during this call.
*********************************************************************************************************
*/
void OSTaskDelHook (OS_TCB *ptcb)
{
}

/*
*********************************************************************************************************
*                                           TASK SWITCH HOOK
*
* Description: This function is called when a task switch is performed.  This allows you to perform other
*              operations during a context switch.
*
* Arguments  : none
*
* Note(s)    : 1) Interrupts are disabled during this call.
*              2) It is assumed that the global pointer 'OSTCBHighRdy' points to the TCB of the task that
*                 will be 'switched in' (i.e. the highest priority task) and, 'OSTCBCur' points to the 
*                 task being switched out (i.e. the preempted task).
*********************************************************************************************************
*/
void OSTaskSwHook (void)
{
}

/*
*********************************************************************************************************
*                                           STATISTIC TASK HOOK
*
* Description: This function is called every second by uC/OS-II's statistics task.  This allows your 
*              application to add functionality to the statistics task.
*
* Arguments  : none
*********************************************************************************************************
*/
void OSTaskStatHook (void)
{
}

/*
*********************************************************************************************************
*                                               TICK HOOK
*
* Description: This function is called every tick.
*
* Arguments  : none
*
* Note(s)    : 1) Interrupts may or may not be ENABLED during this call.
*********************************************************************************************************
*/
void OSTimeTickHook (void)
{
}


void OSTaskIdleHook(void)
{
}

void OSInitHookBegin(void)
     {
     
     LibSysClkInit();
     LibPortInit();
     LibPWM16Init();
     LibADInit();
     LibEepromInit();
     LibLCDInit();
     Lib_PC_LINE_CHG();     
     PORTB_BIT0=0;    
     PWMDTY23=*((uint *)2086);
     ExtPk=*((uint *)2088);
     ExtPd=*((uint *)2090);
       
     LibEepromProgWord(1111,2050,SEC_REP);
     LibEepromReProgWord(1111,2048);
     LibEepromReProgByte(128,2048);
     //LibEepromReProgWord(1600,2086);
     //LibEepromReProgWord(20,2088);
     //LibEepromReProgWord(20,2090);      
     LibLCDNumChgPost(*(uchar *)2048);
     LibLCDNumChgPost(*(uchar *)2049);
     LibLCDNumChgPost(*(uchar *)2050); 
     LibLCDNumChgPost(*(uchar *)2051);
     for(;;){} 
     }

void OSInitHookEnd(void)
     {
     while(ExtOSSystemStart==0)
          {
          LibLCDInfoDis();
          }
     Lib_PA_INIT();
     }

void OSTCBInitHook(OS_TCB *ptcb)
{
}


#endif



























⌨️ 快捷键说明

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