View unanswered posts | View active topics It is currently Mon Sep 28, 2020 2:27 pm

Reply to topic  [ 4 posts ] 
What does StartTask()? 
Author Message

Joined: Wed Jan 31, 2007 7:11 am
Posts: 4
Post What does StartTask()?
What does StartTask() method?
What different between void Sub () and task Sub() ?

Thu Feb 01, 2007 4:03 am
Profile WWW
Site Admin
Site Admin

Joined: Wed Jan 24, 2007 10:42 am
Posts: 620
Void Sub() and Task Sub() are used to define different subroutines (tasks).

Task Control
Up to ten tasks can execute concurrently within a NXT user program. The ‘main’ or ‘primary’ task is automatically started when a user program is run. Execution of other tasks can be started and stopped with the ‘StartTask’ and ‘StopTask’ functions. The NXT will share CPU execution time among various tasks by giving each task a “time slice” where it will execute a group of instructions.

Each task can be assigned a priority from 0 to 255. The NXT scheduler gives execution time to the highest priority task that is waiting to run. A round robin scheduling scheme is used when there are multiple tasks ready to run all with the highest priority. Lower priority tasks will not execute until there are no tasks of higher priority that are ready to run.

A task that is waiting for a time period to expire is not ready to run. Once the time period has expired it will again become ready to run. Waiting tasks do not consume any CPU cycles.


Variable containing the priority of the current task.


Constant. The default priority assigned to a task.


Constant. Highest priority that can be assigned to a task.


Constant. Lowest priority that can be assigned to a task.


The numeric value for the current task.


Used to specify the size of an execution time slice before switching to another task. User should not normally have to modify this variable.


Starts or restarts execution of the specified task.


Stops execution of the current program.


Stops execution of a single task.


Immediately ends the current task time slice and allows another task to be immediately scheduled and executed.

Timothy Friez
ROBOTC Developer - SW Engineer

Thu Feb 01, 2007 11:18 am

Joined: Wed Jan 31, 2007 7:11 am
Posts: 4
thank you

Thu Feb 01, 2007 12:31 pm
Profile WWW

Joined: Fri Feb 09, 2007 9:21 am
Posts: 616
A subroutinie/function can be called from within a program.

A "task" is like a "thread" or "process" in an operating system. It is a separate "stream of execution" and allows two activities to execute in parallel. As an example, consider a miltiary tank: You have one task to drive the tank. You have a second task to turn the turret and position the gun.

Fri Feb 09, 2007 11:56 am
Display posts from previous:  Sort by  
Reply to topic   [ 4 posts ] 

Who is online

Users browsing this forum: No registered users and 2 guests

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  

Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group.
Designed by ST Software for PTF.