Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

Micrium Rtos - OSTimeDly not working

Status
Not open for further replies.

nimaaa

Newbie level 6
Joined
Jul 25, 2014
Messages
14
Helped
1
Reputation
2
Reaction score
1
Trophy points
3
Location
Tehran, Iran, Iran
Activity points
122
Hi
I have initialized the Micrium Rtos and there is no error when I compile the project but there is a OSTimeDly function in my code that is not working.
I should notify that when I give the first argument of this function ( related to number of ticks to specify the time delay ) the value of 0 , my task is working well but giving any value to this argument (500 in my code) , stops the program .

here is mu code :
Code:
#include <GPIO_LPC17xx.h>
#include <app_cfg.h>
#include <os.h>

static			OS_TCB		AppTaskStartTCB;
static			CPU_STK		AppTaskStartStk[1000];
static 			void 			AppTaskStart(void *p_arg);

int main(void)
{
	OS_ERR err;
	
	
	GPIO_SetDir(0,20,GPIO_DIR_OUTPUT);
	GPIO_PinWrite(0,20,1);
	OSInit(&err);
	if (err !=OS_ERR_NONE) {
		GPIO_PinWrite(0,20,0);
	}
	OSTaskCreate((OS_TCB		*)&AppTaskStartTCB,
							(CPU_CHAR		*)"App Task Start",
							(OS_TASK_PTR)AppTaskStart,
							(void 			*)0,
							(OS_PRIO		 )5,
							(CPU_STK		*)&AppTaskStartStk[0],
							(CPU_STK_SIZE)1000/10,
							(CPU_STK_SIZE)1000,
							(OS_MSG_QTY  )0,
							(OS_TICK		 )0,
							(void			  *)0,
							(OS_OPT			 )(OS_OPT_TASK_STK_CHK  |  OS_OPT_TASK_STK_CLR),
							(OS_ERR			*)&err);
							
	if (err !=OS_ERR_NONE) {
		GPIO_PinWrite(0,20,0);
	}						
	OSStart(&err);
	if(err !=OS_ERR_NONE){
		GPIO_PinWrite(0,20,0);
	}
}
static void AppTaskStart (void *p_arg)
{
	OS_ERR err;	
	p_arg = p_arg;
	CPU_Init();
	GPIO_PinWrite(0,20,0);
	while(1)
	{
		[B]OSTimeDly((CPU_INT16U	)	500,[/B]
							(OS_OPT			)	OS_OPT_TIME_DLY,
							(OS_ERR		 *)	&err);
		GPIO_PinWrite(0,20,1);
		OSTimeDly((CPU_INT16U	)	500,
							(OS_OPT			)	OS_OPT_TIME_DLY,
							(OS_ERR		 *)	&err);
		GPIO_PinWrite(0,20,0);
	}
}

Please help me to solve this problem.
Thanks in advance
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top