void main (void)
{
int i_test = 0xABCD;
INTCONbits.GIEH = 0;
OSInit();
OSTaskCreate(TestTask, (void *)&i_test, &TestTaskStk[0], 0);
OSStart();
}
As from the code above, setting GIEH to 0 disables the global interrupt. I found no code wrote for enable ISR in this example. I wonder how this work as TMR0 ISR is needed to perform some OS level tasks.
I simulate this example in MPLAB v6.51, and found that TMR0 ISR was not triggered when TMR0 overflow. Am I missing something here?
I'd expect the OSStart call to end up calling a processor-specific routine which enables all interrupts - this will be done only after all the other initialisation has been completed, so the processor doesn't get interrupts before it is ready.
Currently, I’m working on the same port of uC/OS-II. And I have some suspicious over the operation of this RTOS as well.
Here is more information of my system.
OS: Win 2000
UC/OS version 2.51
MPLAB v 6.51
I test it using MPLAB Simulator, which I couldn’t see from watch window that the ISR was ever enabled. So I think this is the reason my system ran to OS_TaskIdle() and never exit this routine.