Hi, i am trying to implement two tasks in RTX RTOS.Purpose of the tasks are: Task 1 waits for the pin15 of PORT0 to go high; if it does, then LED blinks. Task 2 blinks LED irrespective of completion of task1. But when I simulate the code, if I make the pin15 of PORT0 high, then both the tasks are running. If i "switch off" the pin15, then task 2 goes into ready phase and task 1 goes into running phase. I can't see the task2 LED blinking while the pin15 of port0 "switched off" . Please help.
this is the following code:
#include <rtl.h> #include <LPC21xx.H>
OS_TID TID1; OS_TID TID2; __task void task1 (void); __task void task2 (void);
__task void task1 (void) { for (;;) {
if(IOPIN0&(0x00008000)) {
IOSET1=0x00000001; os_dly_wait (5); IOCLR1=0x00000001; os_dly_wait (5);
}
__task void task2 (void) { for (;;) {
IOSET1=0x00000002; os_dly_wait (5); IOCLR1=0x00000002; os_dly_wait (5);
__task void init (void) { TID1=os_tsk_create (task1, 1); TID2=os_tsk_create (task2, 1); os_tsk_delete_self(); }
int main (void) { IODIR1=0x000000FF; IODIR0=0x00000000; os_sys_init(init); /* Start the init task */ }