Invite a Co-worker
Send a co-worker an invite to the Exchange portal.Just enter their email address and we’ll connect them to register. After joining, they will belong to the same company.
Send Invite Cancel
80821members
346893posts

how to get Task Information

Solved
andrea_romacco
Crewman
Crewman
0 Likes
1
523

how to get Task Information

Dear All

i'm new to schneider, my previous system was simotion.

In the old system there was a function called _getCurrentTaskName() it return the name of the task as a string.

is there something similar and may i ask a code example?

i suppose there is a library to use but i don't know wich one....

I'm using a PacDrive 3 LMC400c whit SoMachine v4.41 (v4.4 SP1)

 

 

thanks in advance

 

Andrew

Tags (1)

Accepted Solutions
andrea_romacco
Crewman
Crewman
0 Likes
0
511

Re: how to get Task Information

Hi all

i want to sharee the way i found to get the task information:

 

 

(*********************************************************************************)

FUNCTION device_get_task_info : BOOL

VAR_IN_OUT
task : device_task; (*this is a struct were the information are stored*)
END_VAR

VAR
myInfo : POINTER TO Task_Info2;
tResult : DWORD;
tResult2 : DWORD;
END_VAR

 

(*********************************************************************************)
myInfo := IecTaskGetInfo3(
                              hIecTask := IecTaskGetCurrent(pResult:= tResult)
                              ,pResult:= tResult2
                              );

 

task.cycle_time := myInfo^.dwInterval;
task.last_cycle := myInfo^.dwCycleTime;
task.max_duration := myInfo^.dwMaxCycleTime;
task.min_duration := myInfo^.dwMinCycleTime;
task.average_duration := myInfo^.dwAverageCycleTime;
task.name := myInfo^.pszName^;
task.priority := myInfo^.nPriority;
task.watchdog := myInfo^.bWatchdog;

(**********************************************************************************
TaskCyclic INT 16#0
TaskEvent INT 16#1
TaskExternal INT 16#2
TaskFreewheeling INT 16#3
**********************************************************************************)

CASE myInfo^.KindOfTask OF
0: task.task_type := TASK_TYPE_CYCLIC;
1: task.task_type := TASK_TYPE_EVENT;
2: task.task_type := TASK_TYPE_EXTERNAL;
3: task.task_type := TASK_TYPE_FREEWHEELING;
END_CASE;

(*********************************************************************************)

See Answer In Context

Tags (1)
1 Reply 1
andrea_romacco
Crewman
Crewman
0 Likes
0
512

Re: how to get Task Information

Hi all

i want to sharee the way i found to get the task information:

 

 

(*********************************************************************************)

FUNCTION device_get_task_info : BOOL

VAR_IN_OUT
task : device_task; (*this is a struct were the information are stored*)
END_VAR

VAR
myInfo : POINTER TO Task_Info2;
tResult : DWORD;
tResult2 : DWORD;
END_VAR

 

(*********************************************************************************)
myInfo := IecTaskGetInfo3(
                              hIecTask := IecTaskGetCurrent(pResult:= tResult)
                              ,pResult:= tResult2
                              );

 

task.cycle_time := myInfo^.dwInterval;
task.last_cycle := myInfo^.dwCycleTime;
task.max_duration := myInfo^.dwMaxCycleTime;
task.min_duration := myInfo^.dwMinCycleTime;
task.average_duration := myInfo^.dwAverageCycleTime;
task.name := myInfo^.pszName^;
task.priority := myInfo^.nPriority;
task.watchdog := myInfo^.bWatchdog;

(**********************************************************************************
TaskCyclic INT 16#0
TaskEvent INT 16#1
TaskExternal INT 16#2
TaskFreewheeling INT 16#3
**********************************************************************************)

CASE myInfo^.KindOfTask OF
0: task.task_type := TASK_TYPE_CYCLIC;
1: task.task_type := TASK_TYPE_EVENT;
2: task.task_type := TASK_TYPE_EXTERNAL;
3: task.task_type := TASK_TYPE_FREEWHEELING;
END_CASE;

(*********************************************************************************)

Tags (1)