Hello All, If i disable round-robin switching in RTX51Tiny
TIMESHARING EQU 0 ; default is 5 Hardware-Timer ticks ; 0 disables Round-Robin Task Switching
and if i have two tasks in my code then what would be the basis for task switching??
With round-robin ON by default: In my code i have two tasks and one serial ISR.
I use task 1 for serial I/O and task 2 for displaying on 8 7-segment display, and am struggling to avoid display flickering lest i use os_switch_task() at places where I wait for TXD to occur:
while(tx_flag!=1) {os_switch_task();}
And when I download the code into my P89V51RD2 and debug using Hyperterminal(9600,8-bit,no parity,no handshake) i get proper display values; but the display remains blank if i connect it to my machine sending data at the same baud rate.
Without round-robin your tasks should wait for something to happen. Let the serial consumer sleep until the ISR sends a message with a received character.
Round-robin is for similarly prioritized tasks that perform busy-looping, i.e. that runs continuously. To conserve CPU resources, you should aim for tasks that can sleep while waiting for events to happen. Even if your CPU is fast enough, you may reduce the power consumption (for example if running on battery) by writing an application that can place CPU in power-save mode when nothing happens.