Enable or disable software modules at run time

Hi,

Is it possible to enable/disable software modules at runtime?

Like this but at runtime.

Hi,

yes, by using the function blocks ST_tmp_suspend() and ST_tmp_resume() from the sys_lib library.

Best regards!

1 Like

In case you want to do it manually via AS and not pro grammatically, you also can do that during runtime:

Go To “Online”->“Compare”->“Software” and use the context menu on the program you want to stop on the right side.

1 Like

Hi @alexander.hefner thank you for the help I will try that.

@c495550 could be a simpler solution. Is it possible to do the same but using the runtime utility center?

Thanks again for the help.

Regarding the ST_tmp_suspend() and ST_tmp_resume() I’m unable to compile the B&Rs example, it’s as if I’ve not added the library. Would you happen to have any idea what the could will be the problem?

	string1:='teste';
	status_id := ST_ident(ADR(string1), 0, ADR(ident));
	IF (status_id <> 0) THEN
		error_var:=1; (* set error level for ST_ident *)
	ELSE
		status_sp := ST_suspend(ident); (* stop task permanent*)
		IF (status_sp = 0) THEN
			status_inf := ST_info(ident, ADR(stat), ADR(tcnr));
			IF(status_inf<>0) THEN
				error_var:=3; (* set error level for ST_info *)
			END_IF
		ELSE
			error_var:=2; (* set error level for ST_suspend *)
		END_IF
	END_IF

	IF (status_inf = 0) THEN 
		status_st := ST_resume(ident); (* start task permanent*)
	ELSE
		error_var:=4; (* set error level for ST_resume *)
	END_IF

Hi,

the sample is based on the function calls without “tmp” in the function name: those are legacy functions not usable with actual systems.

You have to replace those calls with the functions containing the “tmp” in the function name, so please use “ST_tmp_suspend” and “ST_tmp_resume” instead of “ST_suspend” and “ST_resume”.

Best regards!

Everything is working now, but after a reboot, the task starts again automatically, which I don’t want. I need the task to start only when I explicitly call the function.

Hi,

yes, it’s like you’ve described. The actual systems (Intel and ARM based) only support the temporary suspending / resuming of tasks, a non-volatile suspending is not supported.

I solved it in my projects by suspending the wanted tasks every boot via the function call inside the INIT program, and resuming it by a “managing” task when needed.

As additional info: when calling ST_tmp_suspend() with parameter .st_ident = 0, the calling task is suspended, so it’s pretty easy suspending “myself” in INIT.

Best regards!

Hi @alexander.hefner,

I tried your solution and it works great.

Thanks for the help.

1 Like