We are running a survey to help us improve the experience for all of our members. If you see the survey appear, please take the time to tell us about your experience if you can.
Hi all, This is my second message on the issue to clarify the question. From the documentation: **************** Standart C51 functions must not be called simultaneously from several tasks or interrupt procedures. These functions store their parameters and local data in static memory segments; for this reason, this data is overwritten by a repetitive call. In order to solve this problem, C51 provides reentrant functions. ..... Since RTX51 Tiny does not contaion any management for the reentrant stack, the round robin task switching must be disabled when reentrant functions are used. RTX51 Tiny can manage reentrant functions in the compact model. **************** In the light of these, can I use reentrant functions with task switching in the compact model? If I cannot use task switching with reentrant function, where is the multi-tasking property of RTX51? If round-robin task switching disabled, is a task switching performed when an os_wait() function is executed? regards,
Thank you for your kind reply and quotation. Yes, the quotation clarified the issue. According to the text; 1. We cannot use non-reentrant functions from several tasks. C functions which only uses registers for parameters are inherently reentrant. Then when task switching performed, registers are backed up to the system. Is this true? Then how can I define a variable in register? I tried "register data int..", but this did not work. 2. When using reentrant functions, task switching should be disabled (for tiny). Then where are the benefits of using RTX51? Cannot I use functions and RTX51 tiny together? Thanks for reading...
Then where are the benefits of using RTX51? Cannot I use functions and RTX51 tiny together? The only problem comes when you have a function that is called from more than 1 task. The problem is that since arguments and locals are stored in fixed memory locations, functions are no reentrant (by default). If you need reentrant functions, declare them as follows:
int function (arg_list) compact reentrant { }
Dear Ward, Following is a quotation from Andrew's mail: ***************** calls. However, RTX51 Tiny does not contain any management for the C51 reentrant stack. If you are using reentrant functions in your application you must ensure that these functions do not call any RTX51 Tiny system functions and that reentrant functions are not interrupted by the Round-Robin task scheduling of RTX51 Tiny. The full version, RTX51 Full contains a stack management for reentrant functions. ******************* According to this, even with reentrant functions you CANNOT use task switching. In fact I have a PID routine which calculates and acts properly in an *infinite loop*. I want to call this function for different channels from 8 different task. This way, I can manage 8 different channels using a single PID routine. But the manuel says that I cannot use functions with task switching enabled. Am I wrong?