create in multitasking os, what it mean?

Status
Not open for further replies.

shax

Newbie level 1
Joined
Mar 15, 2006
Messages
1
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,287
I am trying to create a multitasking module. anybody can explain to me actually what
happen when a task is created in term of internal processor register such as stack pointer or other register. I am using 8051 microcontroller.
 

My dear friend:

At 1st I will apologize for my poor Enghish.
I hope you can understand what I mean.

Now I will use AT89C51 (a chip compatible with MCS-51 products) to explain:

Suppose there are two tasks: Task1 and Task2

When operate Task1, the value of OS stack pointer----SP is 00H ( SP==00H ),and the stack range from 00H to 1FH. This stack pointer is also the Task1's data stack pointer.
Before OS switch from Task1 to Task2, the programme will execute an interruption (the interruption can be T1 overflow,or T0 overflow,or other else.But this interruption must be planed when you write the programme,it means you want the interruption appear at that time), this interruption will cause 4 things happen:

1st.
Push some registers' value into stack ,such as ACC,B,R0,R1....PSW.... any register you use in Task1,but will change its value in Task2.

2nd.
Give the new value to SP,the value should be Task2's stack pointer----SP is 20H,and the stack range from 20H to 3FH.This stack pointer is also the Task2's data stack pointer.

3
Pop the Task2's data out from the stack.

4.
Operate Task2.


I hope above is the answer you need.
If any question, sand me an E-mail, and I will try my best
aaaaaaaaaalyl@163.com
 

For basic understanding of multitasking, you can read the book of uC/OS II from Jean Labrosse chapter 2, I found the link for downloading in this forum somewhere.
It is very good for getting basic understanding of RTOS.

best regards,
 

Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…