Hello all, I'm using C51 V7.03 and RTX51-full. Can someone tell me why I can't create a task in an interrupt function? When I do it, the program stuck or enters to endless loop (I don't know). To check this problem I run the program with Ceibo's emulator. I set a break point on the line that call to os_create_task(). When I try to execute this line the program stuck… P.S. I tried the same code in RTX-tiny and its running perfectly. Waiting for your help, Roberto
To quote the RTX-51 manual: - Functions that begin with os_ may be called from a task but not from an interrupt service routine. - Functions that begin with isr_ may be called from an interrupt service routine but not from a task. OS kernels of any sort have all sorts of internal data structures shared between interrupts and tasks. Access to these data structures, like any sort of critical region, has to be controlled through some sort of mutual exclusion. Usually, that means interrupt masking. It's very common for an RTOS API to forbid most calls from within an ISR, while still allowing a few so that the ISRs can signal tasks in some manner. The call would still be illegal in RTX-51 Tiny (according to the manual). If it happens to work, perhaps you're just lucky, or perhaps the simpler OS doesn't happen to have a potential conflict in the implementation of particular call. Keil seems to want to keep the API the same between Tiny and Full.