Bei aktivem Prozess LED einschalten?

Harry
Moderator
Avatar
Gender:
Location: zwischen Augsburg und Ulm
Age: 59
Posts: 2078
Registered: 03 / 2003
Subject:

Bei aktivem Prozess LED einschalten?

 · 
Posted: 17.07.2019 - 11:08  ·  #1
Hallo Zusammen,

in mir ist da gerade eine dumme (?) Idee erwacht: Wie könnte ich immer dann, wenn ein Prozess aktiv ist, eine LED einschalten (oder einen Port auf lo/hi setzen)?
Klar kann ich am Anfang und Ende des Prozesses einen Portstatus ändern, aber wenn der Prozess mittendrin unterbrochen wird stimmt es ja nicht.

Ideen?

Gruss
Harry
rh
Administrator
Avatar
Gender:
Location: Germany
Age: 24
Homepage: e-lab.de
Posts: 5558
Registered: 03 / 2002
Subject:

Re: Bei aktivem Prozess LED einschalten?

 · 
Posted: 17.07.2019 - 18:47  ·  #2
Hallo Harry,

das einzigst was mir hinzu einfällt ist
Procedure OnSchedulerEntry;
Procedure OnSchedulerExit;

rolf
Merlin
Administrator
Avatar
Gender:
Age: 24
Posts: 1372
Registered: 03 / 2005
Subject:

Re: Bei aktivem Prozess LED einschalten?

 · 
Posted: 18.07.2019 - 11:39  ·  #3
Hi Harry

By its very nature a process will be interrupted. So I am guessing you want a visual indication that a process is still running normally. The way I do that sort of thing is set a flag in the process, then in the main loop copy the flag state to an LED and reset the flag (always assuming, of course that the main thread is never suspended). Then, if the process is no longer being called, or is stuck in an infinite loop, the LED is extinguished. If, on the other hand I want to check that a task is running normally, I do the same thing but set the flag at the end of the task. (Obviously the state of the flag and the LED may be in an opposite sense to each other, but you will know how to handle that).
rh
Administrator
Avatar
Gender:
Location: Germany
Age: 24
Homepage: e-lab.de
Posts: 5558
Registered: 03 / 2002
Subject:

Re: Bei aktivem Prozess LED einschalten?

 · 
Posted: 20.07.2019 - 18:50  ·  #4
Hallo
so sollte es gehen:
Mit dem callback onSchedulerExit die aktuelle Prozess ID feststellen.
Prüfen ob es die richtige ID ist.
Wenn ja LED_ON
wenn nein LED_OFF.
Register Rettung nicht vergessen
rolf
Selected quotes for multi-quoting:   0

Registered users in this topic

Currently no registered users in this section

The statistic shows who was online during the last 5 minutes. Updated every 90 seconds.
MySQL Queries: 15 · Cache Hits: 14   79   93 · Page-Gen-Time: 0.026314s · Memory Usage: 2 MB · GZIP: on · Viewport: SMXL-HiDPI