Maker Pro
Maker Pro

Task function in program

vead

Nov 27, 2011
473
Joined
Nov 27, 2011
Messages
473
Hello
I was reading document , there was topic Task function with part of program. its related to RTOS program.
Code:
int main ( void )
{
vInitSystem();// Initialization of peripherals
while(1) // Infinitive function calling loop
{
vTask1(); // Calling task function named vTask1
vTask2(); // Calling task function named vTask2
vTask3(); // Calling task function named vTask3
}
}
. generally we connect microcontroller with different types of devices (LED, LCD, Keypad, button , switch, Motor ..etc) For specific purpose. there are different type of task such as turn on LED, turn off LED, wait , Run Motor, display message..etc there are three task in program that means device is doing three task. I don't understand, which type of task's it may be ?
can anyone explain with example
 

Harald Kapp

Moderator
Moderator
Nov 17, 2011
13,754
Joined
Nov 17, 2011
Messages
13,754
I don't understand, which type of task's it may be ?
Anything that may be required for the program to do its job.
e.g.
- read keyboard
- update display
- write somethinmg to a logfile
... whatever you need to do.
 

vead

Nov 27, 2011
473
Joined
Nov 27, 2011
Messages
473
Anything that may be required for the program to do its job.
e.g.
- read keyboard
- update display
- write somethinmg to a logfile
... whatever you need to do.
I have only two doubt
type 1. do we create task in program for only one device ?
Task1 turn ON LED
Task2 delay
Task3 Turn Off LED
Type 2 do we create task in program for multiple devices ?
task 1 Turn on LED
Task 2 turn On Motor
Task 3 display message on LCD
 

Harald Kapp

Moderator
Moderator
Nov 17, 2011
13,754
Joined
Nov 17, 2011
Messages
13,754
That depends on the complexity and the kind of task.
In principle you can use both methods, but encapsulating all the code that is required to e.g. control one device (e.g. LED) into a single task is what I'd prefer.
Imagine working on a big project with many programemrs. You can then assign each programme one task to develop. It would require a lot of communication between programmers if for example one programmer were to design the task for 'LED on', another programmer the task for 'LED off'. You'd have to ensure that these two programmers are syncronized in their use of ressources (ports, timers), in the use of consistent nomenclature etc.
How much simpler to assigng one programmer to create a task e.g. LED_Control with ('on', 'off', 'blink' etc.) as sub-programms of that single task while another programmers is occupied with e.g. controlling a motor.
 

vead

Nov 27, 2011
473
Joined
Nov 27, 2011
Messages
473
That depends on the complexity and the kind of task.
In principle you can use both methods, but encapsulating all the code that is required to e.g. control one device (e.g. LED) into a single task is what I'd prefer.
Imagine working on a big project with many programemrs. You can then assign each programme one task to develop. It would require a lot of communication between programmers if for example one programmer were to design the task for 'LED on', another programmer the task for 'LED off'. You'd have to ensure that these two programmers are syncronized in their use of ressources (ports, timers), in the use of consistent nomenclature etc.
How much simpler to assigng one programmer to create a task e.g. LED_Control with ('on', 'off', 'blink' etc.) as sub-programms of that single task while another programmers is occupied with e.g. controlling a motor.
I have downloaded book and pdfs I am studying documents . it has been long time searching but still have many doubts. Can you give me some simple assignment or task for further research just for learning
 

Harald Kapp

Moderator
Moderator
Nov 17, 2011
13,754
Joined
Nov 17, 2011
Messages
13,754
I'm truly sorry, but I do not have tha kind of material at hand.
 

vead

Nov 27, 2011
473
Joined
Nov 27, 2011
Messages
473
I'm truly sorry, but I do not have tha kind of material at hand.
Thanks for your effort and time. I am not asking for any material. it will be fine for me if you can tell me with specific device (LED or LCD) as you told me in your previous post
whats the requirement ?
which device is connected with microcontroler ?
how many task we are going to do ?
what will priority of task ?
all of answers I am looking in simple example. I have downloaded some sample code. but its more difficult to understand. if possible can you explain all things in single example..
 
Last edited:

Harald Kapp

Moderator
Moderator
Nov 17, 2011
13,754
Joined
Nov 17, 2011
Messages
13,754
These are questions i can't aswer for you. It is your task as a developer to decide what is cnnected where and how and how you are going to control it.
There is no universal standard for this.
Downloaded samle code is not much worth when you don't know in which context it is meant to be used. That is information that usually can be found at the same place where you found the code.

This is all stuff not easily and quickly explained in a few lines.
Use your favorite search engine and look up 'task scheduling fundamentals', read the material you find.
 

vead

Nov 27, 2011
473
Joined
Nov 27, 2011
Messages
473
These are questions i can't aswer for you. It is your task as a developer to decide what is cnnected where and how and how you are going to control it.
.
sorry for taking so much time. if you look at my first post I tried to explain with example. I am not asking answers. I am asking only idea. suppose you have only Microcontroller , LED and LCD. and you have connected LCD and LED to Microcontroller. what could you do with these devices using RTOS program. I am asking at least five task. what you can make using RTOS program that may be benefit for someone. I am asking example of task that you can do with these devices.
 
Top