Industry Automation and Control Forum
This forum is addressing industrial automation design & engineering, operations, asset performance, cyber security and digital transformation for Plants & Machines.
Posted: 2020-12-29 05:28 AM
Link copied. Please paste this link to share this article on your social media post.
Posted: 2020-12-29 05:28 AM
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
Link copied. Please paste this link to share this article on your social media post.
Posted: 2020-12-29 11:51 PM
Link copied. Please paste this link to share this article on your social media post.
Posted: 2020-12-29 11:51 PM
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;
(*********************************************************************************)
Link copied. Please paste this link to share this article on your social media post.
Posted: 2020-12-29 11:51 PM
Link copied. Please paste this link to share this article on your social media post.
Posted: 2020-12-29 11:51 PM
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;
(*********************************************************************************)
Link copied. Please paste this link to share this article on your social media post.
Create your free account or log in to subscribe to the board - and gain access to more than 10,000+ support articles along with insights from experts and peers.