May 8, 2011

Mint Motion Programming Tutorial - Part 5


Up till now we have understood the basics of Mint Language , Scope of Variables and Declaration of Subroutines/Functions. So we have got the complete basic idea about Mint Language. Now we will proceed with Program part i.e the basic program structure and how to make program in Mint Motion language for Baldor Products.

Basic Program Structure for Mint Motion Language :-
MintMT always has a ‘Parent’ task (Main Program) used to Run / stop the child tasks , define child task priorities using TaskPriority , define number of instructions executed in a child task before switching using TaskQuantum , Check child task status using the TaskStatus keyword. The parent task also Contain global Event handlers such as ONERROR and also used for defining global data, functions and subroutines for use by other tasks subroutines and functions.
Important Note :- MintMT program will terminate when the Parent task terminates

How to Define Task in Mint MT :-
Task is same as Program , task are the key builders in a Mint Program. Now let us see that how to declare the task to be used in Mint Program. Tasks are created with the Task keyword.
SYNTAX :-
Task myTask
Loop
….
End Loop
End Task
Note :- Here mytask is the name of Task (you can put any name )
The task defined in program are executed whenever the run command is issued for a particular task in the Mint Program.
Run myTask
Task can be suspended anyway within the program using TaskSuspend. Tasks will run until End Task is executed.

As discussed in Previous tutorial subroutines and functions are local for a task, so this allows data, subroutines and functions of the same name to exist in multiple tasks.Tasks have their own environment variables
AXES strings, Terminal, Timer
Status of task can be read using TaskStatus. Priority of task can be set with TaskPriority

Now the main question arises that when should one use a task in program ? There are mainly 4 points when we prefer task , see below :-
1.When code in an Event would hold out processing of other vital instructions
2.When several unrelated things all need processing ‘simultaneously’
3.To break the program down into logical blocks
4.To allow a section of code to be suspended or terminated at any time by an external source

Hope that this tutorial helped you to understand about creation and usage of task in the Mint Motion language.
Subscribe to Automation-Talk by Email.

Advertisements :-

0 comments:

Post a Comment

Receive all updates via Facebook. Just Click the Like Button Below