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

📄 tasks.c

📁 ucos porting source for 8052
💻 C
📖 第 1 页 / 共 2 页
字号:
  
/*<---[ End of variable declaration ]---------------------------------------------------------------->*/

 prm = prm; 
 for ( ; ; )
    {
    *led = 0x10;
     Task_Ctr[4]++; 
     OSTimeDly(TIME_50mS);
    }

}
/******************************************************************************************************\
*                                                                                                      *
*  Function   : Task_5                                                                                 *
*                                                                                                      *
*  Description: Sixth running task in the system.                                                      *  
*                                                                                                      *
*  Input      : void                                                                                   * 
*  Output     : void                                                                                   *                                                                                
*  Return     : void                                                                                   *
*                                                                                                      *
\******************************************************************************************************/
void Task_5(void *prm)
{
/*<---[ Variables used in this function: ]----------------------------------------------------------->*/
  
/*<---[ End of variable declaration ]---------------------------------------------------------------->*/

 prm = prm; 
 for ( ; ; )
    {
    *led = 0x20;
     Task_Ctr[5]++; 
     OSTimeDly(TIME_50mS);
    }

}
/******************************************************************************************************\
*                                                                                                      *
*  Function   : Task_6                                                                                 *
*                                                                                                      *
*  Description: Seventh running task in the system.                                                    *  
*                                                                                                      *
*  Input      : void                                                                                   * 
*  Output     : void                                                                                   *                                                                                
*  Return     : void                                                                                   *
*                                                                                                      *
\******************************************************************************************************/
void Task_6(void *prm)
{
/*<---[ Variables used in this function: ]----------------------------------------------------------->*/
  
/*<---[ End of variable declaration ]---------------------------------------------------------------->*/

 prm = prm; 
 for ( ; ; )
    {
    *led = 0x40;
     Task_Ctr[6]++; 
     OSTimeDly(TIME_50mS);
    }

}
/******************************************************************************************************\
*                                                                                                      *
*  Function   : Task_7                                                                                 *
*                                                                                                      *
*  Description: Eighth running task in the system.                                                     *  
*                                                                                                      *
*  Input      : void                                                                                   * 
*  Output     : void                                                                                   *                                                                                
*  Return     : void                                                                                   *
*                                                                                                      *
\******************************************************************************************************/
void Task_7(void *prm)
{
/*<---[ Variables used in this function: ]----------------------------------------------------------->*/

/*<---[ End of variable declaration ]---------------------------------------------------------------->*/
    
 prm = prm; 
 for ( ; ; )
    {
    *led = 0x80;
     Task_Ctr[7]++; 
     OSTimeDly(TIME_50mS);
    }

}
/******************************************************************************************************\
*                                                                                                      *
*  Function   : Clock                                                                                  *
*                                                                                                      *
*  Description: This is a seconds counter task.                                                        *  
*                                                                                                      *
*  Input      : void                                                                                   * 
*  Output     : void                                                                                   *                                                                                
*  Return     : void                                                                                   *
*                                                                                                      *
\******************************************************************************************************/
void Clock(void *prm)
{
/*<---[ Variables used in this function: ]----------------------------------------------------------->*/

 static INT8U seconds; 
  
/*<---[ End of variable declaration ]---------------------------------------------------------------->*/
    
 prm = prm; 
 seconds = 0x00;    
 for ( ; ; )
    {
    *display = seconds;
     if (seconds < 0x09)
       seconds++;
       
     else
       seconds = 0x00;
  
     OSTimeDlyHMSM((INT8U)0, (INT8U)0, (INT8U)1, (INT16U)0);
    }

}
/******************************************************************************************************\
*                                                                                                      *
*  Function   : Comm_Mgr                                                                               *
*                                                                                                      *
*  Description: Serial Port Communication Manager.                                                     *  
*                                                                                                      *
*               This task sits waiting until the serial port Interrupt Service Routine signals that a  *
*               carriage return-terminated string of data has been received in the receive buffer.     *
*                                                                                                      *
*               The actions taken afterwards are application specific.                                 *
*                                                                                                      *
*  Input      : void                                                                                   * 
*  Output     : void                                                                                   *                                                                                
*  Return     : void                                                                                   *
*                                                                                                      *
\******************************************************************************************************/
void Comm_Mgr(void *prm)
{
/*<---[ Variables used in this function: ]----------------------------------------------------------->*/

 INT8U  *cmd[] = {"lc", "md", "st"};           /* List of valid commands                              */
 INT8U   rc;                                   /* Function call return code                           */
 INT8U   i;                                    /* Loop counter                                        */
 
/*<---[ End of variable declaration ]---------------------------------------------------------------->*/
                            
 prm = prm; 
 for ( ; ; )                                        /* Loop for ever...                               */
    {
     OSSemPend(Comm_Sem, 100, &rc);                 /* Do nothing until data is received in the port  */
     if (rc == OS_NO_ERR) 
       {  
        for (i=0; i<3; i++)
           if (!strcmp(cmd[i], (INT8U *)0x01A000)) /* Serial port receive buffer placed at A000h      */
             break;
                          
        switch (i)
              {
               case 0: 
                       break;
             
               case 1: 
                       break;
             
               case 2: 
                       break;
             
               default:  break;
              }
        
       }  
 
    }           

}

⌨️ 快捷键说明

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