Sonsivri
 
*
Welcome, Guest. Please login or register.
Did you miss your activation email?
December 07, 2016, 01:28:46 13:28


Login with username, password and session length


Pages: [1]
Print
Author Topic: Problem with ucos-ii OSTimeDlyHMSM() function.  (Read 2311 times)
0 Members and 1 Guest are viewing this topic.
30f4011
Active Member
***
Online Online

Posts: 132

Thank You
-Given: 626
-Receive: 96



« on: June 23, 2009, 04:27:12 16:27 »

Hi friends,
              
            I am developing small application with ucos-ii v2.86 and OLIMEX STRE-912 board with IAR EW-ARM v5.30 . In code when OSTimeDlyHMSM() function is encountered the task is halted permanently and execution freezes.

           It works with small delays e.g OSTimeDlyHMSM(0, 0, 0, 5 ) but not with normal ones e.g OSTimeDlyHMSM(0, 0, 1, 30 );
OS timer tick is set to 100 ticks per second.
 
          Program works properly if OSTimeDlyHMSM() is removed.
      
           Please help me to solve this problem Embarrassed Embarrassed
 
the application code is as under,

    
Code:
 
/******************************************************************************************************

uC/OS-II
Filename      : app.c
Version       : V1.00

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

#include <includes.h>

/*
*********************************************************************************************************
*                                               LOCAL DEFINES
*********************************************************************************************************
*/



/*
*********************************************************************************************************
*                                             LOCAL DATA TYPES
*********************************************************************************************************
*/

typedef struct graphics
              {
               unsigned char x1;
               unsigned char y1;
               unsigned char x2;
               unsigned char y2;
               unsigned char color;
              }lcdgraphics;

//struct graphics lcdgraphics;

/*
*********************************************************************************************************
*                                                VARIABLES
*********************************************************************************************************
*/

OS_STK   Task_Serial_TX_STK[Task_COM_STK];
OS_STK   TASK_LCDD_STK[Task_LCD_STK];


OS_EVENT *mb;
OS_EVENT *clr;

OS_EVENT *lcdq;
void *lcdptr[4];


/*
*********************************************************************************************************
*                                            FUNCTION PROTOTYPES
*********************************************************************************************************
*/


void Task_Serial_TX( void *pdata );
void Task_LCD( void *pdata );


/*
*********************************************************************************************************
*                                                main()
*
* Description : This is the standard entry point for C code.  It is assumed that your code will call
*               main() once you have performed all necessary initialization.
*
* Argument(s) : none.
*
* Return(s)   : none.
*
* Caller(s)   : This is the standard entry point for C code.
*
* Note(s)     : none.
*********************************************************************************************************
*/
void   main   ( void )
{

 BSP_IntDisAll();           /* Disable all interrupts until we are ready to accept them */

 BSP_Init();                /* Initialize system's BSP */






 OSInit();                  /* Initialize "uC/OS-II, The Real-Time Kernel" */

 mb   = OSMboxCreate( (void *)0 );
 clr  = OSMboxCreate( (void *)0 );
 lcdq = OSQCreate( &lcdptr[0], 4);

 OSTaskCreate( Task_Serial_TX, ( void * )0,  &Task_Serial_TX_STK[Task_COM_STK -1], Task_COM_PRIO ); // task prio = 2
 OSTaskCreate( Task_LCD, ( void *)0, &TASK_LCDD_STK[Task_LCD_STK-1], Task_LCD_PRIO ); // task prio = 1



 OSStart();                 /* Start multitasking (i.e. give control to uC/OS-II) */

}


/*********************************************************************************************************
*                                                Task_Serial_TX()
*
* Description :
*
*
* Argument(s) : none.
*
* Return(s)   : none.
*
* Caller(s)   :
*
* Note(s)     : none
*********************************************************************************************************/
void Task_Serial_TX ( void *pdata )
{

  unsigned char err;


  lcdgraphics rectangle;


  rectangle.color = 0;
  rectangle.x2 = 0;
  rectangle.y2 = 0;
  rectangle.x1 = 0;
  rectangle.y1 = 0;

  pdata = pdata;

  while( 1 )
  {

   rectangle.x1 += 2;
   rectangle.y1  = rectangle.x1;
   if( rectangle.x1 > 130 )
   {
     rectangle.x1 = 0 ;
     LCDClearScreen();
    if( rectangle.color++ > 10 )
      { rectangle.color = 0; }
   }

   if( rectangle.y2 > 130)
   { rectangle.y2 = 0;}

   UartSendStr( " PASSED " ); // sends data to uart

   OSQPost( lcdq, (void *)&rectangle);


  }

}


/*********************************************************************************************************
*                                                Task_LCD()
*
* Description :
*                .
*
* Argument(s) : none.
*
* Return(s)   : none.
*
* Caller(s)   :
*
* Note(s)     : none
*********************************************************************************************************/
void Task_LCD ( void *pdata )
{

  unsigned char err;

  int TempColor[11] =
                    { WHITE, BLACK, RED, GREEN, BLUE, CYAN, MAGENTA,
             YELLOW, BROWN, ORANGE, PINK };



  lcdgraphics *rectangle;

  pdata = pdata;

  while( 1 )
  {

     rectangle = (lcdgraphics *)OSQPend( lcdq, 0, &err );
     OSTimeDlyHMSM(0, 0, 0, 50);

     LCDSetRect(rectangle->x1, rectangle->y1,
                      rectangle->x2, rectangle->y2,
                      FILL, TempColor[ rectangle->color] );


   }

}
             
//   WARM REGARDS
// YOUR HELP WILL BE GREATLY APPRECIATED


« Last Edit: June 23, 2009, 04:39:03 16:39 by 30f4011 » Logged
Pages: [1]
Print
Jump to:  


DISCLAIMER
WE DONT HOST ANY ILLEGAL FILES ON THE SERVER
USE CONTACT US TO REPORT ILLEGAL FILES
ADMINISTRATORS CANNOT BE HELD RESPONSIBLE FOR USERS POSTS AND LINKS

... Copyright 2003-2999 Sonsivri.to ...
Powered by SMF 1.1.18 | SMF © 2006-2009, Simple Machines LLC | HarzeM Dilber MC