hi every one.
i am new to rtx51. i have one doubt as follows:
if i have a round robin time slice of 5msec. and my code is:
job1 () _task_ 1 { while (1) { counter1++; os_wait (K_TMO, 5, 0); } }
job2 () _task_ 2 { while (1) { counter2++; os_wait (K_TMO, 3, 0); } }
if the control is in job1.so, counter1 gets incremented and let us assume the time taken for the increment instruction is 2msec. After that because of os_wait it jumps to task2.
My question is, whether the control goes to task2 after 2msec or 5 msec(completion of timeslice)?
Thanks in advance
Hi If You move from poimt-to point (RS232) to network like RS485, You shouldd think about a lot of issues: 1. Who will be a master? how many masters allowed? 2. How to prevent simultaneous transmit? (collisions) 3. How You handle errors?
this is only a small part of problems in networking, even when only 3 nodes in it...
So dont try to create your own protocol, start from something ready, I recommend You ASCII mode MODBUS protocol, it's very simple and reliable. It divides the protocol to transport and application layers good enough, and there are a lot of samples about it implementation.
You need to read a bit deeper into the RTX51 manual. You have two cross purposes. But to answer your question, Task 1 will suspend as soon as it hits the os_wait statement. The 5 in the pramater list is in RTX 'ticks'. If you have your RTX ticks are set at 5 millisec, then your wait is 25 millisec and then Task 1 will 'go ready'. The same for task 2 but for a different wait time. Notice the term 'go ready'. Task 1 is just marked ready in the task queue. If any other task is active, task 1 will resume only when it is the next ready device in the queue. You do not specify the clock rate or device type but assuming a simple 8051 at 12 MHz and 12 clock cycles, you would spend much more time in switching overhead than running your code. With the stated 8051, a 10 millisec tick should be the smallest than you select. Also, if you are planning to use co-operative task switching (os_waits) then you should disable round robin time sliceing. All of this and much more is in the RTX documentation. Bradford
Did I just hit a time warp? RS232, RS485, where did that come from?? Bradford